pkg-ok:防止发布一个包含错误路径的模块
pkg-ok:防止发布一个包含错误路径的模块
Node.js 其它杂项
共213Star
详细介绍
pkg-ok
checks paths and scripts defined inpackage.json
before you publish👌
- Ensures paths defined in
main
,bin
,module
,types
,typings
,es2015
andbrowser
exist - Ensures
bin
scripts 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
Options
pkg-ok
can be configured to check additional package.json
fields or bin files
pkgOk --field someField --bin script.sh
API
const pkgDirectory = __dirname
pkgOk(pkgDirectory, {
fields: ['someAdditonalField'],
bin: ['someAdditionalScript.sh']
})
License
MIT
Patreon - Supporters
-
282 Star
-
972 Star
-
13 Star
-
805 Star
-
21 Star
-
467 Star