feat(packageFiles): fail if a "prepare" npm script is defined - #732
Merged
Merged
Conversation
A "prepare" script runs on every "npm install" of the adapter, including for end users, and can break installations. Add a packageFiles validation test that raises an error when the "scripts" section of package.json defines "prepare". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
mcm1957
force-pushed
the
feat/check-prepare-script
branch
from
September 4, 2026 19:22
ca9b854 to
9d76a70
Compare
Contributor
Author
|
@GermanBluefox Please review an merge if OK from your side |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Extends
validatePackageFiles()(thetests.packageFilescheck) with a new test that fails if apreparescript is defined in thescriptssection ofpackage.json.Why
A
preparenpm script runs automatically on everynpm installof the adapter — including installations by end users. This can break installations (e.g. if it invokes build tooling or dev-only dependencies that aren't present in a production install), so adapters should not ship one.Details
Check contents of package.jsondescribe block and mirrors the style of the neighbouring dependency checks (guards withisObject, throws anAssertionErrorwith the offending value included).scriptssection passes fine.CHANGELOG.mdentry under WORK IN PROGRESS.build/tests/packageFiles/index.jsto match.npm run checkandnpm run lintboth pass.🤖 Generated with Claude Code