Skip to content

build: make the package npm-publishable#2

Open
alastor0325 wants to merge 1 commit into
dpalmeiro:mainfrom
alastor0325:chore/npm-packaging
Open

build: make the package npm-publishable#2
alastor0325 wants to merge 1 commit into
dpalmeiro:mainfrom
alastor0325:chore/npm-packaging

Conversation

@alastor0325

Copy link
Copy Markdown
Contributor

Why

This comes from fx-bug-toolkit, a Claude Code plugin for Firefox bug investigation that uses profiler-cli to power its /analyze-profile command. Today the toolkit has to install it via git clone + npm run build + npm link, which is clunky for users — and because it pulls and builds code straight from a GitHub repo, Claude Code's auto-mode safety classifier blocks the agent from running it. We'd like to install it the normal way, npm i -g profiler-cli, which is simpler for everyone and is a plain registry install the classifier doesn't block. To do that, the package just needs to be publishable to npm — which is what this PR sets up.

The problem

A plain npm publish today would ship a broken package — dist/ is git-ignored and there's no build-on-publish step, so the bin target (./dist/index.js) wouldn't exist in the tarball.

The changes

  • "prepare": "npm run build" — npm runs this before pack/publish (and on git installs), so dist/ is always built into the tarball.
  • "files": ["dist"] — ships the compiled output (npm also auto-includes package.json, README.md, LICENSE).
  • "engines": { "node": ">=18" } — declares the Node floor.
  • LICENSE — adds the MIT license file the manifest already declares. Please confirm the copyright holder — I put dpalmeiro as a placeholder; set it to your name/preference.

Verified with npm pack --dry-run: tarball contains dist/index.js (+ the other compiled files), LICENSE, README.md, package.json.

Not included

The Playwright Firefox runtime browser (npx playwright install firefox) — npm install won't fetch it. I'd suggest documenting it in the README rather than a heavy postinstall; happy to add either if you prefer.

The actual npm publish is yours to run (your npm account). If you'd like tagged releases to auto-publish, I can follow up with a small publish-on-tag GitHub Action (needs an NPM_TOKEN repo secret).

Add a 'prepare' script (build dist/ before pack/publish and on git installs),
a 'files' allowlist so the compiled output ships, an engines floor, and the
MIT LICENSE file the package.json already declares. Enables 'npm i -g profiler-cli'
instead of clone + build + link.
@alastor0325

Copy link
Copy Markdown
Contributor Author

@dpalmeiro could you help to review this? Thanks!

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