Skip to content

Add npm allowScripts for esbuild to all examples and create-astro - #17756

Merged
matthewp merged 2 commits into
mainfrom
factory/fix-17745
Aug 20, 2026
Merged

matthewp merged 2 commits into
mainfrom
factory/fix-17745

Conversation

@astro-factory

@astro-factory astro-factory Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds "allowScripts": { "esbuild": true } to all 24 example package.json files and introduces ensureNpmScriptsAllowed() in packages/create-astro/src/actions/dependencies.ts to handle third-party templates as well.

Why

npm v11 introduced allowScripts — a security feature requiring explicit approval of packages with install scripts. esbuild (a direct dependency of astro) runs a postinstall script to download platform-specific binaries. Without this approval, npm v11 emits a warning on every npm install, and npm v12 (expected July 2026) will make it a hard failure.

This is the npm counterpart to the pnpm v11 strictDepBuilds fix from PR #17205, which added ensurePnpmBuildsAllowed(). The new ensureNpmScriptsAllowed() follows the same pattern.

Confirmation

@matthewp confirmed this fix resolves the issue.

Closes #17745

…tibility

npm v11+ warns about packages with unapproved install scripts, and
npm v12 will make this a hard failure. Astro depends on esbuild which
has a postinstall script that downloads platform-specific binaries.

Add `allowScripts` for esbuild to all example package.json files and
add `ensureNpmScriptsAllowed()` to create-astro to pre-approve esbuild
in package.json before running `npm install`.

Fixes #17745
@astro-factory astro-factory Bot added the fix verified Reporter confirmed the triage bot fix works label Aug 20, 2026
@changeset-bot

changeset-bot Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1bd79b9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
create-astro Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added pkg: example Related to an example package (scope) pkg: create-astro Related to the `create-astro` package (scope) labels Aug 20, 2026
# Conflicts:
#	examples/basics/package.json
#	examples/framework-alpine/package.json
#	examples/hackernews/package.json
#	examples/minimal/package.json
#	examples/portfolio/package.json
#	examples/with-markdoc/package.json
@matthewp
matthewp merged commit f88c875 into main Aug 20, 2026
25 checks passed
@matthewp
matthewp deleted the factory/fix-17745 branch August 20, 2026 12:53
@astrobot-houston astrobot-houston mentioned this pull request Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix verified Reporter confirmed the triage bot fix works pkg: create-astro Related to the `create-astro` package (scope) pkg: example Related to an example package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

n package has install scripts not yet covered by allowScripts

1 participant