Fix order of deps-related fields on package.json + add automated check#6810
Merged
Fix order of deps-related fields on package.json + add automated check#6810
package.json + add automated check#6810Conversation
bajtos
commented
Nov 19, 2020
| ` Expected: ${expectedStr}`, | ||
| ); | ||
| } | ||
| } |
Member
Author
There was a problem hiding this comment.
Example output:
Error: Some of the packages are not following loopback-next guidelines: |Error: Some of the packages are not following loopback-next guidelines:
|
- docs/package.json has incorrect order of keys. |- docs/package.json has incorrect order of keys.
Actual: devDependencies dependencies | Actual: devDependencies dependencies
Expected: dependencies devDependencies | Expected: dependencies devDependencies
- examples/greeter-extension/package.json has incorrect order of keys. |- examples/greeter-extension/package.json has incorrect order of keys.
Actual: devDependencies dependencies | Actual: devDependencies dependencies
Expected: dependencies devDependencies
raymondfeng
approved these changes
Nov 19, 2020
Contributor
|
I also would like to add a step in |
ea3cc2d to
3f927a9
Compare
Member
Author
That's a great idea, very helpful to resolve merge conflicts after some of the dependencies are updated by RenovateBot (as happened during my night) 👍 The implementation is a bit more tricky, because we need to decide where to put the block of dependency-related fields. I decided to start it after I reworked this PR as follows:
@raymondfeng LGTY now? |
raymondfeng
approved these changes
Nov 20, 2020
Add a new step to `bin/check-package-metadata.js` to ensure that all public packages list deps in the following order: 1. `peerDependencies` 2. `dependencies 3. `devDependencies` Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
Add a new step to `bin/fix-monorepo.js` to ensure that all
public packages list deps in the following order, starting
after `publishConfig` or `license` field:
1. `peerDependencies`
2. `dependencies
3. `devDependencies`
Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
Ensure deps are specified in the following order, starting after `publishConfig` or `license` field: 1. `peerDependencies` 2. `dependencies 3. `devDependencies` Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
3f927a9 to
938bb47
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The first commit adds a new step to
bin/check-package-metadata.jsto ensure that all public packages list deps in the following order:peerDependenciesdependenciesdevDependenciesThe second commits adds a new step to
bin/fix-monorepo.jsto update allpublic packages to list deps in the correct order.
The second commit fixes packages via
bin/fix-monorepo.jsto pass the new check enforced bybin/check-package-metadata.js.This is a follow-up for the discussion in #6288.
To keep the changes small, focused and easy to review, I am intentionally NOT fixing dependencies vs. peerDependencies. I would like to open another PR to add an automated check + fix any violations discovered (e.g. in
examples/greeter-extension).Checklist
npm testpasses on your machinepackages/cliwere updatedexamples/*were updated👉 Check out how to submit a PR 👈