Skip to content

Commit 2a7c22b

Browse files
authored
feat(build): Drop prepack step & directly pack /build directory (#12656)
This is mostly an internal change, but it does change the layout of the published package, which shouldn't affect users, unless they depend on non-public things (which nobody should!). With this change, we will simply pack the packages as-is without moving any folder relativity. This means we do not need a `prepack` step anymore. Instead, we define which files should be included in the tarball via `files` in the `package.json`. <img width="497" alt="image" src="https://github.com/getsentry/sentry-javascript/assets/2411343/39aeba01-eff2-41b3-afc2-6e437a23be96"> Fixes #12642 There are some tiny fluctuations in the comparison table but as far as I can tell nothing serious/bad.
1 parent 24dbf1c commit 2a7c22b

File tree

48 files changed

+166
-444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+166
-444
lines changed

docs/new-sdk-release-checklist.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,18 @@ differ slightly for other SDKs depending on how they are structured and how they
2929

3030
- [ ] Make sure that the tarball (`yarn build:tarball`) has all the necessary contents
3131

32-
For basic SDKs, this means that the tarball has at least these files:
32+
For basic SDKs, this means that the tarball has at least these files - you can configure what is included in the
33+
tarball via the `files` field in `package.json`:
3334

34-
- [ ] `cjs/<entrypoint>.js`
35-
- [ ] `esm/<entrypoint>.js`
36-
- [ ] `types/<entrypoint.d.ts>`
35+
- [ ] `build/cjs/<entrypoint>.js` (or `build/npm/cjs/<entrypoint>.js`)
36+
- [ ] `build/esm/<entrypoint>.js` (or `build/npm/esm/<entrypoint>.js`)
37+
- [ ] `build/types/<entrypoint.d.ts>` (or `build/npm/types/<entrypoint>.js`)
3738
- [ ] `package.json`
3839
- [ ] Entry points registered in this file match the file structure above
3940
- [ ] `LICENSE`
4041
- [ ] `README.md`
41-
- [ ] If your tarball should contain additional files outside `esm`, `cjs`, and `types` that are not listed above
42-
(e.g. like Gatsby or Remix), be sure to add a package-specific `prepack.ts` script. In this script, you can copy
43-
these additional files and make other adjustments.\
44-
Check out the
45-
[Gatsby script](https://github.com/getsentry/sentry-javascript/blob/acd7fbb56ed1859ce48f06a76143075108631c25/packages/gatsby/scripts/prepack.ts#L1)
46-
as an example.\
47-
It’s recommended to build and pack a tarball and then `yarn add path/to/tarball.tar.gz` it to your test app(s)
42+
- [ ] Any additional files that should be part of the tarball
43+
- [ ] It’s recommended to build and pack a tarball and then `yarn add path/to/tarball.tar.gz` it to your test app(s)
4844
to ensure that it has all the correct files.
4945

5046
- [ ] Make sure `build.yml` CI script is correctly set up to cover tests for the new package

packages/angular/ng-package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
"entryFile": "src/index.ts"
66
},
77
"allowedNonPeerDependencies": ["@sentry/browser", "@sentry/core", "@sentry/utils", "@sentry/types", "tslib"],
8-
"assets": ["README.md", "LICENSE"]
8+
"assets": []
99
}

packages/angular/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"test": "yarn test:unit",
5858
"test:unit": "vitest run",
5959
"test:unit:watch": "vitest --watch",
60-
"yalc:publish": "yalc publish build --push --sig"
60+
"yalc:publish": "yalc publish --push --sig"
6161
},
6262
"volta": {
6363
"extends": "../../package.json"
@@ -73,8 +73,8 @@
7373
"outputs": [
7474
"{projectRoot}/build/esm2015",
7575
"{projectRoot}/build/fesm2015",
76-
"{projectRoot}/build/*.{md,json}",
77-
"{projectRoot}/build/LICENCE"
76+
"{projectRoot}/build/fesm2020",
77+
"{projectRoot}/build/*.d.ts"
7878
]
7979
}
8080
}

