-
Notifications
You must be signed in to change notification settings - Fork 9
chore(docs): Add specific information about postinstall scripts for PNPM #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(docs): Add specific information about postinstall scripts for PNPM #98
Conversation
WalkthroughThe README has been updated to clarify installation instructions for language packages, specifically addressing changes in PNPM v10 regarding postinstall scripts. The guide now explains the need to allowlist postinstall scripts in PNPM v10+, corrects the tree-sitter CLI package name, and adds minor punctuation for clarity. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
README.md (1)
20-20
: Typo: “Explictly” → “Explicitly”-# PNPM v10 and above: Explictly allow the postinstall script to run for this language package +# PNPM v10 and above: Explicitly allow the postinstall script to run for this language package
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
README.md
(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: HerringtonDarkholme
PR: ast-grep/langs#73
File: packages/yaml/package.json:13-20
Timestamp: 2025-04-22T18:00:42.287Z
Learning: In ast-grep language packages, type.d.ts is a generated file that should be included in the package.json files array even though it's not directly committed to the repository.
Learnt from: pelikhan
PR: ast-grep/langs#38
File: packages/python/package.json:22-22
Timestamp: 2025-03-27T03:50:42.436Z
Learning: Most packages in the ast-grep/langs repository use an empty author field in package.json files. Don't assume authorship information without clear evidence from the repository.
README.md (6)
Learnt from: HerringtonDarkholme
PR: #73
File: packages/yaml/package.json:13-20
Timestamp: 2025-04-22T18:00:42.287Z
Learning: In ast-grep language packages, type.d.ts is a generated file that should be included in the package.json files array even though it's not directly committed to the repository.
Learnt from: HerringtonDarkholme
PR: #65
File: packages/typescript/index.js:6-6
Timestamp: 2025-04-10T19:47:06.210Z
Learning: In ast-grep, TypeScript and TSX are treated as two separate languages, each with their own language package, rather than TypeScript supporting both .ts and .tsx extensions in a single package.
Learnt from: HerringtonDarkholme
PR: #74
File: packages/all/src/langs.test.ts:0-0
Timestamp: 2025-04-25T19:31:36.345Z
Learning: The @ast-grep/all-langs package uses ESM modules (has "type": "module" in package.json). In ESM, file extensions should be included in imports and should consistently use .js extensions (not .ts) since TypeScript transpiles to JavaScript.
Learnt from: HerringtonDarkholme
PR: #43
File: packages/go/nursery.js:10-17
Timestamp: 2025-04-01T18:31:28.544Z
Learning: For ast-grep/lang packages, minimal test coverage that verifies basic functionality (like a simple function declaration test for Go) is considered sufficient, and extensive test coverage of language constructs is not required.
Learnt from: pelikhan
PR: #38
File: packages/python/package.json:22-22
Timestamp: 2025-03-27T03:50:42.436Z
Learning: Most packages in the ast-grep/langs repository use an empty author field in package.json files. Don't assume authorship information without clear evidence from the repository.
Learnt from: HerringtonDarkholme
PR: #65
File: packages/typescript/package.json:17-17
Timestamp: 2025-04-10T19:46:48.394Z
Learning: In the ast-grep/langs repository, type.d.ts files are generated at build time and are intentionally ignored in git version control.
🔇 Additional comments (1)
README.md (1)
17-21
: No change needed:--allow-build
is the correct PNPM v10 flagIn PNPM v10 lifecycle scripts are blocked by default, and the
--allow-build
flag is used to opt specific packages in for theirpostinstall
scripts. The suggested--allow-scripts
flag does not exist in PNPM v10, so the example in README.md is already accurate.Citations:
• https://socket.dev/blog/pnpm-10-0-0-blocks-lifecycle-scripts-by-default
• https://newreleases.io/project/github/pnpm/pnpm/release/v10.4.0Likely an incorrect or invalid review comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
Context
As of PNPM version 10, postinstall scripts are no longer run by default. All language packages contain postinstall scripts that will place the relevant language parsing library in the correct location for the targeted platform. You must explicitly allowlist the postinstall script to run for your desired language package.
For each language package installed, you can run
pnpm --allow-build=@ast-grep/lang-{lang} add @ast-grep/lang-{lang}
(eg, for theyaml
package:pnpm --allow-build=@ast-grep/lang-yaml add @ast-grep/lang-yaml
). If you forget this step, you can approve the build interactively bypnpm approve-builds
andpnpm rebuild
to force the post-install script to run.Changes
tree-sitter-cli
Summary by CodeRabbit