Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
with:
node-version: ${{ matrix.node }}
cache: npm
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.3.11

- name: Install dependencies
run: npm ci
Expand All @@ -39,5 +42,8 @@ jobs:
- name: Build
run: npm run build

- name: Build self-contained bundle
run: npm run bundle

- name: Test
run: npm test
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ jobs:
with:
node-version: 24
cache: 'npm'
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.3.11

- name: Install Dependencies
run: npm ci

- name: Build project
run: npm run build

# No explicit build steps: `npm publish` runs prepublishOnly,
# which builds the project and the self-contained bundle.
- name: Determine npm tag
id: npm-tag
env:
Expand Down
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
"bin": {
"workos-migrate": "dist/index.js"
},
"exports": {
".": "./dist/index.js",
"./bundle": {
"types": "./dist/cli/index.d.ts",
"default": "./dist/bundle.js"
},
"./dist/*": "./dist/*",
"./package.json": "./package.json"
},
Comment on lines +10 to +18

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 exports field newly restricts subpath access; verify no consumer uses an uncovered path

Adding an exports map (package.json:10-15) changes the package from unrestricted deep-import access to an allow-list. The current CLI that compiles @workos/migrations in at build time, and any other consumer, will now only be able to resolve ., ./bundle, ./dist/*, and ./package.json. Imports covered by the description (e.g. @workos/migrations/dist/cli/index.js) resolve via ./dist/*, and root imports via .. This is likely fine, but since this is an externally-consumed package, it is worth confirming no downstream consumer imports a path outside ./dist/ (e.g. a bare src/... or non-dist file) that would now break.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

"files": [
"dist/**/*",
"README.md",
Expand All @@ -15,6 +24,7 @@
],
"scripts": {
"build": "tsc",
"bundle": "bun build src/cli/index.ts --outfile dist/bundle.js --target=bun --format=esm --banner='// Bun-only bundle: built with --target=bun for the WorkOS CLI; not supported on Node.js.' && bun build src/workers/worker.ts --outfile dist/worker.js --target=bun --format=esm --banner='// Bun-only bundle: built with --target=bun for the WorkOS CLI; not supported on Node.js.'",
"start": "node dist/index.js",
"dev": "tsx src/index.ts",
"lint": "eslint \"src/**/*.ts\"",
Expand All @@ -23,7 +33,7 @@
"format:check": "prettier --check \"src/**/*.ts\" \"*.md\" \"*.json\"",
"typecheck": "tsc --noEmit",
"test": "node --experimental-vm-modules node_modules/.bin/jest",
"prepublishOnly": "npm run build"
"prepublishOnly": "npm run build && npm run bundle"
},
"keywords": [
"workos",
Expand Down