pkgxo

1.0.2 • Public • Published

pkgxo

Build status Test coverage NPM version NPM Downloads Prettier Conventional Commits

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 or git 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)' or git 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 🐟

Readme

Keywords

Package Sidebar

Install

npm i pkgxo

Weekly Downloads

9

Version

1.0.2

License

MIT

Unpacked Size

155 kB

Total Files

19

Last publish

Collaborators

  • moyuyc