rushstack
rushstack copied to clipboard
[rush-lib] components package.json JSON format validation & version adherence to semver validation
Summary
This PR seeks to solve 2 issues:
- rush repo components' package.json version not in semver format fails when listed as a dependency with
workspace:*in another project - https://github.com/microsoft/rushstack/issues/2678 - when running
rush updateand there are parsing errors in a component's package.json, pnpm does not provide stderr/stdio feedback - only exit code 1, which is not descriptive to the user. Therush updateerror message isERROR: Error: The command failed with exit code 1
Details
- The component version is manually checked for being in semver format after
package.jsonis loaded. - Package.json parsing of rush repos' subprojects' validates strict JSON format - no comments, syntactically correct.
How it was tested
-
building a project containing 2 components A and B, where A imports B's
workspace:*version. 2 tests cases:- B's package.json version is set to
1.0(new error message shown, graceful exit) - B's package.json version is set to
1.0.0(runs ok, graceful exit)
- B's package.json version is set to
-
building a project where a component's
package.jsonis malformed JSON - with comments or extra/missing commas. -
[x] 👉 STEP 7: Don't forget to run "rush change": https://rushjs.io/pages/best_practices/change_logs/
- when running
rush updateand there are parsing errors in a component's package.json, pnpm does not provide stderr/stdio feedback - only exit code 1, which is not descriptive to the user. Therush updateerror message isERROR: Error: The command failed with exit code 1
🥳 yes, let's finally fix this! 🙏
Your new API can also fix this issue: https://github.com/microsoft/rushstack/issues/996
Legal sign-off is pending.
On Mon, Aug 1, 2022 at 16:46 Pete Gonzalez @.***> wrote:
@.**** commented on this pull request.
In libraries/rush-lib/src/api/RushConfigurationProject.ts https://github.com/microsoft/rushstack/pull/3560#discussion_r934998049:
@@ -106,7 +106,7 @@ export class RushConfigurationProject { const packageJsonFilename: string = path.join(this._projectFolder, FileConstants.PackageJson);
try {
this._packageJson = JsonFile.load(packageJsonFilename);
this._packageJson = JsonFile.load(packageJsonFilename, true);We need you to sign the CLA in order to get this PR merged.
— Reply to this email directly, view it on GitHub https://github.com/microsoft/rushstack/pull/3560#discussion_r934998049, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ3OSFS45SQQU42MRWWY4ZTVXBOV7ANCNFSM546YMWDA . You are receiving this because you were mentioned.Message ID: @.***>
@octogonz Legal has cleared the CLA - good to go.
@1000RR if you're good with these changes, could you promote this to a non-draft PR?
@octogonz Looks like it's ready to go.
@octogonz may I ask for a final review and merge?
@octogonz may I ask for a final review and merge?
Thanks for the reminder. And thanks for your patience -- things have been very busy lately. 😄