Cannot specify `*` for node peer dependency version ranges.
See original GitHub issue@*
is a valid version range in NPM. It is useful in peerDependencies
where it may not matter or may be difficult to specify a version range.
Current:
When package@*
is given for a peer dependency, projen
shows a prompt to resolve it to a specific version.
Feature Request:
package@*
should be persisted in the peer dependencies in the package.json
Input:
peerDeps: ["package@*"]
Output
"peerDependencies": {
"package": "*"
}
Example:
We have an issue in functionless
where we need to specify *
for a package that only has pre-release versions, but needs to match the version ranges of sibling packages.
Specifically,
- functionless relies on
@aws-cdk/aws-appsync-alpha
- functionless would like to allow for a range of aws-cdk versions per functionless version (https://github.com/sam-goodwin/functionless/issues/107)
@aws-cdk
2.0 chose to use pre-release versions (2.17.0-alpha.0
) for all experimental packages (https://github.com/aws/aws-cdk/issues/15581#issuecomment-896938220)- npm/semver do not support supplying a range of pre-release versions across major/minor/patch versions.
- npm 7+ fails by default when peer dependencies do not match (can be forced).
Thus, any version range given by functionless peer dependencies (2.17.0-alpha.0
) are pinned to a single @aws-cdk
major/minor/patch version (2.17.0
).
Supplying @aws-cdk/aws-appsync-alpha@*
would resolve this issue without consumers using npm 7+
needing to force all “invalid” peer dependencies.
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top GitHub Comments
I think you’re right, auto-resolving “*” feels surprising especially when you’re declaring peer dependencies.
@thantos What if we support your use case like this?
Currently this method already exists, just the “resolveVersion” part doesn’t do anything (yet).
We tried to use overrides https://projen.io/escape-hatches.html, but found that overrides cannot update fields that are managed by
projen
.