Reputation: 776
Is there a way to detect pre-release dependencies in package.json or package-lock.json?
My context is I would like to create a git "TAG" to indicate release candidates of my code. I would like to make sure all my in-house developed modules do not have dependencies on any pre-release modules.
I would like to detect presence of a pre-release dependencies( "^1.0.3-NIGHTLY") in my package.json as below example:
"@mydomain/client-mgr-service": "^1.0.3-NIGHTLY", <= I would like to be able to detect this line if there is a NPM feature out-of-box
"@types/country-data": "0.0.0",
"amazon-cognito-identity-js": "^3.0.12",
Thanks in advance for any helps given~
Upvotes: 1
Views: 394
Reputation: 776
Here is a simple solution I used to detect if there is any pre-release dependencies in my package.json. The idea is to check if there is a "-" right after semver's x.y.z numbers.
grep -P "([0-9]\d*)\.([0-9]\d*)\.([0-9]\d*)-" package.json
Upvotes: 1