packages/astro/package.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@
1818
},
1919
"type": "module",
2020
"files": [
21-
"cjs",
22-
"esm",
23-
"types",
24-
"types-ts3.8",
25-
"import-hook.mjs",
26-
"loader-hook.mjs"
21+
"/build"
2722
],
2823
"main": "build/cjs/index.client.js",
2924
"module": "build/esm/index.server.js",
@@ -81,15 +76,15 @@
8176
"build:dev:watch": "yarn build:watch",
8277
"build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch",
8378
"build:types:watch": "tsc -p tsconfig.types.json --watch",
84-
"build:tarball": "ts-node ../../scripts/prepack.ts && npm pack ./build",
79+
"build:tarball": "npm pack",
8580
"circularDepCheck": "madge --circular src/index.client.ts && madge --circular src/index.server.ts && madge --circular src/index.types.ts",
8681
"clean": "rimraf build coverage sentry-astro-*.tgz",
8782
"fix": "eslint . --format stylish --fix",
8883
"lint": "eslint . --format stylish",
8984
"test": "yarn test:unit",
9085
"test:unit": "vitest run",
9186
"test:watch": "vitest --watch",
92-
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push --sig"
87+
"yalc:publish": "yalc publish --push --sig"
9388
},
9489
"volta": {
9590
"extends": "../../package.json"

packages/aws-serverless/package.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@
1010
"node": ">=14.18"
1111
},
1212
"files": [
13-
"cjs",
14-
"esm",
15-
"types",
16-
"types-ts3.8",
17-
"import-hook.mjs",
18-
"loader-hook.mjs"
13+
"/build/npm",
14+
"/build/import-hook.mjs",
15+
"/build/loader-hook.mjs"
1916
],
2017
"main": "build/npm/cjs/index.js",
2118
"types": "build/npm/types/index.d.ts",
@@ -88,14 +85,14 @@
8885
"build:dev:watch": "yarn build:watch",
8986
"build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch",
9087
"build:types:watch": "tsc -p tsconfig.types.json --watch",
91-
"build:tarball": "ts-node ../../scripts/prepack.ts --bundles && npm pack ./build/npm",
88+
"build:tarball": "npm pack",
9289
"circularDepCheck": "madge --circular src/index.ts",
9390
"clean": "rimraf build dist-awslambda-layer coverage sentry-serverless-*.tgz",
9491
"fix": "eslint . --format stylish --fix",
9592
"lint": "eslint . --format stylish",
9693
"test": "jest",
9794
"test:watch": "jest --watch",
98-
"yalc:publish": "ts-node ../../scripts/prepack.ts --bundles && yalc publish ./build/npm --push --sig"
95+
"yalc:publish": "yalc publish --push --sig"
9996
},
10097
"volta": {
10198
"extends": "../../package.json"

packages/browser-utils/package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
"node": ">=14.18"
1111
},
1212
"files": [
13-
"cjs",
14-
"esm",
15-
"types",
16-
"types-ts3.8"
13+
"/build"
1714
],
1815
"main": "build/cjs/index.js",
1916
"module": "build/esm/index.js",
@@ -57,14 +54,14 @@
5754
"build:dev:watch": "run-p build:transpile:watch build:types:watch",
5855
"build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch",
5956
"build:types:watch": "tsc -p tsconfig.types.json --watch",
60-
"build:tarball": "ts-node ../../scripts/prepack.ts && npm pack ./build",
57+
"build:tarball": "npm pack",
6158
"clean": "rimraf build coverage sentry-internal-browser-utils-*.tgz",
6259
"fix": "eslint . --format stylish --fix",
6360
"lint": "eslint . --format stylish",
6461
"test:unit": "jest",
6562
"test": "jest",
6663
"test:watch": "jest --watch",
67-
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push --sig"
64+
"yalc:publish": "yalc publish --push --sig"
6865
},
6966
"volta": {
7067
"extends": "../../package.json"

packages/browser/package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
"node": ">=14.18"
1111
},
1212
"files": [
13-
"cjs",
14-
"esm",
15-
"types",
16-
"types-ts3.8"
13+
"/build/npm"
1714
],
1815
"main": "build/npm/cjs/index.js",
1916
"module": "build/npm/esm/index.js",
@@ -68,7 +65,7 @@
6865
"build:bundle:watch": "rollup -c rollup.bundle.config.mjs --watch",
6966
"build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch",
7067
"build:types:watch": "tsc -p tsconfig.types.json --watch",
71-
"build:tarball": "ts-node ../../scripts/prepack.ts --bundles && npm pack ./build/npm",
68+
"build:tarball": "npm pack",
7269
"circularDepCheck": "madge --circular src/index.ts",
7370
"clean": "rimraf build coverage .rpt2_cache sentry-browser-*.tgz",
7471
"fix": "eslint . --format stylish --fix",
@@ -78,7 +75,7 @@
7875
"test:unit": "jest",
7976
"test:package": "node test/package/npm-build.js && rm test/package/tmp.js",
8077
"test:unit:watch": "jest --watch",
81-
"yalc:publish": "ts-node ../../scripts/prepack.ts --bundles && yalc publish ./build/npm --push --sig"
78+
"yalc:publish": "yalc publish --push --sig"
8279
},
8380
"volta": {
8481
"extends": "../../package.json"

packages/bun/package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
"node": ">=14.18"
1111
},
1212
"files": [
13-
"cjs",
14-
"esm",
15-
"types",
16-
"types-ts3.8"
13+
"/build"
1714
],
1815
"main": "build/cjs/index.js",
1916
"module": "build/esm/index.js",
@@ -62,7 +59,7 @@
6259
"build:dev:watch": "yarn build:watch",
6360
"build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch",
6461
"build:types:watch": "tsc -p tsconfig.types.json --watch",
65-
"build:tarball": "ts-node ../../scripts/prepack.ts && npm pack ./build",
62+
"build:tarball": "npm pack",
6663
"circularDepCheck": "madge --circular src/index.ts",
6764
"clean": "rimraf build coverage sentry-bun-*.tgz",
6865
"fix": "eslint . --format stylish --fix",
@@ -71,7 +68,7 @@
7168
"test": "run-s install:bun test:bun",
7269
"test:bun": "bun test",
7370
"test:watch": "bun test --watch",
74-
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push --sig"
71+
"yalc:publish": "yalc publish --push --sig"
7572
},
7673
"volta": {
7774
"extends": "../../package.json"

packages/core/package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
"node": ">=14.18"
1111
},
1212
"files": [
13-
"cjs",
14-
"esm",
15-
"types",
16-
"types-ts3.8"
13+
"/build"
1714
],
1815
"main": "build/cjs/index.js",
1916
"module": "build/esm/index.js",
@@ -56,14 +53,14 @@
5653
"build:dev:watch": "yarn build:watch",
5754
"build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch",
5855
"build:types:watch": "tsc -p tsconfig.types.json --watch",
59-
"build:tarball": "ts-node ../../scripts/prepack.ts && npm pack ./build",
56+
"build:tarball": "npm pack",
6057
"circularDepCheck": "madge --circular src/index.ts",
6158
"clean": "rimraf build coverage sentry-core-*.tgz",
6259
"fix": "eslint . --format stylish --fix",
6360
"lint": "eslint . --format stylish",
6461
"test": "jest",
6562
"test:watch": "jest --watch",
66-
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push --sig"
63+
"yalc:publish": "yalc publish --push --sig"
6764
},
6865
"volta": {
6966
"extends": "../../package.json"

packages/deno/package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
"access": "public"
2222
},
2323
"files": [
24-
"index.mjs",
25-
"index.mjs.map",
26-
"index.d.ts"
24+
"/build"
2725
],
2826
"dependencies": {
2927
"@sentry/core": "8.12.0",
@@ -43,7 +41,7 @@
4341
"build:types": "run-s deno-types build:types:tsc build:types:bundle",
4442
"build:types:tsc": "tsc -p tsconfig.types.json",
4543
"build:types:bundle": "rollup -c rollup.types.config.mjs",
46-
"build:tarball": "ts-node ../../scripts/prepack.ts && npm pack ./build",
44+
"build:tarball": "npm pack",
4745
"circularDepCheck": "madge --circular src/index.ts",
4846
"clean": "rimraf build build-types build-test coverage",
4947
"prefix": "yarn deno-types",
@@ -57,7 +55,7 @@
5755
"test:types": "deno check ./build/index.mjs",
5856
"test:unit": "deno test --allow-read --allow-run",
5957
"test:unit:update": "deno test --allow-read --allow-write --allow-run -- --update",
60-
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push --sig"
58+
"yalc:publish": "yalc publish --push --sig"
6159
},
6260
"volta": {
6361
"extends": "../../package.json"

packages/eslint-config-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"node": ">=14.18"
1616
},
1717
"files": [
18-
"src"
18+
"/src"
1919
],
2020
"main": "src/index.js",
2121
"publishConfig": {

packages/eslint-plugin-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"node": ">=14.18"
1616
},
1717
"files": [
18-
"src"
18+
"/src"
1919
],
2020
"main": "src/index.js",
2121
"publishConfig": {

packages/feedback/package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
"node": ">=14.18"
1111
},
1212
"files": [
13-
"cjs",
14-
"esm",
15-
"types",
16-
"types-ts3.8"
13+
"/build/npm"
1714
],
1815
"main": "build/npm/cjs/index.js",
1916
"module": "build/npm/esm/index.js",
@@ -62,14 +59,14 @@
6259
"build:transpile:watch": "yarn build:transpile --watch",
6360
"build:bundle:watch": "yarn build:bundle --watch",
6461
"build:types:watch": "tsc -p tsconfig.types.json --watch",
65-
"build:tarball": "ts-node ../../scripts/prepack.ts --bundles && npm pack ./build/npm",
62+
"build:tarball": "npm pack",
6663
"circularDepCheck": "madge --circular src/index.ts",
6764
"clean": "rimraf build sentry-internal-feedback-*.tgz",
6865
"fix": "eslint . --format stylish --fix",
6966
"lint": "eslint . --format stylish",
7067
"test": "jest",
7168
"test:watch": "jest --watch",
72-
"yalc:publish": "ts-node ../../scripts/prepack.ts --bundles && yalc publish ./build/npm --push --sig"
69+
"yalc:publish": "yalc publish --push --sig"
7370
},
7471
"volta": {
7572
"extends": "../../package.json"

packages/gatsby/package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
"node": ">=14.18"
1515
},
1616
"files": [
17-
"cjs",
18-
"esm",
19-
"types",
20-
"types-ts3.8",
17+
"/build",
2118
"gatsby-node.js",
2219
"gatsby-node.d.ts"
2320
],
@@ -75,14 +72,14 @@
7572
"build:dev:watch": "yarn build:watch",
7673
"build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch",
7774
"build:types:watch": "tsc -p tsconfig.types.json --watch",
78-
"build:tarball": "ts-node ../../scripts/prepack.ts && npm pack ./build",
75+
"build:tarball": "npm pack",
7976
"circularDepCheck": "madge --circular src/index.ts",
8077
"clean": "rimraf build coverage *.d.ts sentry-gatsby-*.tgz",
8178
"fix": "eslint . --format stylish --fix",
8279
"lint": "eslint . --format stylish",
8380
"test": "yarn ts-node scripts/pretest.ts && yarn jest",
8481
"test:watch": "yarn ts-node scripts/pretest.ts && yarn jest --watch",
85-
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push --sig"
82+
"yalc:publish": "yalc publish --push --sig"
8683
},
8784
"volta": {
8885
"extends": "../../package.json"

packages/gatsby/scripts/prepack.ts

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

0 commit comments

Comments
 (0)