-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: exampleDependencies aren't used (#68)
Rosetta has a feature to include external packages into its example compilation dependency tree, so that you can write examples in your README using packages that depend on the package you're writing the README for. You couldn't have those dependencies in your actual dependency tree, but there is a special section in `package.json` that can do it. Schematically: ``` mydep ▲ │ mypackage < write a compilable example that uses 'myinteg' ▲ │ myinteg ``` Put the following into `package.json`: ```json { "jsiiRosetta": { "exampleDependencies": { "myinteg": "^1.2.3" } } } ``` While this feature was advertised, it didn't actually work: * The dependency closure tree was built, but it was never used during compilation (we erroneously set the compilation directory to the directory of the package the sample was found). * You could not specify `*` as a version number because a package we use, `semver-intersect`, doesn't support `*`. * We need to take additional care when mixing symlinked and installed packages that `peerDependency` (e.g., `constructs`). By the original closure directory construction method, we would end up with the wrong version of `aws-cdk-lib` in the dependency closure, and 2 copies of `constructs` (leading to the `Construct is not assignable to Construct` error). To solve all of this, fully crawl the dependency tree, build a `package.json` to install everything in one go, and do use the compilation directory that we build this way. Also in this PR: * Wrap `semver-intersect` with a helper function to handle one more case and fail gracefully if we encounter more cases it doesn't handle. * Add some debug printing and a `--no-cleanup` flag for easier debugging. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0 --------- Signed-off-by: github-actions <[email protected]> Co-authored-by: github-actions <[email protected]>
- Loading branch information
Showing
12 changed files
with
277 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.