Skip to content

Commit 938d42b

Browse files
authored
fix: publish packages with Yarn (#168)
## Summary I tried to download the v4.7.0 in kibana and I received this error ```javascript error Couldn't find package "@elastic/pretty-printer@workspace:^" required by "@elastic/[email protected]" on the "npm" registry. ``` I found this issue to be similar changesets/changesets#1454  so internally changeset use npm (probabily also pnpn) but not yarn and  you can't resolve the workspace I change the way to publish the package using yarn. Note about` --topology` `@elastic/esq`l depends on `@elastic/pretty-printer`, so it publishes @elastic/pretty-printer first, then `@elastic/esql`. I did a test with a local registry (Verdaccio)
1 parent c16958d commit 938d42b

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

‎.changeset/tangy-oranges-itch.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@elastic/esql': patch
3+
'@elastic/pretty-printer': patch
4+
---
5+
6+
Fix package publishing through Yarn workspaces.

‎docs/RELEASE.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Review this PR, then merge it when you are ready to release.
4040

4141
When the version PR is merged, the Changesets action runs again on `main`. This time there are no pending changesets, so instead of opening a PR it publishes every package to NPM `yarn changeset:publish`.
4242

43+
The `changeset:publish` script delegates to `yarn workspaces foreach --all --no-private --topological npm publish --access public`.
44+
4345
Each package declares `"publishConfig": { "provenance": true }` in its `package.json`. Changesets publishes via `yarn npm publish` under Yarn Berry, which reads that field and attaches [npm provenance](https://docs.npmjs.com/generating-provenance-statements) — linking the npm artifact to the specific GitHub Actions run that built it (verifiable via `npm audit signatures`). This requires `id-token: write` on the release job, which is already set.
4446

4547
A GitHub Release is created automatically by the action for each published package.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"build:antlr4:promql": "yarn workspace @elastic/esql build:antlr4:promql",
2323
"changeset": "changeset",
2424
"changeset:version": "changeset version",
25-
"changeset:publish": "changeset publish"
25+
"changeset:publish": "yarn workspaces foreach --all --no-private --topological npm publish --access public"
2626
},
2727
"devDependencies": {
2828
"@babel/core": "8.0.1",

0 commit comments

Comments
 (0)