- Notifications
You must be signed in to change notification settings - Fork5
A Github Action for validating package.json conventions.
License
ExpediaGroup/package-json-validator
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A Github Action for validating package.json conventions.
Use therules input to specify one or more rules you would like to check for yourpackage.json.
The "ranges" rule validates that all package.json dependencies are exact versions, or use only the allowed version ranges specified.Click here for details about version ranges.
The following usage would allow"my-package": "1.2.3" but prevent"my-package": "^1.2.3".
steps: -name:Checkoutuses:actions/checkout@v3 -uses:ExpediaGroup/package-json-validator@v1with:rules:ranges
You can also specifyallowed-ranges. The following would allow"my-package": "^1.2.3" but prevent"my-package": "~1.2.3".
steps: -name:Checkoutuses:actions/checkout@v3 -uses:ExpediaGroup/package-json-validator@v1with:rules:rangesallowed-ranges:^
The "tags" rule validates that all package.json dependencies contain no tagged versions, or use only the allowed tags specified.Click here for details about tags.
The following usage would allow"my-package": "1.2.3" but prevent"my-package": "1.2.3-alpha.456.0".
steps: -name:Checkoutuses:actions/checkout@v3 -uses:ExpediaGroup/package-json-validator@v1with:rules:tags
The following usage would allow"my-package": "1.2.3-canary.456.0" but prevent"my-package": "1.2.3-alpha.456.0".
steps: -name:Checkoutuses:actions/checkout@v3 -uses:ExpediaGroup/package-json-validator@v1with:rules:tagsallowed-tags:canary
The "resolutions" rule validates that your package.json does not contain theresolutions option.
steps: -name:Checkoutuses:actions/checkout@v3 -uses:ExpediaGroup/package-json-validator@v1with:rules:resolutions
Specifyignore-resolutions to skip resolution validation entirely for certain packages. Optionally provide a newline separated list of package names here
steps: -name:Checkoutuses:actions/checkout@v3 -uses:ExpediaGroup/package-json-validator@v1with:rules:resolutionsignore-resolutions:resolution-package-to-ignore
Specifyignore-resolutions-until to skip resolution validation entirely for certain amount of time. You can use any format supported by Date constructorMDN
steps: -name:Checkoutuses:actions/checkout@v3 -uses:ExpediaGroup/package-json-validator@v1with:rules:resolutionsignore-resolutions-until:2000-01-01
The "keys" rule validates that your package.json does not contain duplicate dependency keys.
steps: -name:Checkoutuses:actions/checkout@v3 -uses:ExpediaGroup/package-json-validator@v1with:rules:keys
Example invalid package.json this will prevent:
{"dependencies": {"some-dependency":"1.0.0","some-dependency":"2.0.0" }}Specifypackage-json-location to specify another location for the package.json to validate. Defaults to./package.json.
steps: -name:Checkoutuses:actions/checkout@v3 -uses:ExpediaGroup/package-json-validator@v1with:rules:rangespackage-json-location:./project/package.json
Specifydependency-types to denote which type of package.json dependencies you wish to validate. Valid options includedependencies,devDependencies,peerDependencies, andoptionalDependencies. Defaults todependencies.
steps: -name:Checkoutuses:actions/checkout@v3 -uses:ExpediaGroup/package-json-validator@v1with:rules:rangesdependency-types:devDependencies
Specifyignore-packages to skip validation entirely for certain packages. Optionally provide a newline separated list of package names here.
steps: -name:Checkoutuses:actions/checkout@v3 -uses:ExpediaGroup/package-json-validator@v1with:rules:rangesignore-packages:package-to-ignore
You may also enforce multiple rules (and pass additional inputs) like this:
steps: -name:Checkoutuses:actions/checkout@v3 -uses:ExpediaGroup/package-json-validator@v1with:rules:| ranges tagsallowed-ranges:| ^ *allowed-tags:| alpha canarydependency-types:| dependencies devDependenciesignore-packages:| package-to-ignore another-package-to-ignore
This project is part of Expedia Group Open Source but also maintained byDan Adajian
- Expedia Group OSS
The scripts and documentation in this project are released under theApache 2 License.
- Follow semantic-release commit formatting. SeeCONTRIBUTING.md for details.
About
A Github Action for validating package.json conventions.
Topics
Resources
License
Code of conduct
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors6
Uh oh!
There was an error while loading.Please reload this page.