Publish an NPM package
Pure JS package, no other Settings
The project package.json type attribute defaults to common.js
Create a project
Create a folder directory
md my-npm-demo
Copy the code
Initialize the
cd my-npm-demo
npm init
Copy the code
Write js files
// index.js
Copy the code
Login NPM
If you don’t have an account, go to the official website to register
npm login
Copy the code
Release NPM package
npm publish
Copy the code
Other items
npm install my-npm-demo --save
Copy the code
Update the NPM package
V1.0.0 ->v1.0.1 NPM version Minor # Added new features V1.0.0 ->v1.1.0 NPM version major # Breaks module backward compatibility, v1.0.0->v2.0.0Copy the code
NPM publish # Publish the updated NPM packageCopy the code
Deprecate NPM packages (use with warnings)
NPM deprecate [email protected] 'test deprecate'Copy the code
Delete (deleted packages can no longer be used)
- Deleted version can be reissued 24 hours later!
- Only packages published within 72 hours can be deleted!
npm unpublish my-npm-demo --force
Copy the code
reference
- How to write a common NPM package vue yourself
- How to publish an NPM package vue
- How to publish your own NPM package JS
- Discard/Delete the NPM package