Skip to content

Commit f30b1ef

Browse files
authored
Merge pull request #123 from linearis-oss/bugfix/fix-consumer-install-120
fix: replace postinstall with prepare to fix consumer install
2 parents 21f42c6 + 2560fb5 commit f30b1ef

File tree

6 files changed

+82
-48
lines changed

6 files changed

+82
-48
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,28 @@ jobs:
7575

7676
- name: TypeScript type check
7777
run: npx tsc --noEmit
78+
79+
smoke-test:
80+
name: Smoke test package install
81+
runs-on: ubuntu-latest
82+
needs: [test]
83+
84+
steps:
85+
- name: Checkout code
86+
uses: actions/checkout@v6
87+
88+
- name: Setup Node.js
89+
uses: actions/setup-node@v6
90+
with:
91+
node-version: 22
92+
cache: "npm"
93+
94+
- name: Install deps
95+
run: npm ci
96+
97+
- name: Pack and install
98+
run: |
99+
npm pack
100+
npm install -g ./linearis-*.tgz
101+
linearis --help
102+
npm uninstall -g linearis

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
run: npm test
6161

6262
- name: Publish to npm
63-
run: npm publish --provenance --access public
63+
run: npx clean-publish --access public -- --provenance
6464
env:
6565
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6666

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ For human contributor guidelines, see [CONTRIBUTING.md](CONTRIBUTING.md).
2020
## Quick Commands
2121

2222
```bash
23-
npm install # install deps + codegen + lefthook
23+
npm install # install deps, codegen, and lefthook (via prepare hook)
2424
npm test # unit tests (vitest)
2525
npm run build # compile to dist/
2626
npm run generate # regenerate GraphQL types from .graphql files
@@ -71,6 +71,7 @@ CLI Input → Command → Resolver → Service → JSON Output
7171
8. **Never edit `src/gql/`** — it is generated by codegen.
7272
9. **`USAGE.md` is generated and git-ignored** — produced by `npm run generate:usage` during build, included in the npm package but not committed.
7373
10. **Production dependencies must be pinned** to exact versions (no `^` or `~`). Dev dependencies may use ranges.
74+
11. **No `postinstall` scripts.** Use `prepare` for dev setup hooks (codegen, lefthook). Consumer installs must never execute dev-only commands.
7475

7576
## Decision Tree: Adding Functionality
7677

CONTRIBUTING.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Requires **Node.js >= 22**.
2121
```bash
2222
git clone https://github.com/linearis-oss/linearis.git
2323
cd linearis
24-
npm install # Install deps + GraphQL codegen + lefthook
24+
npm install # Install deps, codegen, and lefthook (via prepare hook)
2525
npm start # Development mode (tsx, no compilation)
2626
npm test # Run tests
2727
npm run build # Compile to dist/
@@ -41,6 +41,16 @@ npm run build # Compile TypeScript (required before integration tests)
4141

4242
Integration tests (`tests/integration/`) require `LINEAR_API_TOKEN` in your environment. They are skipped automatically when the token is absent.
4343

44+
## Publishing
45+
46+
To publish a new version locally (maintainers only):
47+
48+
```bash
49+
npm run release # Runs tests, builds, and publishes via clean-publish
50+
```
51+
52+
In CI, publishing is handled automatically by the publish workflow when a version tag is pushed. The workflow uses `clean-publish` to strip dev artifacts (scripts, devDependencies, etc.) from the published package.
53+
4454
## Pull Requests
4555

4656
1. Fork the repo and create your branch from `main`

package-lock.json

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

package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
"lint:check": "biome lint .",
3131
"check": "biome check --write .",
3232
"check:ci": "biome check .",
33+
"release": "npm test && npm run build && npx clean-publish --access public",
3334
"prestart": "npm run generate",
3435
"predev": "npm run generate",
35-
"postinstall": "npm run generate && lefthook install",
3636
"prebuild": "npm run generate && npm run generate:usage",
37-
"prepare": "lefthook install",
37+
"prepare": "npm run generate && lefthook install",
3838
"prepack": "npm run build",
3939
"prepublishOnly": "npm test"
4040
},
@@ -76,6 +76,7 @@
7676
"@types/node": "^24.0.0",
7777
"@vitest/coverage-v8": "^4.0.0",
7878
"@vitest/ui": "^4.0.0",
79+
"clean-publish": "^6.0.5",
7980
"lefthook": "^2.1.0",
8081
"tsx": "^4.20.5",
8182
"typescript": "^6.0.0",
@@ -84,5 +85,11 @@
8485
"graphql": {
8586
"schema": "https://api.linear.app/graphql",
8687
"documents": "**/*.graphql"
88+
},
89+
"clean-publish": {
90+
"fields": [
91+
"scripts",
92+
"graphql"
93+
]
8794
}
8895
}

0 commit comments

Comments
 (0)