Tooling

Package release review

A package release review checks the actual files and public interface that will be shipped. A local tarball can be tested without publishing anything to a registry. Use an explicit `files` allowlist, package metadata, declarations, README and license review. npm may include mandatory metadata even when not listed. `npm pack --dry-run --json --ignore-scripts --offline` previews a local package; `npm pack --json` can create the tarball locally when scoped and reviewed. Disable scripts and network for this fixture. Check file paths against intended names, not only size. Workspaces and lockfiles improve dependency coordination but are not proof of package provenance. Test consumers of the packed artifact before a real release; do not publish from this lesson. Never use npm publish to check what a package contains. Review lifecycle scripts and exclude credentials, local caches and answer keys. Sources: https://docs.npmjs.com/cli/v10/commands/npm-pack/.

Formal Syntax & Structure

nodejs syntaxnodejs
npm pack --dry-run --json --ignore-scripts --offline

Working Example

Example Snippetnodejs
import {writeFileSync} from 'node:fs';import {execFileSync} from 'node:child_process';import assert from 'node:assert/strict';writeFileSync('package.json',JSON.stringify({name:'bm-fixture',version:'1.0.0',files:['index.cjs','index.d.ts'],main:'index.cjs',types:'index.d.ts',license:'MIT'}));writeFileSync('index.cjs','exports.double=x=>x*2;');writeFileSync('index.d.ts','export function double(x: number): number;');writeFileSync('internal.txt','synthetic internal note');const [plan]=JSON.parse(execFileSync('npm',['pack','--dry-run','--json','--ignore-scripts','--offline'],{encoding:'utf8',env:{...process.env,npm_config_update_notifier:'false',npm_config_cache:process.cwd()+'/.npm-cache',npm_config_userconfig:process.cwd()+'/.user-npmrc',npm_config_globalconfig:process.cwd()+'/.global-npmrc'}}));const names=plan.files.map(f=>f.path).sort();assert.deepEqual(names,['index.cjs','index.d.ts','package.json']);console.log(names.join(', '));
Node.js Reference