Skip to content

fix(publish): Pack tarball with --ignore-scripts#416

Merged
csandman merged 1 commit into
mainfrom
fix/publish-pack-ignore-scripts
May 16, 2026
Merged

fix(publish): Pack tarball with --ignore-scripts#416
csandman merged 1 commit into
mainfrom
fix/publish-pack-ignore-scripts

Conversation

@csandman

Copy link
Copy Markdown
Owner

Summary

Fixes the publish workflow's build job failing with:

Error: Unable to process file command 'output' successfully.
Error: Invalid format '> chakra-react-select@6.1.2 prepare'

Root cause

Removing .npmrc's ignore-scripts=true in #413 had an unintended consequence. When .npmrc had ignore-scripts=true, all lifecycle scripts were globally suppressed — including the project's own prepare: "husky". With .npmrc gone, npm pack now runs prepare, which dumps husky's output to stdout:

> chakra-react-select@6.1.2 prepare
> husky
...
chakra-react-select-6.1.2.tgz

TARBALL=$(npm pack) captures all of that, and the resulting multi-line value breaks $GITHUB_OUTPUT's key=value\n format.

The reasoning for dropping .npmrc in #413 still stands — pnpm's allowBuilds handles the actual supply-chain threat (dependency install scripts) with finer granularity. But allowBuilds doesn't touch the project's own lifecycle scripts during npm pack, which is what's biting us here.

Fix

Add --ignore-scripts to the npm pack invocation. Targeted (only the pack step), matches the convention used by pnpm install --ignore-scripts elsewhere in the workflow, and we genuinely don't need husky's prepare to run during CI pack — git hooks aren't relevant in the ephemeral runner.

Verification

Locally with .npmrc absent (same state as CI):

$ TARBALL=$(npm pack --ignore-scripts) && echo "==:$TARBALL"
[npm notice output to stderr...]
==:chakra-react-select-6.1.2.tgz

Just the filename — $GITHUB_OUTPUT will accept it cleanly.

Test plan

  • After merging, re-run the failed Publish to npm workflow run (or wait for the next release). The build job should pack the tarball, upload the artifact, and hand off to publish without erroring.

🤖 Generated with Claude Code

Removing .npmrc's ignore-scripts=true in #413 had an unintended
consequence: `npm pack` now runs the project's own `prepare`
script (husky), which dumps lifecycle output to stdout. With
TARBALL=$(npm pack), that output gets captured alongside the
tarball filename, producing a multi-line value that breaks
$GITHUB_OUTPUT's key=value\n format and fails the build job.

pnpm's `allowBuilds` whitelist only gates *dependency* install
scripts; it doesn't suppress the project's own scripts during
`npm pack`. Adding --ignore-scripts to the pack invocation
restores clean stdout. Husky's `prepare` doesn't need to run
during CI pack anyway — git hooks aren't relevant in the
ephemeral runner.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@pkg-pr-new

pkg-pr-new Bot commented May 16, 2026

Copy link
Copy Markdown

commit: e3bc53c

@github-actions

Copy link
Copy Markdown

📊 Package size report   No changes

File Before After
Total (Includes all files) 152.7 kB 152.7 kB
Tarball size 30.0 kB 0.01%↑30.0 kB
Unchanged files
File Size
dist/index.d.mts 20.1 kB
dist/index.d.ts 20.1 kB
dist/index.js 31.1 kB
dist/index.mjs 29.5 kB
LICENSE.md 1.1 kB
package.json 2.7 kB
README.md 48.1 kB

🤖 This report was automatically generated by pkg-size-action

csandman added a commit that referenced this pull request May 16, 2026
Without .npmrc's ignore-scripts=true, `npm pack` runs the
project's own `prepare` script (husky), which dumps lifecycle
output to stdout. TARBALL=$(npm pack) captures that output
alongside the tarball filename, producing a multi-line value
that breaks $GITHUB_OUTPUT's key=value\n format and fails the
build job.

pnpm's `allowBuilds` whitelist only gates *dependency* install
scripts; it doesn't suppress the project's own scripts during
`npm pack`. Adding --ignore-scripts to the pack invocation
restores clean stdout. Husky's `prepare` doesn't need to run
during CI pack — git hooks aren't relevant in the ephemeral
runner.

Same fix as #416 on main; included here so the v5 publish flow
doesn't regress when .npmrc is dropped.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@csandman csandman merged commit c6a6d3a into main May 16, 2026
9 checks passed
csandman added a commit that referenced this pull request May 16, 2026
* chore: Port consistency tweaks from main

Bundle of small, mechanical changes already shipped on main that
apply cleanly to v5:

CI workflows:
- Bump Node 22 → 24 on lint, pkg-pr, package-size-report jobs
  (publish was already on 24 for OIDC).
- Name previously-anonymous workflow steps for clearer logs.
- Drop quotes around `cache: pnpm` for consistency with other
  workflow inputs.
- Rename zizmor-scan.yml → zizmor.yml.

publish.yml hardening:
- Quote shell variables ("$TAG_NAME", "$GITHUB_OUTPUT",
  "$TARBALL") against IFS / glob expansion surprises.
- Move the `env:` block above `run:` to match the convention
  on other steps.

Dep-script protection:
- Drop .npmrc (`ignore-scripts=true`). pnpm's `allowBuilds`
  whitelist in pnpm-workspace.yaml already gates dependency
  install scripts with finer granularity; the publish workflow
  passes --ignore-scripts to `pnpm install` explicitly for the
  high-stakes path. Removing the blanket flag lets husky's
  `prepare` script run automatically on fresh installs.
- Update CONTRIBUTING.md to reflect the model change.
- Drop the now-obsolete `.npmrc` → `ini` files.associations
  entry from .vscode/settings.json; add `typescript.tsdk` so
  VS Code picks up the workspace TS version.

Lint-staged:
- Move config from package.json to .lintstagedrc.mjs.
- Add an `*.mjs` override to .oxlintrc.json so the new config
  file doesn't trip nodejs-modules / unsafe-* rules.

Docs:
- Add SECURITY.md describing the support window and the
  GitHub Security Advisories reporting path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(publish): Pack tarball with --ignore-scripts

Without .npmrc's ignore-scripts=true, `npm pack` runs the
project's own `prepare` script (husky), which dumps lifecycle
output to stdout. TARBALL=$(npm pack) captures that output
alongside the tarball filename, producing a multi-line value
that breaks $GITHUB_OUTPUT's key=value\n format and fails the
build job.

pnpm's `allowBuilds` whitelist only gates *dependency* install
scripts; it doesn't suppress the project's own scripts during
`npm pack`. Adding --ignore-scripts to the pack invocation
restores clean stdout. Husky's `prepare` doesn't need to run
during CI pack — git hooks aren't relevant in the ephemeral
runner.

Same fix as #416 on main; included here so the v5 publish flow
doesn't regress when .npmrc is dropped.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(actions): Bump upload-artifact v4 → v7 for Node 24

v4.6.2 runs on Node 20, which GitHub deprecated in their
September 2025 changelog. Workflow runs now emit a warning;
Node 20 actions will be force-upgraded to Node 24 by default
on 2026-06-02 and removed entirely on 2026-09-16.

v7.0.1 runs on Node 24 and is otherwise drop-in for our usage
(simple name + path inputs, no merging or advanced features).

Same change as on main; included here so v5 doesn't carry the
deprecation warning forward.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant