Skip to content

Commit 20669e5

Browse files
committed
chore: pre-shape repo into pnpm-workspace monorepo layout
Reshape the CLI repo into a pnpm workspace so it can be cleanly git-subtree-imported into the future getsentry/toolkit monorepo (#1238, part of #1248). Layout: - Move the CLI package into packages/cli/ (src, test, script, patches, plugins, install, configs, package.json). - Move docs/ into apps/cli-docs/. - Keep GitHub/Craft-read files at the repo root (.github/, .craft.yml, LICENSE, CHANGELOG, .gitignore, .nojekyll) so the repo stays fully operational (releases + nightlies) through and after the merge. - Add pnpm-workspace.yaml (packages/* + apps/*) and a thin delegating root package.json that forwards scripts to the sentry package and hoists the pnpm block (patchedDependencies now reference packages/cli/patches/**). - Add a minimal root README; the CLI README moves to packages/cli/. Internal path fixes: - Shared script/paths.ts (DOCS_ROOT etc.) for cross-package doc paths; generate/check scripts updated to use it. - Re-point apps/cli-docs public symlinks (install, skill files) to the new packages/cli/ locations. - build.ts / bundle.ts resolve @sentry/symbolic WASM via module resolution and invoke fossilize via `pnpm exec` (both hoist to the workspace root now). - biome.jsonc + packages/cli/.gitignore so Biome finds an ignore file. - .gitignore path-anchored entries updated to the nested layout. Workflows / release (kept root-relative where GitHub/Craft require it): - ci.yml, docs-preview.yml, eval-skill-fork.yml: paths-filter globs, node_modules cache paths, patches hashFiles glob, artifact paths (packages/cli/dist-bin, apps/cli-docs/dist), docs working-directory, package.json version reads, npm pack dir. - .craft.yml pre/post release commands cd into packages/cli. node-linker=isolated (was hoisted): under the workspace, hoisted mode let an unpatched transitive @sentry/core@10.65.0 (via @spotlightjs/spotlight -> @sentry/node) win the flat hoist over the patched direct @sentry/core@10.63.0, so the CLI bundled the unpatched copy (masked only by esbuild tree-shaking). isolated mode keeps per-package variants so the patched copy is used. check-patches.ts now reads patchedDependencies from the workspace root and resolves the package copy the CLI actually links via require.resolve. Verified: typecheck, lint, all check:* scripts, build (+ binary smoke, patched bundle), and the full unit suite (399 files, 8474 passed).
1 parent 48f5e63 commit 20669e5

1,106 files changed

Lines changed: 4633 additions & 6093 deletions

File tree

Some content is hidden

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

.craft.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ changelog:
33
policy: auto
44
versioning:
55
policy: auto
6-
preReleaseCommand: node --experimental-strip-types script/bump-version.ts --pre
7-
postReleaseCommand: node --experimental-strip-types script/bump-version.ts --post
6+
preReleaseCommand: bash -c 'cd packages/cli && node --experimental-strip-types script/bump-version.ts --pre'
7+
postReleaseCommand: bash -c 'cd packages/cli && node --experimental-strip-types script/bump-version.ts --post'
88
artifactProvider:
99
name: github
1010
config:

.github/workflows/ci.yml

Lines changed: 74 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,24 @@ jobs:
6060
with:
6161
filters: |
6262
skill:
63-
- 'src/**'
64-
- 'docs/**'
65-
- 'package.json'
66-
- 'README.md'
67-
- 'DEVELOPMENT.md'
68-
- 'script/generate-skill.ts'
69-
- 'script/generate-command-docs.ts'
70-
- 'script/generate-docs-sections.ts'
71-
- 'script/eval-skill.ts'
72-
- 'test/skill-eval/**'
63+
- 'packages/cli/src/**'
64+
- 'apps/cli-docs/**'
65+
- 'packages/cli/package.json'
66+
- 'packages/cli/README.md'
67+
- 'packages/cli/DEVELOPMENT.md'
68+
- 'packages/cli/script/generate-skill.ts'
69+
- 'packages/cli/script/generate-command-docs.ts'
70+
- 'packages/cli/script/generate-docs-sections.ts'
71+
- 'packages/cli/script/eval-skill.ts'
72+
- 'packages/cli/test/skill-eval/**'
7373
code:
74-
- 'src/**'
75-
- 'test/**'
76-
- 'script/**'
77-
- 'patches/**'
78-
- 'docs/**'
79-
- 'plugins/**'
80-
- 'package.json'
74+
- 'packages/cli/src/**'
75+
- 'packages/cli/test/**'
76+
- 'packages/cli/script/**'
77+
- 'packages/cli/patches/**'
78+
- 'apps/cli-docs/**'
79+
- 'packages/cli/plugins/**'
80+
- 'packages/cli/package.json'
8181
- 'pnpm-lock.yaml'
8282
- '.github/workflows/ci.yml'
8383
- name: Compute build matrix
@@ -109,7 +109,7 @@ jobs:
109109
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
110110
run: |
111111
TS=$(date -d "$COMMIT_TIMESTAMP" +%s)
112-
CURRENT=$(jq -r .version package.json)
112+
CURRENT=$(jq -r .version packages/cli/package.json)
113113
VERSION=$(echo "$CURRENT" | sed "s/-dev\.[0-9]*$/-dev.${TS}/")
114114
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
115115
echo "Nightly version: ${VERSION}"
@@ -143,8 +143,11 @@ jobs:
143143
- uses: actions/cache@v5
144144
id: cache
145145
with:
146-
path: node_modules
147-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
146+
path: |
147+
node_modules
148+
packages/*/node_modules
149+
apps/*/node_modules
150+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
148151
- if: steps.cache.outputs.cache-hit != 'true'
149152
run: pnpm install --frozen-lockfile
150153
- name: Generate API Schema
@@ -198,8 +201,11 @@ jobs:
198201
- uses: actions/cache@v5
199202
id: cache
200203
with:
201-
path: node_modules
202-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
204+
path: |
205+
node_modules
206+
packages/*/node_modules
207+
apps/*/node_modules
208+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
203209
- if: steps.cache.outputs.cache-hit != 'true'
204210
run: pnpm install --frozen-lockfile
205211
- run: pnpm run generate:schema
@@ -229,8 +235,11 @@ jobs:
229235
- uses: actions/cache@v5
230236
id: cache
231237
with:
232-
path: node_modules
233-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
238+
path: |
239+
node_modules
240+
packages/*/node_modules
241+
apps/*/node_modules
242+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
234243
- if: steps.cache.outputs.cache-hit != 'true'
235244
run: pnpm install --frozen-lockfile
236245
- name: Generate API Schema
@@ -264,8 +273,11 @@ jobs:
264273
- uses: actions/cache@v5
265274
id: cache
266275
with:
267-
path: node_modules
268-
key: node-modules-${{ matrix.os }}-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
276+
path: |
277+
node_modules
278+
packages/*/node_modules
279+
apps/*/node_modules
280+
key: node-modules-${{ matrix.os }}-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
269281
- name: Install dependencies
270282
if: steps.cache.outputs.cache-hit != 'true'
271283
shell: bash
@@ -311,8 +323,8 @@ jobs:
311323
if: needs.changes.outputs.nightly-version != ''
312324
shell: bash
313325
run: |
314-
jq --arg v "${{ needs.changes.outputs.nightly-version }}" '.version = $v' package.json > package.json.tmp
315-
mv package.json.tmp package.json
326+
jq --arg v "${{ needs.changes.outputs.nightly-version }}" '.version = $v' packages/cli/package.json > packages/cli/package.json.tmp
327+
mv packages/cli/package.json.tmp packages/cli/package.json
316328
- name: Build
317329
env:
318330
# Environment-scoped (production) — must be set at step level to
@@ -331,9 +343,9 @@ jobs:
331343
shell: bash
332344
run: |
333345
if [[ "${{ matrix.target }}" == "windows-x64" ]]; then
334-
./dist-bin/sentry-windows-x64.exe --help
346+
./packages/cli/dist-bin/sentry-windows-x64.exe --help
335347
else
336-
./dist-bin/sentry-${{ matrix.target }} --help
348+
./packages/cli/dist-bin/sentry-${{ matrix.target }} --help
337349
fi
338350
- name: Smoke test (deep — SQLite, telemetry, auth DB)
339351
if: matrix.can-test
@@ -343,9 +355,9 @@ jobs:
343355
SENTRY_TOKEN: ""
344356
run: |
345357
if [[ "${{ matrix.target }}" == "windows-x64" ]]; then
346-
BIN=./dist-bin/sentry-windows-x64.exe
358+
BIN=./packages/cli/dist-bin/sentry-windows-x64.exe
347359
else
348-
BIN=./dist-bin/sentry-${{ matrix.target }}
360+
BIN=./packages/cli/dist-bin/sentry-${{ matrix.target }}
349361
fi
350362
# auth status without a token exercises SQLite init, schema
351363
# migrations, telemetry lazy import, and the CJS require chain.
@@ -371,23 +383,23 @@ jobs:
371383
(github.ref_name == 'main' || startsWith(github.ref_name, 'release/'))
372384
shell: bash
373385
run: |
374-
BIN=./dist-bin/sentry-${{ matrix.target }}
386+
BIN=./packages/cli/dist-bin/sentry-${{ matrix.target }}
375387
echo "Verifying code signature on $BIN..."
376388
rcodesign verify "$BIN"
377389
- name: Upload binary artifact
378390
uses: actions/upload-artifact@v7
379391
with:
380392
name: sentry-${{ matrix.target }}
381393
path: |
382-
dist-bin/sentry-*
383-
!dist-bin/*.gz
394+
packages/cli/dist-bin/sentry-*
395+
!packages/cli/dist-bin/*.gz
384396
385397
- name: Upload compressed artifact
386398
if: github.event_name != 'pull_request'
387399
uses: actions/upload-artifact@v7
388400
with:
389401
name: sentry-${{ matrix.target }}-gz
390-
path: dist-bin/*.gz
402+
path: packages/cli/dist-bin/*.gz
391403

392404
generate-patches:
393405
name: Generate Delta Patches
@@ -728,8 +740,11 @@ jobs:
728740
- uses: actions/cache@v5
729741
id: cache
730742
with:
731-
path: node_modules
732-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
743+
path: |
744+
node_modules
745+
packages/*/node_modules
746+
apps/*/node_modules
747+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
733748
- if: steps.cache.outputs.cache-hit != 'true'
734749
run: pnpm install --frozen-lockfile
735750
- name: Download Linux binary
@@ -770,8 +785,11 @@ jobs:
770785
- uses: actions/cache@v5
771786
id: cache
772787
with:
773-
path: node_modules
774-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
788+
path: |
789+
node_modules
790+
packages/*/node_modules
791+
apps/*/node_modules
792+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
775793
- if: steps.cache.outputs.cache-hit != 'true'
776794
run: pnpm install --frozen-lockfile
777795
- name: Bundle
@@ -780,7 +798,7 @@ jobs:
780798
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
781799
run: pnpm run bundle
782800
- name: Smoke test (Node.js)
783-
run: node dist/bin.cjs --help
801+
run: node packages/cli/dist/bin.cjs --help
784802
- name: Smoke test (Node.js — deep)
785803
shell: bash
786804
env:
@@ -790,7 +808,7 @@ jobs:
790808
# auth status without a token exercises SQLite init, schema
791809
# migrations, telemetry lazy import, and the CJS require chain.
792810
# Expected: exit 10 (AUTH_NOT_AUTHENTICATED), NOT a crash/syntax error.
793-
OUTPUT=$(node dist/bin.cjs auth status 2>&1) && EXIT_CODE=$? || EXIT_CODE=$?
811+
OUTPUT=$(node packages/cli/dist/bin.cjs auth status 2>&1) && EXIT_CODE=$? || EXIT_CODE=$?
794812
if [[ $EXIT_CODE -ne 10 ]]; then
795813
echo "::error::Expected exit code 10 (not authenticated), got $EXIT_CODE"
796814
echo "$OUTPUT"
@@ -802,12 +820,13 @@ jobs:
802820
exit 1
803821
fi
804822
- run: npm pack
823+
working-directory: packages/cli
805824
- name: Upload artifact
806825
if: matrix.node == '22'
807826
uses: actions/upload-artifact@v7
808827
with:
809828
name: npm-package
810-
path: "*.tgz"
829+
path: "packages/cli/*.tgz"
811830

812831
build-docs:
813832
name: Build Docs
@@ -833,13 +852,16 @@ jobs:
833852
- uses: actions/cache@v5
834853
id: cache
835854
with:
836-
path: node_modules
837-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
855+
path: |
856+
node_modules
857+
packages/*/node_modules
858+
apps/*/node_modules
859+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
838860
- if: steps.cache.outputs.cache-hit != 'true'
839861
run: pnpm install --frozen-lockfile
840862
- name: Get CLI version
841863
id: version
842-
run: echo "version=$(node -p 'require("./package.json").version')" >> "$GITHUB_OUTPUT"
864+
run: echo "version=$(node -p 'require("./packages/cli/package.json").version')" >> "$GITHUB_OUTPUT"
843865
- name: Download compiled CLI binary
844866
uses: actions/download-artifact@v8
845867
with:
@@ -850,7 +872,7 @@ jobs:
850872
- name: Generate docs content
851873
run: pnpm run generate:schema && pnpm run generate:docs
852874
- name: Build Docs
853-
working-directory: docs
875+
working-directory: apps/cli-docs
854876
env:
855877
PUBLIC_SENTRY_ENVIRONMENT: production
856878
SENTRY_RELEASE: ${{ steps.version.outputs.version }}
@@ -867,18 +889,18 @@ jobs:
867889
SENTRY_ORG: sentry
868890
SENTRY_PROJECT: cli-website
869891
run: |
870-
./dist-bin/sentry-linux-x64 sourcemap inject docs/dist/
871-
./dist-bin/sentry-linux-x64 sourcemap upload docs/dist/ \
892+
./dist-bin/sentry-linux-x64 sourcemap inject apps/cli-docs/dist/
893+
./dist-bin/sentry-linux-x64 sourcemap upload apps/cli-docs/dist/ \
872894
--release "${{ steps.version.outputs.version }}" \
873895
--url-prefix "~/"
874896
# Remove .map files — they were uploaded to Sentry but shouldn't
875897
# be deployed to production.
876898
- name: Remove sourcemaps from output
877-
run: find docs/dist -name '*.map' -delete
899+
run: find apps/cli-docs/dist -name '*.map' -delete
878900
- name: Package Docs
879901
run: |
880-
cp .nojekyll docs/dist/
881-
cd docs/dist && zip -r ../../gh-pages.zip .
902+
cp .nojekyll apps/cli-docs/dist/
903+
cd apps/cli-docs/dist && zip -r "$GITHUB_WORKSPACE/gh-pages.zip" .
882904
- name: Upload docs artifact
883905
uses: actions/upload-artifact@v7
884906
with:

.github/workflows/docs-preview.yml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ on:
44
push:
55
branches: [main]
66
paths:
7-
- 'docs/**'
8-
- 'src/**'
9-
- 'script/generate-command-docs.ts'
10-
- 'script/generate-skill.ts'
11-
- 'install'
7+
- 'apps/cli-docs/**'
8+
- 'packages/cli/src/**'
9+
- 'packages/cli/script/generate-command-docs.ts'
10+
- 'packages/cli/script/generate-skill.ts'
11+
- 'packages/cli/install'
1212
- '.github/workflows/docs-preview.yml'
1313
pull_request:
1414
# No paths filter here: the 'closed' event must ALWAYS fire so
@@ -48,11 +48,11 @@ jobs:
4848
with:
4949
filters: |
5050
docs:
51-
- 'docs/**'
52-
- 'src/**'
53-
- 'script/generate-command-docs.ts'
54-
- 'script/generate-skill.ts'
55-
- 'install'
51+
- 'apps/cli-docs/**'
52+
- 'packages/cli/src/**'
53+
- 'packages/cli/script/generate-command-docs.ts'
54+
- 'packages/cli/script/generate-skill.ts'
55+
- 'packages/cli/install'
5656
- '.github/workflows/docs-preview.yml'
5757
5858
# Central gate. `build` = produce the site (push, or a docs PR being
@@ -93,24 +93,27 @@ jobs:
9393
id: cache
9494
if: steps.gate.outputs.build == 'true'
9595
with:
96-
path: node_modules
97-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
96+
path: |
97+
node_modules
98+
packages/*/node_modules
99+
apps/*/node_modules
100+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
98101

99102
- if: steps.gate.outputs.build == 'true' && steps.cache.outputs.cache-hit != 'true'
100103
run: pnpm install --frozen-lockfile
101104

102105
- name: Get CLI version
103106
id: version
104107
if: steps.gate.outputs.build == 'true'
105-
run: echo "version=$(node -p 'require("./package.json").version')" >> "$GITHUB_OUTPUT"
108+
run: echo "version=$(node -p 'require("./packages/cli/package.json").version')" >> "$GITHUB_OUTPUT"
106109

107110
- name: Generate docs content
108111
if: steps.gate.outputs.build == 'true'
109112
run: pnpm run generate:schema && pnpm run generate:docs
110113

111114
- name: Build Docs for Preview
112115
if: steps.gate.outputs.build == 'true'
113-
working-directory: docs
116+
working-directory: apps/cli-docs
114117
env:
115118
DOCS_BASE_PATH: ${{ github.event_name == 'push'
116119
&& '/_preview/pr-main'
@@ -129,15 +132,15 @@ jobs:
129132
SENTRY_ORG: sentry
130133
SENTRY_PROJECT: cli-website
131134
run: |
132-
pnpm run cli sourcemap inject docs/dist/
133-
pnpm run cli sourcemap upload docs/dist/ \
135+
pnpm run cli sourcemap inject "$GITHUB_WORKSPACE/apps/cli-docs/dist/"
136+
pnpm run cli sourcemap upload "$GITHUB_WORKSPACE/apps/cli-docs/dist/" \
134137
--release "${{ steps.version.outputs.version }}" \
135138
--url-prefix "~/"
136139
137140
# Remove .map files — uploaded to Sentry but shouldn't be deployed.
138141
- name: Remove sourcemaps from output
139142
if: steps.gate.outputs.build == 'true'
140-
run: find docs/dist -name '*.map' -delete
143+
run: find apps/cli-docs/dist -name '*.map' -delete
141144

142145
- name: Ensure .nojekyll at gh-pages root
143146
# Runs whenever we deploy (build or a 'closed' cleanup), but never for
@@ -180,7 +183,7 @@ jobs:
180183
if: steps.gate.outputs.deploy == 'true'
181184
uses: rossjrw/pr-preview-action@v1
182185
with:
183-
source-dir: docs/dist/
186+
source-dir: apps/cli-docs/dist/
184187
preview-branch: gh-pages
185188
umbrella-dir: _preview
186189
pages-base-url: cli.sentry.dev

0 commit comments

Comments
 (0)