Repository navigation
Install the portability audit as a command; publish an allowlist of files - #59
Merged
Merged
Conversation
…of files
The audit becomes the `expression-language-portability` command of the
package (`npx expression-language-portability --extract src`), so people who
install the package can audit their own expressions without cloning the
repository. It audits the version of the package it comes with.
- scripts/portability-audit.{cjs,php} move to bin/ (scripts/ is repository
tooling and is not published); package.json gets a `bin` entry.
The tarball is now an allowlist. `.npmignore` was a denylist, so whatever it did
not name was published: the CI workflows, build configuration, examples and the
compiled tests (lib/__tests__) were in the 3.0.0-beta.1 tarball, and packing
from a working copy also included its coverage report and local editor
settings. `files` in package.json names what is published (lib, dist, bin, the
changelog and upgrade guide) and replaces .npmignore: 62 files and 286 KB
instead of 183 files and 602 KB, and nothing else can end up in it.
scripts/check-package.cjs (`npm run test:package`, run by the CI build job)
packs the package, checks what is in the tarball, installs it into a clean
project and runs the entry point, the browser bundle and the command, with its
exit codes. It fails when coverage/ or the compiled tests are published again.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The command and the package contents ship in 3.0.0, so the changelog that is in the tarball should not call them unreleased. Also notes the range operator and the matches subject, which the release notes are made from. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Summary
The portability audit becomes a command of the package, so people who install
expression-languagecan run it on their own expressions without cloning the repo:npm install --save-dev expression-language npx expression-language-portability --extract ./src ./config npx expression-language-portability rules.txt --fail-on ordinary # exit 1 in CIIt audits the version of the package it comes with (the default
--libis thelib/next to the script).What changed
scripts/portability-audit.{cjs,php}moved tobin/, with abinentry inpackage.json.scripts/is repository tooling and stays unpublished.npm run portabilitystill works from a checkout.The tarball is now an allowlist (
filesinpackage.json;.npmignoreremoved). Doing this properly turned up that the old denylist published more than it should:3.0.0-beta.1/ before.github/(CI + release workflows),rollup.config.mjs,jest-reporter.cjs,tsconfig.json,.babelrc,examples/, and the compiled tests (lib/__tests__, 41 files)lib,dist,bin,CHANGELOG.md,UPGRADE-*.md(+ README, LICENSE, package.json, which npm always includes)The beta published from CI's clean checkout, so it did not leak anything sensitive. But packing from a working copy would also have shipped its
coverage/report (70 files, 1.8 MB) and.claude/editor settings, because those are git-ignored but not npm-ignored. An allowlist makes that impossible rather than relying on remembering to list it.scripts/check-package.cjs(npm run test:package, now a step of the CI build job) goes throughnpm packlike a user would: checks what's in the tarball (required files present, tooling/coverage/tests absent, everybintarget shipped), installs the tarball into a clean project, and runs the entry point, the minified bundle, and the command with its exit codes (--help, an audit,--fail-on→ 1, no args → 2).Verification
.bin,--help, audit,--fail-on,--extract, and the PHP cross-check (--php-symfony, 360/360 identical) all work from insidenode_modules.filestemporarily regressed to publishcoverage/and the compiled tests,npm run test:packagefails (2 checks) and exits non-zero.npm test: 562 passed (4 new: bin entry, shebang + exec bit, helper alongside, default--lib); 157 with the PHP-backed tests; coverage,tsc --strict, builds + smoke,npm audit --omit=devall clean.Notes for review
lib/**anddist/**are unchanged, onlylib/**/__tests__,types/,examples/and tooling are gone.typesalready points todist/index.d.ts.bin/portability-audit.cjsis committed executable (100755); npm also sets the bit on install.Unreleasedsection of the changelog).🤖 Generated with Claude Code