Build script produces output
Why it matters
A missing prepublishOnly script means a developer can run npm publish against stale or missing dist/ output — shipping a broken release to every consumer before anyone notices. ISO 25010 fault-tolerance requires that the release process itself catch this class of error. SLSA L1 requires that the build is reproducible and that the published artifact reflects the declared source version. A manual build-then-publish workflow is an invitation for version skew between source and registry.
Severity rationale
Medium because the gap between build and publish is a procedural failure mode that produces broken releases — not a security issue, but a reliability one that affects all consumers of the broken version.
Remediation
Add a prepublishOnly script that guarantees a fresh build runs before every npm publish.
{
"scripts": {
"build": "tsup",
"prepublishOnly": "npm run build"
}
}
prepublishOnly runs automatically before npm publish (not before npm install). For packages that need CI-only publishing, also add a prepack hook — it runs before both npm pack and npm publish. Confirm the build output directory in scripts.build matches the paths in main, module, and exports.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the SDK / Package Quality Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · reliability.fault-tolerance — Fault tolerance — prepublishOnly guards against publishing stale artifacts
- ssdf:800-218 · PS.3.1 — Create and maintain software bill of materials and build provenance
- slsa:1.0 · L1 — SLSA L1 — scripted build ensures reproducible artifact production
Taxons
History
- 2026-04-18·v1.0.0·Initial import from sdk-package-quality·automated