Skip to content

Commit 30bba1f

Browse files
authored
chore(repo): Add yarn yalc:publish scripts (#7502)
Add a new yarn script to all SDK packages: `yalc:publish`. This script will publish locally built SDK packages to a local [yalc](https://github.com/wclr/yalc) repository which we can use as an alternative to `yarn link` for using our SDKs locally in test projects.
1 parent 4a6256e commit 30bba1f

File tree

25 files changed

+131
-24
lines changed

25 files changed

+131
-24
lines changed

CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ Since we are using [`TypeScript`](https://www.typescriptlang.org/), you need to
3333
- `yarn build:dev:filter <name of npm package>`, which runs `yarn build:dev` only in projects relevant to the given package (so, for example, running `yarn build:dev:filter @sentry/react` will build the `react` package, all of its dependencies (`utils`, `core`, `browser`, etc), and all packages which depend on it (currently `gatsby` and `nextjs`))
3434
- `yarn build:dev:watch`, which runs `yarn build:dev` in watch mode (recommended)
3535

36+
37+
## Testing SDK Packages Locally
38+
39+
To test local versions of SDK packages, for instance in test projects, you have a couple of options:
40+
41+
* Use [`yarn link`](https://classic.yarnpkg.com/lang/en/docs/cli/link/) to symlink your package to the test project.
42+
* Use [`yalc` to install SDK packages](./docs/using-yalc.md) as if they were already published.
43+
* Run `build:tarball` in the repo and `yarn add ./path/to/tarball.tgz` in the project.
44+
3645
## Adding Tests
3746

3847
**Any nontrivial fixes/features should include tests.** You'll find a `test` folder in each package.

docs/using-yalc.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Using `yalc` for Local SDK Testing
2+
3+
[Yalc](https://github.com/wclr/yalc) is a simple local dependency repository which we can use to work with local versions of our SDKs.
4+
This is a good alternative to `npm|yarn link` for packages where linking is problematic (e.g. SvelteKit or Angular).
5+
6+
Here's how to set up and use yalc:
7+
8+
## Installing `yalc`
9+
10+
Either install yalc globally,
11+
12+
```sh
13+
npm install -g yalc
14+
15+
yarn global add yalc
16+
```
17+
18+
or add it to your desired test projects (same command without the `-g|global` flags)
19+
20+
## Registering/Updating packages
21+
22+
Whenever you want to make your local changes available to your test projects (e.g. after a local code change), run:
23+
24+
```sh
25+
yarn yalc:publish
26+
```
27+
28+
If you run this command in the root of the repo, this will publish all SDK packages to the local yalc repo. If you run it in a specific SDK package, it will just publish this package. You **don't need to** call `yalc update` in your test project. Already linked test projects will be update automatically.
29+
30+
## Using yalc packages
31+
32+
In your test project, run
33+
34+
```sh
35+
yalc add @sentry/browser #or any other SDK package
36+
```
37+
38+
to add the local SDK package to your project.
39+
40+
**Important:** You need to `yalc add` the dependencies of the SDK package as well (e.g. core, utils, types, etc.).
41+
42+
## Troubleshooting:
43+
44+
### My changes are not applied to the test project
45+
46+
Did you run `yarn build && yarn publish:yalc` after making your changes?
47+
48+
### My test project uses Vite and I still don't see changes
49+
50+
Vite pre-bundles and caches dependencies for dev builds. It [doesn't recognize changes in yalc packages though](https://github.com/wclr/yalc/issues/189) :( To make these changes show up anyway, run `vite dev --force`.
51+

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"test:unit": "lerna run --ignore @sentry-internal/* test:unit",
2929
"test-ci-browser": "lerna run test --ignore \"@sentry/{node,opentelemetry-node,serverless,nextjs,remix,gatsby}\" --ignore @sentry-internal/*",
3030
"test-ci-node": "ts-node ./scripts/node-unit-tests.ts",
31-
"test:update-snapshots": "lerna run test:update-snapshots"
31+
"test:update-snapshots": "lerna run test:update-snapshots",
32+
"yalc:publish": "lerna run yalc:publish"
3233
},
3334
"volta": {
3435
"node": "16.19.0",
@@ -117,7 +118,8 @@
117118
"tslib": "^2.3.1",
118119
"typedoc": "^0.18.0",
119120
"typescript": "3.8.3",
120-
"vitest": "^0.29.2"
121+
"vitest": "^0.29.2",
122+
"yalc": "^1.0.0-pre.53"
121123
},
122124
"resolutions": {
123125
"**/agent-base": "5"

packages/angular-ivy/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
"fix:prettier": "prettier --write \"{src,test,scripts}/**/**.ts\"",
5757
"lint": "run-s lint:prettier lint:eslint",
5858
"lint:eslint": "eslint . --format stylish",
59-
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\""
59+
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
60+
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push"
6061
},
6162
"volta": {
6263
"extends": "../../package.json"

packages/angular/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@
5959
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
6060
"test": "yarn test:unit",
6161
"test:unit": "jest",
62-
"test:unit:watch": "jest --watch"
62+
"test:unit:watch": "jest --watch",
63+
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push"
6364
},
6465
"volta": {
6566
"extends": "../../package.json"

packages/browser/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@
7575
"test:integration:checkbrowsers": "node scripts/checkbrowsers.js",
7676
"test:package": "node test/package/npm-build.js && rm test/package/tmp.js",
7777
"test:unit:watch": "jest --watch",
78-
"test:integration:watch": "test/integration/run.js --watch"
78+
"test:integration:watch": "test/integration/run.js --watch",
79+
"yalc:publish": "ts-node ../../scripts/prepack.ts --bundles && yalc publish ./build/npm --push"
7980
},
8081
"volta": {
8182
"extends": "../../package.json"

packages/core/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
4141
"test": "jest",
4242
"test:watch": "jest --watch",
43-
"version": "node ../../scripts/versionbump.js src/version.ts"
43+
"version": "node ../../scripts/versionbump.js src/version.ts",
44+
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push"
4445
},
4546
"volta": {
4647
"extends": "../../package.json"

packages/gatsby/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
"lint:eslint": "eslint . --format stylish",
5757
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
5858
"test": "yarn ts-node scripts/pretest.ts && yarn jest",
59-
"test:watch": "yarn ts-node scripts/pretest.ts && yarn jest --watch"
59+
"test:watch": "yarn ts-node scripts/pretest.ts && yarn jest --watch",
60+
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push"
6061
},
6162
"volta": {
6263
"extends": "../../package.json"

packages/integrations/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
"lint:eslint": "eslint . --format stylish",
4646
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
4747
"test": "jest",
48-
"test:watch": "jest --watch"
48+
"test:watch": "jest --watch",
49+
"yalc:publish": "ts-node ../../scripts/prepack.ts --bundles && yalc publish ./build/npm --push"
4950
},
5051
"volta": {
5152
"extends": "../../package.json"

packages/nextjs/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@
7575
"test:types": "cd test/types && yarn test",
7676
"test:watch": "jest --watch",
7777
"vercel:branch": "source vercel/set-up-branch-for-test-app-use.sh",
78-
"vercel:project": "source vercel/make-project-use-current-branch.sh"
78+
"vercel:project": "source vercel/make-project-use-current-branch.sh",
79+
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push"
7980
},
8081
"volta": {
8182
"extends": "../../package.json"

packages/node/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
"test:jest": "jest",
5757
"test:release-health": "node test/manual/release-health/runner.js",
5858
"test:webpack": "cd test/manual/webpack-domain/ && yarn --silent && node npm-build.js",
59-
"test:watch": "jest --watch"
59+
"test:watch": "jest --watch",
60+
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push"
6061
},
6162
"volta": {
6263
"extends": "../../package.json"

packages/opentelemetry-node/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
5656
"test": "yarn test:jest",
5757
"test:jest": "jest",
58-
"test:watch": "jest --watch"
58+
"test:watch": "jest --watch",
59+
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push"
5960
},
6061
"volta": {
6162
"extends": "../../package.json"

packages/react/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@
6969
"lint:eslint": "eslint . --format stylish",
7070
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
7171
"test": "jest",
72-
"test:watch": "jest --watch"
72+
"test:watch": "jest --watch",
73+
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push"
7374
},
7475
"volta": {
7576
"extends": "../../package.json"

packages/remix/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@
7070
"test:integration:client:ci": "yarn test:integration:client --browser='all' --reporter='line'",
7171
"test:integration:server": "export NODE_OPTIONS='--stack-trace-limit=25' && jest --config=test/integration/jest.config.js test/integration/test/server/",
7272
"test:unit": "jest",
73-
"test:watch": "jest --watch"
73+
"test:watch": "jest --watch",
74+
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push"
7475
},
7576
"volta": {
7677
"extends": "../../package.json"

packages/replay/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"test": "jest",
3030
"test:watch": "jest --watch",
3131
"bootstrap:demo": "cd demo && yarn",
32-
"start:demo": "yarn build:dev && cd demo && yarn start"
32+
"start:demo": "yarn build:dev && cd demo && yarn start",
33+
"yalc:publish": "ts-node ../../scripts/prepack.ts --bundles && yalc publish ./build/npm --push"
3334
},
3435
"repository": {
3536
"type": "git",

packages/serverless/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
"lint:eslint": "eslint . --format stylish",
5858
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
5959
"test": "jest",
60-
"test:watch": "jest --watch"
60+
"test:watch": "jest --watch",
61+
"yalc:publish": "ts-node ../../scripts/prepack.ts --bundles && yalc publish ./build/npm --push"
6162
},
6263
"volta": {
6364
"extends": "../../package.json"

packages/svelte/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
"lint:eslint": "eslint . --format stylish",
5050
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
5151
"test": "jest",
52-
"test:watch": "jest --watch"
52+
"test:watch": "jest --watch",
53+
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push"
5354
},
5455
"volta": {
5556
"extends": "../../package.json"

packages/sveltekit/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
5353
"test": "yarn test:unit",
5454
"test:unit": "vitest run",
55-
"test:watch": "vitest --watch"
55+
"test:watch": "vitest --watch",
56+
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push"
5657
},
5758
"volta": {
5859
"extends": "../../package.json"

packages/tracing-internal/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
4545
"test:unit": "jest",
4646
"test": "jest",
47-
"test:watch": "jest --watch"
47+
"test:watch": "jest --watch",
48+
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push"
4849
},
4950
"volta": {
5051
"extends": "../../package.json"

packages/tracing/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
4949
"test:unit": "jest",
5050
"test": "jest",
51-
"test:watch": "jest --watch"
51+
"test:watch": "jest --watch",
52+
"yalc:publish": "ts-node ../../scripts/prepack.ts --bundles && yalc publish ./build/npm --push"
5253
},
5354
"volta": {
5455
"extends": "../../package.json"

packages/types/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
3232
"fix": "run-s fix:eslint fix:prettier",
3333
"fix:eslint": "eslint . --format stylish --fix",
34-
"fix:prettier": "prettier --write \"{src,test,scripts}/**/**.ts\""
34+
"fix:prettier": "prettier --write \"{src,test,scripts}/**/**.ts\"",
35+
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push"
3536
},
3637
"volta": {
3738
"extends": "../../package.json"

packages/utils/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
4646
"test": "jest",
4747
"test:watch": "jest --watch",
48-
"test:package": "node test/types/index.js"
48+
"test:package": "node test/types/index.js",
49+
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push"
4950
},
5051
"volta": {
5152
"extends": "../../package.json"

packages/vue/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
"lint:eslint": "eslint . --format stylish",
5050
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
5151
"test": "jest",
52-
"test:watch": "jest --watch"
52+
"test:watch": "jest --watch",
53+
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push"
5354
},
5455
"volta": {
5556
"extends": "../../package.json"

packages/wasm/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
"fix:prettier": "prettier --write \"{src,test,scripts}/**/**.ts\"",
4141
"lint": "run-s lint:prettier lint:eslint",
4242
"lint:eslint": "eslint . --format stylish",
43-
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\""
43+
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
44+
"yalc:publish": "ts-node ../../scripts/prepack.ts --bundles && yalc publish ./build/npm --push"
4445
},
4546
"volta": {
4647
"extends": "../../package.json"

yarn.lock

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15070,7 +15070,7 @@ [email protected]:
1507015070
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.6.tgz#f1c46a2a93a253e7b3905115e74d527cd23061a1"
1507115071
integrity sha512-IZUoxEjNjubzrmvzZU4lKP7OnYmX72XRl3sqkfJhBKweKi5rnGi5+IUdlj/H1M+Ip5JQ1WzaDMOBRY90Ajc5jg==
1507215072

15073-
15073+
[email protected], ini@^2.0.0:
1507415074
version "2.0.0"
1507515075
resolved "https://registry.yarnpkg.com/ini/-/ini-2.0.0.tgz#e5fd556ecdd5726be978fa1001862eacb0a94bc5"
1507615076
integrity sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==
@@ -19456,6 +19456,16 @@ npm-packlist@^2.1.4:
1945619456
npm-bundled "^1.1.1"
1945719457
npm-normalize-package-bin "^1.0.1"
1945819458

19459+
npm-packlist@^2.1.5:
19460+
version "2.2.2"
19461+
resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-2.2.2.tgz#076b97293fa620f632833186a7a8f65aaa6148c8"
19462+
integrity sha512-Jt01acDvJRhJGthnUJVF/w6gumWOZxO7IkpY/lsX9//zqQgnF7OJaxgQXcerd4uQOLu7W5bkb4mChL9mdfm+Zg==
19463+
dependencies:
19464+
glob "^7.1.6"
19465+
ignore-walk "^3.0.3"
19466+
npm-bundled "^1.1.1"
19467+
npm-normalize-package-bin "^1.0.1"
19468+
1945919469
npm-packlist@^3.0.0:
1946019470
version "3.0.0"
1946119471
resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-3.0.0.tgz#0370df5cfc2fcc8f79b8f42b37798dd9ee32c2a9"
@@ -27798,6 +27808,20 @@ y18n@^5.0.5:
2779827808
resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55"
2779927809
integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==
2780027810

27811+
yalc@^1.0.0-pre.53:
27812+
version "1.0.0-pre.53"
27813+
resolved "https://registry.yarnpkg.com/yalc/-/yalc-1.0.0-pre.53.tgz#c51db2bb924a6908f4cb7e82af78f7e5606810bc"
27814+
integrity sha512-tpNqBCpTXplnduzw5XC+FF8zNJ9L/UXmvQyyQj7NKrDNavbJtHvzmZplL5ES/RCnjX7JR7W9wz5GVDXVP3dHUQ==
27815+
dependencies:
27816+
chalk "^4.1.0"
27817+
detect-indent "^6.0.0"
27818+
fs-extra "^8.0.1"
27819+
glob "^7.1.4"
27820+
ignore "^5.0.4"
27821+
ini "^2.0.0"
27822+
npm-packlist "^2.1.5"
27823+
yargs "^16.1.1"
27824+
2780127825
yallist@^3.0.0, yallist@^3.0.2, yallist@^3.1.1:
2780227826
version "3.1.1"
2780327827
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd"

0 commit comments

Comments
 (0)