Package release review
Prerequisite: node-dual-package-interoperability. Objective: Inspect tarball plan without publishing. Tested locally on Node.js 22.16.0 Linux. Each example is independent. Use a fresh disposable working directory, save as main.mjs, then run node main.mjs. The harness uses a five-second timeout and synthetic environment. These are static code blocks, not ByteMind interactive execution.
How it works
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.
Inspect the actual pack preview
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(', '));Expected output:
index.cjs, index.d.ts, package.jsonThe real npm dry-run excludes the internal note. A preview is not a consumer test or a publication.
Reject an unexpected artifact path
const expected=new Set(['index.cjs','index.d.ts','package.json','README.md']);const planned=['index.cjs','package.json','private-notes.txt'];console.log(planned.filter(x=>!expected.has(x)).join(','));Expected output:
private-notes.txtAn unexpected file requires review before creating a release.
Common mistakes
Never use npm publish to check what a package contains. Review lifecycle scripts and exclude credentials, local caches and answer keys.
Practice
Design a release checklist including both module modes, type declarations, license, local tarball inspection and dependency review.
Reference candidate: node-package-release-review-lookup (route unverified). Documentation: https://docs.npmjs.com/cli/v10/commands/npm-pack/ (opened).
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Package release review — knowledge check
Apply the lesson to a fresh scenario and explain the evidence boundary.
Which command previews local package contents without publishing?
Why inspect actual paths?
What does a clean pack preview not prove?