Package metadata for release: engines, exports, prepublishOnly #6
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
package.jsondeclares"files": ["dist/", "README.md", "LICENSE"], butdist/isgitignored and there is no
prepublishOnlyorpreparescript. Packing from a clean checkoutwould produce an empty package.
There is also no
enginesfield, despite the code depending on globalfetchandReadableStream(Node 18+) andscript/bootstrappinning a specific Node 22 release. Andthere is no
exportsmap, so every internal module path is part of the public API surface byaccident —
bin/quak.tsalready deep-importssrc/backup.ts,src/thumbnails.tsandsrc/metadata-backup.ts, none of which are re-exported fromsrc/index.ts.None of this can be fixed after a 1.0.0 tag without a breaking change.
Definition of done
package.jsonhas aprepublishOnly(orprepack) script that runs the build, so apacked tarball always contains
dist/.npm pack --dry-run(oryarn pack) from a clean checkout lists the built JavaScript,declaration files,
README.md, andLICENSE, and nothing else. Record the verified filelist in the PR body.
package.jsonhas anengines.noderange matching what the code actually requires, andconsistent with the Node version
script/bootstrappins.package.jsonhas anexportsmap that deliberately declares the public entrypoints,including
./package.json, withtypesandimportconditions ordered correctly.runBackup,runMetadataBackup,listMissingThumbnails,fixMissingThumbnails,BackupResult,BackupError,MissingThumbnailInfo,ThumbnailFixResultandRawMagicMetadata: eitherthey become real public exports from
src/index.ts, or they stay internal and theexportsmap keeps them unreachable. The README API reference issue depends on thisanswer, so it must be explicit.
make checkgreen;make buildgreen.TODO.mdupdated in the same commit.Depends on
The build fix issue.
Note
Whether this package is ever published to a public npm registry is a separate open question
tracked in its own issue; this work is correct regardless of the answer.