-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix order of deps-related fields on package.json
+ add automated check
#6810
Conversation
` Expected: ${expectedStr}`, | ||
); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
I also would like to add a step in |
ea3cc2d
to
3f927a9
Compare
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? |
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š <[email protected]>
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š <[email protected]>
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š <[email protected]>
3f927a9
to
938bb47
Compare
The first commit adds a new step to
bin/check-package-metadata.js
to ensure that all public packages list deps in the following order:peerDependencies
dependencies
devDependencies
The second commits adds a new step to
bin/fix-monorepo.js
to update allpublic packages to list deps in the correct order.
The second commit fixes packages via
bin/fix-monorepo.js
to 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 test
passes on your machinepackages/cli
were updatedexamples/*
were updated👉 Check out how to submit a PR 👈