-
Notifications
You must be signed in to change notification settings - Fork 282
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
ci(custom-checks): fix broken package.json sort verification #2356
Comments
- Remove not working check-package-json-sort.ts script. - Add ci action to check for unsorted package.json files. Closes: hyperledger-cacti#2356 Signed-off-by: Tomasz Awramski <tomasz.awramski@fujitsu.com>
@petermetz Found error in usage of sort-package in scripts introduced in this issue https://github.com/hyperledger/cacti/issues/1341. I did simple CI action to check if package.json files in /examples and /packages are sorted. If not, it prints short script to run in cactus root folder to sort remaining packages. |
- Remove not working check-package-json-sort.ts script. - Add ci action to check for unsorted package.json files. Closes: hyperledger-cacti#2356 Signed-off-by: Tomasz Awramski <tomasz.awramski@fujitsu.com>
- Remove not working check-package-json-sort.ts script. - Add ci action to check for unsorted package.json files. Closes: hyperledger-cacti#2356 Signed-off-by: Tomasz Awramski <tomasz.awramski@fujitsu.com>
@rwat17 Thank you very much! My preferred way would be to solve it via the existing NodeJS script instead of going down a level to writing shell because of these questions that popped into my head: Questions:
If all of these are OK in your opinion then I'd be fine with the shell script instead of the NodeJS script, just let me know your thoughts! |
- Remove not working check-package-json-sort.ts script. - Add ci action to check for unsorted package.json files. Closes: hyperledger-cacti#2356 Signed-off-by: Tomasz Awramski <tomasz.awramski@fujitsu.com
- Remove not working check-package-json-sort.ts script. - Add ci action to check for unsorted package.json files. Closes: hyperledger-cacti#2356 Signed-off-by: Tomasz Awramski <tomasz.awramski@fujitsu.com
- Remove not working check-package-json-sort.ts script. - Add ci action to check for unsorted package.json files. Closes: hyperledger-cacti#2356 Signed-off-by: Tomasz Awramski <tomasz.awramski@fujitsu.com
- Remove not working check-package-json-sort.ts script. - Add ci action to check for unsorted package.json files. Peter's changes: 1. Changed the commit message in a way that it won't show up in the release notes among the bug fixes (the section that is meant for production bug-fixes not tooling bug-fixes) 2. Fixed typos in the .ts scripts 3. Applied the prettier/eslint formatting, deleted unused variables 4. Added a convenience script to the root package.json that runs the package.json sorter 5. Fixed the sorter script so that it appends a newline character after the sorted JSON string when writing back to the file. This is needed because when you run `yarn install` or `npm install` they both like to close the package.json file's with an empty line last so we have to mimic that in order to avoid spamming all future PRs with these line changes. One problem that this might still have is that on different operating systems the newline character might be different and it also depends on the git configuration in effect (you can configure Windows' git to use Unix line endings for example). So it's not trivial how to fix it but we'll cross that bridge when we get to it. Closes: hyperledger-cacti#2356 Co-authored-by: Peter Somogyvari <peter.somogyvari@accenture.com> Signed-off-by: Tomasz Awramski <tomasz.awramski@fujitsu.com Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
- Remove not working check-package-json-sort.ts script. - Add ci action to check for unsorted package.json files. Peter's changes: 1. Changed the commit message in a way that it won't show up in the release notes among the bug fixes (the section that is meant for production bug-fixes not tooling bug-fixes) 2. Fixed typos in the .ts scripts 3. Applied the prettier/eslint formatting, deleted unused variables 4. Added a convenience script to the root package.json that runs the package.json sorter 5. Fixed the sorter script so that it appends a newline character after the sorted JSON string when writing back to the file. This is needed because when you run `yarn install` or `npm install` they both like to close the package.json file's with an empty line last so we have to mimic that in order to avoid spamming all future PRs with these line changes. One problem that this might still have is that on different operating systems the newline character might be different and it also depends on the git configuration in effect (you can configure Windows' git to use Unix line endings for example). So it's not trivial how to fix it but we'll cross that bridge when we get to it. Closes: #2356 Co-authored-by: Peter Somogyvari <peter.somogyvari@accenture.com> Signed-off-by: Tomasz Awramski <tomasz.awramski@fujitsu.com Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
- Remove not working check-package-json-sort.ts script. - Add ci action to check for unsorted package.json files. Peter's changes: 1. Changed the commit message in a way that it won't show up in the release notes among the bug fixes (the section that is meant for production bug-fixes not tooling bug-fixes) 2. Fixed typos in the .ts scripts 3. Applied the prettier/eslint formatting, deleted unused variables 4. Added a convenience script to the root package.json that runs the package.json sorter 5. Fixed the sorter script so that it appends a newline character after the sorted JSON string when writing back to the file. This is needed because when you run `yarn install` or `npm install` they both like to close the package.json file's with an empty line last so we have to mimic that in order to avoid spamming all future PRs with these line changes. One problem that this might still have is that on different operating systems the newline character might be different and it also depends on the git configuration in effect (you can configure Windows' git to use Unix line endings for example). So it's not trivial how to fix it but we'll cross that bridge when we get to it. Closes: hyperledger-cacti#2356 Co-authored-by: Peter Somogyvari <peter.somogyvari@accenture.com> Signed-off-by: Tomasz Awramski <tomasz.awramski@fujitsu.com Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
Description
As a maintainer I want to have an automated CI job (that actually works) that checks for package.json files being sorted so that I don't have to manually be on the lookout for non-sorted dependencies and the like.
Previous attempt at making this happen: https://github.com/hyperledger/cacti/issues/1341
A related discussion I had with @outSH about this: https://github.com/hyperledger/cacti/pull/2310#discussion_r1152057132
Acceptance Criteria
The text was updated successfully, but these errors were encountered: