pkgxo
lets you can update package.json when publish
Installation
pnpm add pkgxo -D
Usage
{
"main": "index.ts",
"publishConfig": {
"main": "index.js"
},
"scripts": {
"prepublishOnly": "pkgxo --submit",
"postpublish": "pkgxo --reset"
}
}
pkgxo --submit
would update package.json, use pnpm-manifest by default.
package.json
is follow
{
"main": "index.js",
"publishConfig": {
"main": "index.js"
},
"scripts": {
"prepublishOnly": "pkgxo --submit",
"postpublish": "pkgxo --reset"
}
}
pkgxo --reset
would reset the latest package.json when submitted.
package.json
is follow
{
"main": "index.ts",
"publishConfig": {
"main": "index.js"
},
"scripts": {
"prepublishOnly": "pkgxo --submit",
"postpublish": "pkgxo --reset"
}
}
Advanced
Custom updater
You could use pkgxo.js
in CWD for overwriting.
// pkgxo.js
const pnpmManifest = require('pkgxo/pnpm-manifest')
module.exports = async function (pkg, filename) {
pkg = await pnpmManifest(pkg, filename)
pkg.description = `[LOGO]: ${pkg.description || ''}`
return pkg
}
Contributing
- Fork it!
- Create your new branch:
git checkout -b feature-new
orgit checkout -b fix-which-bug
- Start your magic work now
- Make sure npm test passes
- Commit your changes:
git commit -am 'feat: some description (close #123)'
orgit commit -am 'fix: some description (fix #123)'
- Push to the branch:
git push
- Submit a pull request :)
Authors
This library is written and maintained by imcuttle, moyuyc95@gmail.com.
License
MIT - imcuttle