abraham/pkg-ok
Über uns
👌 Checks paths and scripts defined in package.json before you publish
EntwicklerwerkzeugeGemessener Sternzuwachs
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- Verlauf wird gesammelt
Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.
README.md
Originalpkg-ok

pkg-okchecks paths and scripts defined inpackage.jsonbefore you publish 👌
- Ensures paths defined in
main,bin,module,types,typings,es2015,browser, andexportsexist - Ensures those paths will be published, so they aren't left out by
filesor.npmignore - Ensures direct dependencies aren't linked to local folders (
npm link) - Ensures paths defined in
main,bin, andbrowserare relative - Ensures
binscripts use cross-platform line endings
Usage
npm install pkg-ok --save-dev
// package.json
{
"main": "oops_this_file_doesnt_exist.js",
"scripts": {
"prepublishOnly": "... && pkg-ok"
}
}
npm publish
# Error!
# Since main file doesn't exist, publish is blocked
CLI
Check the package.json in the current directory.
pkg-ok
Check the package.json in a specific directory.
pkg-ok some/directory
pkg-ok some/directory/package.json
Check several packages, such as in a monorepo. Quote globs so pkg-ok expands them; node_modules is skipped and .gitignore is not read.
pkg-ok . packages/a packages/b
pkg-ok 'packages/*'
pkg-ok '**/package.json'
Check additional package.json fields or bin files.
pkg-ok --field someField --bin script.sh
The published check runs npm pack --dry-run --ignore-scripts, so npm must be installed. It's skipped for private packages and packages without a name or version. Turn it off with --no-published.
pkg-ok --no-published
The linked check fails when a package in dependencies, optionalDependencies, or peerDependencies is a symlink to a folder outside node_modules, such as one made by npm link. Links into package-manager stores, like pnpm's, are ignored. Turn it off with --no-linked.
pkg-ok --no-linked
API
import { pkgOk } from 'pkg-ok';
pkgOk(process.cwd(), {
fields: ['someAdditonalField'],
bin: ['someAdditionalScript.sh'],
});
License
MIT
Ähnliche Projekte entdecken
Wird geladen…