-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
chore(ci): Move monorepo to nx #19325
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
Open
chargome
wants to merge
16
commits into
develop
Choose a base branch
from
cg/lerna-bye
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+740
−1,778
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
100b47d
WIP
chargome b2a6c5f
Merge branch 'develop' into cg/lerna-bye
chargome abb61f3
update commands
chargome 0ceab17
fix file race condition
chargome ab8f7cb
add bump version test commands
chargome c646f25
auto-exit TUI
chargome 9415afb
Merge remote-tracking branch 'origin/develop' into cg/lerna-bye
chargome e8a9f34
fmt
chargome 6fdc170
optimize yarn lock check
chargome 31d3561
rm altogether
chargome 1923f8e
move lockfile checks to a new job
chargome c5a2b89
fix dedupe
chargome 44a9023
create version detection file
chargome c83d7df
fmt
chargome 8ef6313
make job required
chargome e3256fc
throw on partial updates
chargome 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
Some comments aren't visible on the classic Files Changed page.
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
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 |
|---|---|---|
|
|
@@ -24,7 +24,6 @@ packages/*/sentry-*.tgz | |
| # logs | ||
| yarn-error.log | ||
| npm-debug.log | ||
| lerna-debug.log | ||
| local.log | ||
|
|
||
| # ide | ||
|
|
||
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,4 @@ | ||
| { | ||
| "_comment": "Auto-generated by scripts/bump-version.js. Used by the gitflow sync workflow to detect version bumps. Do not edit manually.", | ||
| "version": "10.39.0" | ||
| } |
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
This file was deleted.
Oops, something went wrong.
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
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,90 @@ | ||
| const fs = require('fs'); | ||
| const path = require('path'); | ||
|
|
||
| function readJson(filePath) { | ||
| return JSON.parse(fs.readFileSync(filePath, 'utf-8')); | ||
| } | ||
|
|
||
| /** | ||
| * Bumps the version of all workspace packages and their internal dependencies. | ||
| * This replicates the behavior of: | ||
| * lerna version --force-publish --exact --no-git-tag-version --no-push --include-merged-tags --yes <newVersion> | ||
| * | ||
| * Specifically: | ||
| * - Updates `version` in every workspace package.json to newVersion | ||
| * - Updates all internal workspace dependency references (dependencies, devDependencies, peerDependencies) | ||
| * to the new exact version (no ^ or ~ prefix), matching lerna's --exact flag | ||
| * - --force-publish: all packages are updated regardless of whether they changed | ||
| * - No git tags, commits, or pushes are made | ||
| */ | ||
| function bumpVersions(rootDir, newVersion) { | ||
| const rootPkgPath = path.join(rootDir, 'package.json'); | ||
| const rootPkg = JSON.parse(fs.readFileSync(rootPkgPath, 'utf-8')); | ||
| const workspaces = rootPkg.workspaces; | ||
|
|
||
| if (!workspaces || !Array.isArray(workspaces)) { | ||
| throw new Error('Could not find workspaces in root package.json'); | ||
| } | ||
|
|
||
| // Read all workspace package.json files upfront. | ||
| // This ensures we fail early if any workspace is unreadable, | ||
| // before writing any changes (no partial updates). | ||
| const workspacePackages = []; | ||
| const workspaceNames = new Set(); | ||
| for (const workspace of workspaces) { | ||
| const pkgPath = path.join(rootDir, workspace, 'package.json'); | ||
| const pkg = readJson(pkgPath); | ||
| workspaceNames.add(pkg.name); | ||
| workspacePackages.push({ pkgPath, pkg }); | ||
| } | ||
|
|
||
| // Apply version bumps | ||
| for (const { pkgPath, pkg } of workspacePackages) { | ||
| pkg.version = newVersion; | ||
|
|
||
| // Update internal workspace dependency versions (exact, no ^) | ||
| // This covers dependencies, devDependencies, and peerDependencies | ||
| for (const depType of ['dependencies', 'devDependencies', 'peerDependencies']) { | ||
| if (!pkg[depType]) { | ||
| continue; | ||
| } | ||
|
|
||
| for (const [dep, ver] of Object.entries(pkg[depType])) { | ||
| // Update all workspace dependencies to the new exact version, | ||
| // matching lerna's --force-publish --exact behavior | ||
| if (workspaceNames.has(dep) && !ver.startsWith('workspace:')) { | ||
| pkg[depType][dep] = newVersion; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n'); | ||
| } | ||
|
|
||
| return workspacePackages.length; | ||
| } | ||
|
|
||
| // CLI entry point | ||
| if (require.main === module) { | ||
| const newVersion = process.argv[2]; | ||
|
|
||
| if (!newVersion) { | ||
| console.error('Usage: node scripts/bump-version.js <new-version>'); | ||
| process.exit(1); | ||
| } | ||
|
|
||
| const rootDir = path.join(__dirname, '..'); | ||
| const updatedCount = bumpVersions(rootDir, newVersion); | ||
|
|
||
| // Write a .version file used by the gitflow sync workflow to detect version bumps | ||
| const versionFile = { | ||
| _comment: | ||
| 'Auto-generated by scripts/bump-version.js. Used by the gitflow sync workflow to detect version bumps. Do not edit manually.', | ||
| version: newVersion, | ||
| }; | ||
| fs.writeFileSync(path.join(rootDir, '.version.json'), JSON.stringify(versionFile, null, 2) + '\n'); | ||
|
|
||
| console.log(`Updated ${updatedCount} packages to version ${newVersion}`); | ||
| } | ||
|
|
||
| module.exports = { bumpVersions }; |
Oops, something went wrong.
Oops, something went wrong.
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.