-
Notifications
You must be signed in to change notification settings - Fork 307
fix: detect shrinkwrap siblings by workspace, not @bitgo/ prefix #9422
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
Merged
+174
−29
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /** | ||
| * Toggles `private` on modules/bitgo/package.json so the release workflow can hold | ||
| * the `bitgo` umbrella package out of a `lerna publish` pass without permanently | ||
| * marking it private in the repo. | ||
| * | ||
| * Why a scripted toggle instead of lerna's `--include-private <names>` (which lets | ||
| * a named private package publish "by temporarily removing the private property | ||
| * from the package manifest" on its own): that would require `bitgo` to be | ||
| * permanently `private: true` in the committed manifest, and three separate checks | ||
| * in the release pipeline enumerate non-private packages to verify they exist/were | ||
| * published — a permanently-private bitgo would silently stop being covered by all | ||
| * three: | ||
| * - the pre-publish existence check (trusted publishing depends on it) | ||
| * - recovery verification | ||
| * - beta verification / recovery auto-retry | ||
| * | ||
| * Flipping the flag off, running pass 1 (siblings only — bitgo is skipped because | ||
| * lerna filters private packages before packing), then flipping it back on before | ||
| * pass 2 (bitgo only) keeps every one of those checks seeing a normal, publishable | ||
| * package by the time they run. Callers MUST run the "restore" invocation (`true`) | ||
| * under `always()` in the workflow so a failed or cancelled pass 1 cannot leave the | ||
| * manifest flipped — this script does not track or restore state on its own, it | ||
| * just sets the field to whatever you tell it. | ||
| * | ||
| * Usage: | ||
| * npx tsx scripts/set-umbrella-publishable.ts false # hold back for pass 1 | ||
| * npx tsx scripts/set-umbrella-publishable.ts true # restore for pass 2 | ||
| */ | ||
|
|
||
| import fs from 'fs'; | ||
| import path from 'path'; | ||
|
|
||
| const bitgoPackageJsonPath = path.resolve(__dirname, '..', 'modules', 'bitgo', 'package.json'); | ||
|
|
||
| function parseArg(argv: string[]): boolean { | ||
| const raw = argv[2]; | ||
| if (raw === 'true') return true; | ||
| if (raw === 'false') return false; | ||
| throw new Error(`Expected a single argument "true" or "false", got: ${JSON.stringify(raw)}`); | ||
| } | ||
|
|
||
| function main(): void { | ||
| const publishable = parseArg(process.argv); | ||
| const original = fs.readFileSync(bitgoPackageJsonPath, 'utf-8'); | ||
| const pkg = JSON.parse(original); | ||
|
|
||
| if (publishable) { | ||
| delete pkg.private; | ||
| } else { | ||
| pkg.private = true; | ||
| } | ||
|
|
||
| fs.writeFileSync(bitgoPackageJsonPath, JSON.stringify(pkg, null, 2) + '\n'); | ||
| console.log( | ||
| publishable | ||
| ? `Restored modules/bitgo/package.json to publishable (removed "private").` | ||
| : `Marked modules/bitgo/package.json as private — it will be skipped by the next lerna publish pass.` | ||
| ); | ||
| } | ||
|
|
||
| main(); |
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.
Uh oh!
There was an error while loading. Please reload this page.