Skip to content

Commit 6aa3aa3

Browse files
build: publish the attw CLI as a self-contained binary (#10)
* build: bundle the attw CLI into a self-contained bin-only package The published CLI declared five runtime dependencies and externalized them, so installing it pulled the analyzer, effect, and a compiler into the consumer's tree, and the analyzer ran whatever TypeScript the host hoisted. Inline every dependency into the single dist/main.mjs entry, drop the library entry for AttwHandler that nothing outside the package imports, and move the former runtime dependencies to devDependencies. deps.onlyImport fails the build if a bare import survives, so the manifest cannot drift from the bundle; the inlined TypeScript is the analyzer's own pinned 6.0.3. The published manifest now exposes only bin. Verified by packing, installing the tarball in an empty project (npm adds exactly one package, then the bin link resolves), and running attw --pack on an ESM-only fixture from the installed binary * build: stop building the CLI bundle during install `prepare` ran tsdown on every `pnpm install`, before any package was built. The bundle inlines the analyzer, so on a fresh clone the analyzer's dist/ did not exist yet, rolldown left it external, and the onlyImport gate failed the install with "@systemfsoftware/arethetypeswrong is imported in main.mjs but is not included in deps.onlyImport option" — the Commitlint workflow's `pnpm install --frozen-lockfile` broke on it. turbo already orders this: every task that needs dist depends on `^build`, so `pnpm build` builds the analyzer before the CLI. Install no longer builds, and the bundle is produced by the task graph that knows the order * docs: remove the install note added to the CLI README The note was added alongside the bundling change without being part of it. The package page describes what the CLI does; what changed about its packaging belongs to the release note
1 parent 05349db commit 6aa3aa3

4 files changed

Lines changed: 27 additions & 31 deletions

File tree

‎.changeset/twenty-vans-prove.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@systemfsoftware/arethetypeswrong-cli": minor
3+
---
4+
5+
The package now ships a single self-contained `attw` executable and declares no runtime dependencies, so installing the CLI no longer adds its dependency tree to your project. The command, its flags, and its output are unchanged.

‎packages/arethetypeswrong-cli/package.json‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
},
2323
"scripts": {
2424
"build": "tsdown",
25-
"prepare": "tsdown",
2625
"clean": "rimraf dist",
2726
"typecheck": "tsc --noEmit --incremental",
2827
"attw": "node ./dist/main.mjs --pack .",
@@ -32,24 +31,22 @@
3231
"prepack": "pnpm build"
3332
},
3433
"type": "module",
35-
"dependencies": {
34+
"devDependencies": {
3635
"@effect/platform-node": "catalog:",
3736
"@effect/platform-node-shared": "catalog:",
38-
"@systemfsoftware/arethetypeswrong": "workspace:*",
39-
"@systemfsoftware/npm-package": "catalog:",
40-
"effect": "catalog:"
41-
},
42-
"devDependencies": {
4337
"@effect/vitest": "catalog:",
4438
"@systemfsoftware/all": "catalog:",
39+
"@systemfsoftware/arethetypeswrong": "workspace:*",
4540
"@systemfsoftware/arethetypeswrong-recipes": "workspace:*",
4641
"@systemfsoftware/effect-gherkin-spec": "catalog:",
4742
"@systemfsoftware/effect-schema-law": "catalog:",
4843
"@systemfsoftware/effect-schema-vite": "catalog:",
44+
"@systemfsoftware/npm-package": "catalog:",
4945
"@systemfsoftware/oxlint-plugin-effect-dmmf": "catalog:",
5046
"@systemfsoftware/tsconfig": "catalog:",
5147
"@types/node": "catalog:",
5248
"@vitest/coverage-v8": "catalog:",
49+
"effect": "catalog:",
5350
"fast-check": "catalog:",
5451
"oxlint": "catalog:",
5552
"rimraf": "catalog:",
Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
import { defineConfig } from 'tsdown'
22

33
export default defineConfig({
4-
entry: [
5-
'src/main.ts',
6-
'src/AttwHandler.ts',
7-
],
4+
entry: ['src/main.ts'],
85
format: 'esm',
96
clean: true,
10-
dts: true,
11-
outExtensions: () => ({ js: '.mjs', dts: '.d.ts' }),
7+
platform: 'node',
8+
shims: true,
9+
dts: false,
10+
outExtensions: () => ({ js: '.mjs' }),
1211
tsconfig: './tsconfig.build.json',
1312
deps: {
14-
neverBundle: [
15-
'@systemfsoftware/arethetypeswrong',
16-
'@systemfsoftware/npm-package',
17-
'effect',
18-
'@effect/cli',
19-
'@effect/printer',
20-
],
13+
alwaysBundle: [/./],
14+
onlyImport: [/^node:/],
15+
onlyBundle: false,
2116
},
2217
})

‎pnpm-lock.yaml‎

Lines changed: 10 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)