npm-publish-it

0.1.4 • Public • Published

npm-publish-it

A very simple npm publish tool

usage

Install it:

npm install -D npm-publish-it

Add publish.js in the root of your project folder:

import publish from "npm-publish-it";

publish({
  title: 'your module name', // if not set, get the `name` of `package.json`,
  // prePublish is a array, support multiple commands, like `['rm -rf dist', 'npm run build']`. Default value is []
  prePublish: ['rm -rf dist', 'yarn test', 'yarn build'],
  publishCommand: 'yarn publish', // publish command string, default is `npm publish`
  needOtp: true // Set `true`, if publish needs one-time passcode, default is false.
});

Then execute the commands in the root of your project folder:

node publish
# or `npm pub` , if you have set a script like `"pub": "node publish"` in `package.json`.

Note

if your package is not ES Module, you need to change publish.js to publish.mjs and execute it with node publish.mjs or npm pub. Not forget to set "pub": "node publish.mjs" in your package.json.

Readme

Keywords

Package Sidebar

Install

npm i npm-publish-it

Weekly Downloads

1

Version

0.1.4

License

ISC

Unpacked Size

3.96 kB

Total Files

5

Last publish

Collaborators

  • weijianxu