Skip to content

Commit e11da2e

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 9fa96f6 commit e11da2e

1,107 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
@@ -61,24 +61,24 @@ jobs:
6161
with:
6262
filters: |
6363
skill:
64-
- 'src/**'
65-
- 'docs/**'
66-
- 'package.json'
67-
- 'README.md'
68-
- 'DEVELOPMENT.md'
69-
- 'script/generate-skill.ts'
70-
- 'script/generate-command-docs.ts'
71-
- 'script/generate-docs-sections.ts'
72-
- 'script/eval-skill.ts'
73-
- 'test/skill-eval/**'
64+
- 'packages/cli/src/**'
65+
- 'apps/cli-docs/**'
66+
- 'packages/cli/package.json'
67+
- 'packages/cli/README.md'
68+
- 'packages/cli/DEVELOPMENT.md'
69+
- 'packages/cli/script/generate-skill.ts'
70+
- 'packages/cli/script/generate-command-docs.ts'
71+
- 'packages/cli/script/generate-docs-sections.ts'
72+
- 'packages/cli/script/eval-skill.ts'
73+
- 'packages/cli/test/skill-eval/**'
7474
code:
75-
- 'src/**'
76-
- 'test/**'
77-
- 'script/**'
78-
- 'patches/**'
79-
- 'docs/**'
80-
- 'plugins/**'
81-
- 'package.json'
75+
- 'packages/cli/src/**'
76+
- 'packages/cli/test/**'
77+
- 'packages/cli/script/**'
78+
- 'packages/cli/patches/**'
79+
- 'apps/cli-docs/**'
80+
- 'packages/cli/plugins/**'
81+
- 'packages/cli/package.json'
8282
- 'pnpm-lock.yaml'
8383
- '.github/workflows/ci.yml'
8484
codemod:
@@ -113,7 +113,7 @@ jobs:
113113
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
114114
run: |
115115
TS=$(date -d "$COMMIT_TIMESTAMP" +%s)
116-
CURRENT=$(jq -r .version package.json)
116+
CURRENT=$(jq -r .version packages/cli/package.json)
117117
VERSION=$(echo "$CURRENT" | sed "s/-dev\.[0-9]*$/-dev.${TS}/")
118118
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
119119
echo "Nightly version: ${VERSION}"
@@ -163,8 +163,11 @@ jobs:
163163
- uses: actions/cache@v5
164164
id: cache
165165
with:
166-
path: node_modules
167-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
166+
path: |
167+
node_modules
168+
packages/*/node_modules
169+
apps/*/node_modules
170+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
168171
- if: steps.cache.outputs.cache-hit != 'true'
169172
run: pnpm install --frozen-lockfile
170173
- name: Generate API Schema
@@ -218,8 +221,11 @@ jobs:
218221
- uses: actions/cache@v5
219222
id: cache
220223
with:
221-
path: node_modules
222-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
224+
path: |
225+
node_modules
226+
packages/*/node_modules
227+
apps/*/node_modules
228+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
223229
- if: steps.cache.outputs.cache-hit != 'true'
224230
run: pnpm install --frozen-lockfile
225231
- run: pnpm run generate:schema
@@ -249,8 +255,11 @@ jobs:
249255
- uses: actions/cache@v5
250256
id: cache
251257
with:
252-
path: node_modules
253-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
258+
path: |
259+
node_modules
260+
packages/*/node_modules
261+
apps/*/node_modules
262+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
254263
- if: steps.cache.outputs.cache-hit != 'true'
255264
run: pnpm install --frozen-lockfile
256265
- name: Generate API Schema
@@ -284,8 +293,11 @@ jobs:
284293
- uses: actions/cache@v5
285294
id: cache
286295
with:
287-
path: node_modules
288-
key: node-modules-${{ matrix.os }}-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
296+
path: |
297+
node_modules
298+
packages/*/node_modules
299+
apps/*/node_modules
300+
key: node-modules-${{ matrix.os }}-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
289301
- name: Install dependencies
290302
if: steps.cache.outputs.cache-hit != 'true'
291303
shell: bash
@@ -331,8 +343,8 @@ jobs:
331343
if: needs.changes.outputs.nightly-version != ''
332344
shell: bash
333345
run: |
334-
jq --arg v "${{ needs.changes.outputs.nightly-version }}" '.version = $v' package.json > package.json.tmp
335-
mv package.json.tmp package.json
346+
jq --arg v "${{ needs.changes.outputs.nightly-version }}" '.version = $v' packages/cli/package.json > packages/cli/package.json.tmp
347+
mv packages/cli/package.json.tmp packages/cli/package.json
336348
- name: Build
337349
env:
338350
# Environment-scoped (production) — must be set at step level to
@@ -351,9 +363,9 @@ jobs:
351363
shell: bash
352364
run: |
353365
if [[ "${{ matrix.target }}" == "windows-x64" ]]; then
354-
./dist-bin/sentry-windows-x64.exe --help
366+
./packages/cli/dist-bin/sentry-windows-x64.exe --help
355367
else
356-
./dist-bin/sentry-${{ matrix.target }} --help
368+
./packages/cli/dist-bin/sentry-${{ matrix.target }} --help
357369
fi
358370
- name: Smoke test (deep — SQLite, telemetry, auth DB)
359371
if: matrix.can-test
@@ -363,9 +375,9 @@ jobs:
363375
SENTRY_TOKEN: ""
364376
run: |
365377
if [[ "${{ matrix.target }}" == "windows-x64" ]]; then
366-
BIN=./dist-bin/sentry-windows-x64.exe
378+
BIN=./packages/cli/dist-bin/sentry-windows-x64.exe
367379
else
368-
BIN=./dist-bin/sentry-${{ matrix.target }}
380+
BIN=./packages/cli/dist-bin/sentry-${{ matrix.target }}
369381
fi
370382
# auth status without a token exercises SQLite init, schema
371383
# migrations, telemetry lazy import, and the CJS require chain.
@@ -391,23 +403,23 @@ jobs:
391403
(github.ref_name == 'main' || startsWith(github.ref_name, 'release/'))
392404
shell: bash
393405
run: |
394-
BIN=./dist-bin/sentry-${{ matrix.target }}
406+
BIN=./packages/cli/dist-bin/sentry-${{ matrix.target }}
395407
echo "Verifying code signature on $BIN..."
396408
rcodesign verify "$BIN"
397409
- name: Upload binary artifact
398410
uses: actions/upload-artifact@v7
399411
with:
400412
name: sentry-${{ matrix.target }}
401413
path: |
402-
dist-bin/sentry-*
403-
!dist-bin/*.gz
414+
packages/cli/dist-bin/sentry-*
415+
!packages/cli/dist-bin/*.gz
404416
405417
- name: Upload compressed artifact
406418
if: github.event_name != 'pull_request'
407419
uses: actions/upload-artifact@v7
408420
with:
409421
name: sentry-${{ matrix.target }}-gz
410-
path: dist-bin/*.gz
422+
path: packages/cli/dist-bin/*.gz
411423

412424
generate-patches:
413425
name: Generate Delta Patches
@@ -748,8 +760,11 @@ jobs:
748760
- uses: actions/cache@v5
749761
id: cache
750762
with:
751-
path: node_modules
752-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
763+
path: |
764+
node_modules
765+
packages/*/node_modules
766+
apps/*/node_modules
767+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
753768
- if: steps.cache.outputs.cache-hit != 'true'
754769
run: pnpm install --frozen-lockfile
755770
- name: Download Linux binary
@@ -790,8 +805,11 @@ jobs:
790805
- uses: actions/cache@v5
791806
id: cache
792807
with:
793-
path: node_modules
794-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
808+
path: |
809+
node_modules
810+
packages/*/node_modules
811+
apps/*/node_modules
812+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
795813
- if: steps.cache.outputs.cache-hit != 'true'
796814
run: pnpm install --frozen-lockfile
797815
- name: Bundle
@@ -800,7 +818,7 @@ jobs:
800818
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
801819
run: pnpm run bundle
802820
- name: Smoke test (Node.js)
803-
run: node dist/bin.cjs --help
821+
run: node packages/cli/dist/bin.cjs --help
804822
- name: Smoke test (Node.js — deep)
805823
shell: bash
806824
env:
@@ -810,7 +828,7 @@ jobs:
810828
# auth status without a token exercises SQLite init, schema
811829
# migrations, telemetry lazy import, and the CJS require chain.
812830
# Expected: exit 10 (AUTH_NOT_AUTHENTICATED), NOT a crash/syntax error.
813-
OUTPUT=$(node dist/bin.cjs auth status 2>&1) && EXIT_CODE=$? || EXIT_CODE=$?
831+
OUTPUT=$(node packages/cli/dist/bin.cjs auth status 2>&1) && EXIT_CODE=$? || EXIT_CODE=$?
814832
if [[ $EXIT_CODE -ne 10 ]]; then
815833
echo "::error::Expected exit code 10 (not authenticated), got $EXIT_CODE"
816834
echo "$OUTPUT"
@@ -822,12 +840,13 @@ jobs:
822840
exit 1
823841
fi
824842
- run: npm pack
843+
working-directory: packages/cli
825844
- name: Upload artifact
826845
if: matrix.node == '22'
827846
uses: actions/upload-artifact@v7
828847
with:
829848
name: npm-package
830-
path: "*.tgz"
849+
path: "packages/cli/*.tgz"
831850

832851
build-docs:
833852
name: Build Docs
@@ -853,13 +872,16 @@ jobs:
853872
- uses: actions/cache@v5
854873
id: cache
855874
with:
856-
path: node_modules
857-
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'patches/**') }}
875+
path: |
876+
node_modules
877+
packages/*/node_modules
878+
apps/*/node_modules
879+
key: node-modules-${{ hashFiles('pnpm-lock.yaml', '.npmrc', 'packages/cli/patches/**') }}
858880
- if: steps.cache.outputs.cache-hit != 'true'
859881
run: pnpm install --frozen-lockfile
860882
- name: Get CLI version
861883
id: version
862-
run: echo "version=$(node -p 'require("./package.json").version')" >> "$GITHUB_OUTPUT"
884+
run: echo "version=$(node -p 'require("./packages/cli/package.json").version')" >> "$GITHUB_OUTPUT"
863885
- name: Download compiled CLI binary
864886
uses: actions/download-artifact@v8
865887
with:
@@ -870,7 +892,7 @@ jobs:
870892
- name: Generate docs content
871893
run: pnpm run generate:schema && pnpm run generate:docs
872894
- name: Build Docs
873-
working-directory: docs
895+
working-directory: apps/cli-docs
874896
env:
875897
PUBLIC_SENTRY_ENVIRONMENT: production
876898
SENTRY_RELEASE: ${{ steps.version.outputs.version }}
@@ -887,18 +909,18 @@ jobs:
887909
SENTRY_ORG: sentry
888910
SENTRY_PROJECT: cli-website
889911
run: |
890-
./dist-bin/sentry-linux-x64 sourcemap inject docs/dist/
891-
./dist-bin/sentry-linux-x64 sourcemap upload docs/dist/ \
912+
./dist-bin/sentry-linux-x64 sourcemap inject apps/cli-docs/dist/
913+
./dist-bin/sentry-linux-x64 sourcemap upload apps/cli-docs/dist/ \
892914
--release "${{ steps.version.outputs.version }}" \
893915
--url-prefix "~/"
894916
# Remove .map files — they were uploaded to Sentry but shouldn't
895917
# be deployed to production.
896918
- name: Remove sourcemaps from output
897-
run: find docs/dist -name '*.map' -delete
919+
run: find apps/cli-docs/dist -name '*.map' -delete
898920
- name: Package Docs
899921
run: |
900-
cp .nojekyll docs/dist/
901-
cd docs/dist && zip -r ../../gh-pages.zip .
922+
cp .nojekyll apps/cli-docs/dist/
923+
cd apps/cli-docs/dist && zip -r "$GITHUB_WORKSPACE/gh-pages.zip" .
902924
- name: Upload docs artifact
903925
uses: actions/upload-artifact@v7
904926
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)