Skip to content

Commit 91a1ac7

Browse files
committed
Merge remote-tracking branch 'upstream/main' into timfish/test/integration-next
2 parents 60ddcf3 + bdc5345 commit 91a1ac7

File tree

7 files changed

+573
-4865
lines changed

7 files changed

+573
-4865
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ yarn-error.log
77
*.tgz
88

99
.nxcache
10+
.nx
1011
packages/**/yarn.lock
1112

1213
.DS_Store

lerna.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

nx.json

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,25 @@
11
{
22
"$schema": "./node_modules/nx/schemas/nx-schema.json",
3-
"tasksRunnerOptions": {
4-
"default": {
5-
"runner": "nx/tasks-runners/default",
6-
"options": {
7-
"cacheableOperations": ["build", "lint", "test"],
8-
"cacheDirectory": ".nxcache"
9-
}
10-
}
11-
},
123
"namedInputs": {
134
"sharedGlobals": ["{workspaceRoot}/*.js", "{workspaceRoot}/*.json", "{workspaceRoot}/yarn.lock"]
145
},
156
"targetDefaults": {
167
"build": {
178
"inputs": ["sharedGlobals"],
189
"dependsOn": ["^build"],
19-
"outputs": ["{projectRoot}/dist"]
10+
"outputs": ["{projectRoot}/dist"],
11+
"cache": true
2012
},
2113
"lint": {
2214
"inputs": ["sharedGlobals"],
2315
"dependsOn": ["^build", "build"],
24-
"outputs": []
16+
"outputs": [],
17+
"cache": true
2518
},
2619
"test": {
2720
"inputs": ["sharedGlobals"],
28-
"outputs": []
21+
"outputs": [],
22+
"cache": true
2923
},
3024
"check:types": {
3125
"inputs": ["sharedGlobals"],
@@ -35,5 +29,9 @@
3529
"build:npm": {
3630
"dependsOn": ["build", "^build"]
3731
}
32+
},
33+
"cacheDirectory": ".nxcache",
34+
"tui": {
35+
"autoExit": true
3836
}
3937
}

package.json

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,19 @@
66
"homepage": "https://github.com/getsentry/sentry-javascript-bundler-plugins",
77
"private": true,
88
"workspaces": [
9-
"packages/*",
10-
"packages/integration-tests-next/fixtures/*"
9+
"packages/babel-plugin-component-annotate",
10+
"packages/bundler-plugin-core",
11+
"packages/dev-utils",
12+
"packages/e2e-tests",
13+
"packages/esbuild-plugin",
14+
"packages/eslint-configs",
15+
"packages/integration-tests",
16+
"packages/playground",
17+
"packages/rollup-plugin",
18+
"packages/tsconfigs",
19+
"packages/vite-plugin",
20+
"packages/webpack-plugin",
21+
"packages/integration-tests-next/fixtures/rolldown"
1122
],
1223
"scripts": {
1324
"build": "nx run-many --target=build --all",
@@ -28,14 +39,10 @@
2839
"fix:formatting": "oxfmt ."
2940
},
3041
"devDependencies": {
31-
"@nrwl/cli": "14.5.10",
32-
"@nrwl/workspace": "14.5.10",
33-
"lerna": "^6.6.2",
3442
"minimatch": "^10.2.2",
3543
"npm-run-all": "^4.1.5",
36-
"nx": "14.5.10",
44+
"nx": "22.5.2",
3745
"oxfmt": "^0.33.0",
38-
"pretty-quick": "^3.1.3",
3946
"ts-node": "^10.9.2"
4047
},
4148
"volta": {

scripts/bump-version.js

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
const fs = require("fs");
2+
const path = require("path");
3+
4+
function readJson(filePath) {
5+
return JSON.parse(fs.readFileSync(filePath, "utf-8"));
6+
}
7+
8+
/**
9+
* Bumps the version of all workspace packages and their internal dependencies.
10+
* This replicates the behavior of:
11+
* lerna version --force-publish --exact --no-git-tag-version --no-push --include-merged-tags --yes <newVersion>
12+
*
13+
* Specifically:
14+
* - Updates `version` in every workspace package.json to newVersion
15+
* - Updates all internal workspace dependency references (dependencies, devDependencies, peerDependencies)
16+
* to the new exact version (no ^ or ~ prefix), matching lerna's --exact flag
17+
* - --force-publish: all packages are updated regardless of whether they changed
18+
* - No git tags, commits, or pushes are made
19+
*/
20+
function bumpVersions(rootDir, newVersion) {
21+
const rootPkgPath = path.join(rootDir, "package.json");
22+
const rootPkg = JSON.parse(fs.readFileSync(rootPkgPath, "utf-8"));
23+
const workspaces = rootPkg.workspaces;
24+
25+
if (!workspaces || !Array.isArray(workspaces)) {
26+
throw new Error("Could not find workspaces in root package.json");
27+
}
28+
29+
// Read all workspace package.json files upfront.
30+
// This ensures we fail early if any workspace is unreadable,
31+
// before writing any changes (no partial updates).
32+
const workspacePackages = [];
33+
const workspaceNames = new Set();
34+
for (const workspace of workspaces) {
35+
const pkgPath = path.join(rootDir, workspace, "package.json");
36+
const pkg = readJson(pkgPath);
37+
workspaceNames.add(pkg.name);
38+
workspacePackages.push({ pkgPath, pkg });
39+
}
40+
41+
// Apply version bumps
42+
for (const { pkgPath, pkg } of workspacePackages) {
43+
pkg.version = newVersion;
44+
45+
// Update internal workspace dependency versions (exact, no ^)
46+
// This covers dependencies, devDependencies, and peerDependencies
47+
for (const depType of ["dependencies", "devDependencies", "peerDependencies"]) {
48+
if (!pkg[depType]) {
49+
continue;
50+
}
51+
52+
for (const [dep, ver] of Object.entries(pkg[depType])) {
53+
// Update all workspace dependencies to the new exact version,
54+
// matching lerna's --force-publish --exact behavior
55+
if (workspaceNames.has(dep) && !ver.startsWith("workspace:")) {
56+
pkg[depType][dep] = newVersion;
57+
}
58+
}
59+
}
60+
61+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
62+
}
63+
64+
return workspacePackages.length;
65+
}
66+
67+
// CLI entry point
68+
if (require.main === module) {
69+
const newVersion = process.argv[2];
70+
71+
if (!newVersion) {
72+
console.error("Usage: node scripts/bump-version.js <new-version>");
73+
process.exit(1);
74+
}
75+
76+
const rootDir = path.join(__dirname, "..");
77+
const updatedCount = bumpVersions(rootDir, newVersion);
78+
79+
// Write a .version file used by the gitflow sync workflow to detect version bumps
80+
const versionFile = {
81+
_comment:
82+
"Auto-generated by scripts/bump-version.js. Used by the gitflow sync workflow to detect version bumps. Do not edit manually.",
83+
version: newVersion,
84+
};
85+
fs.writeFileSync(
86+
path.join(rootDir, ".version.json"),
87+
JSON.stringify(versionFile, null, 2) + "\n"
88+
);
89+
90+
console.log(`Updated ${updatedCount} packages to version ${newVersion}`);
91+
}
92+
93+
module.exports = { bumpVersions };

scripts/craft-pre-release.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,5 @@ NEW_VERSION="${2}"
1111
export npm_config_git_tag_version=false
1212

1313
yarn install --frozen-lockfile
14-
# --force-publish - force publish all packages, this will skip the lerna changed check for changed packages and forces a package that didn't have a git diff change to be updated.
15-
# --exact - specify updated dependencies in updated packages exactly (with no punctuation), instead of as semver compatible (with a ^).
16-
# --no-git-tag-version - don't commit changes to package.json files and don't tag the release.
17-
# --no-push - don't push committed and tagged changes.
18-
# --include-merged-tags - include tags from merged branches when detecting changed packages.
19-
# --yes - skip all confirmation prompts
20-
yarn lerna version --force-publish --exact --no-git-tag-version --no-push --include-merged-tags --yes "${NEW_VERSION}"
14+
# Bump version in all workspace packages (exact versions, no git tags or commits)
15+
node scripts/bump-version.js "${NEW_VERSION}"

0 commit comments

Comments
 (0)