How to publish a hand-written NPM plugin package?
1. Check whether the package name exists. Npmdrinkinggame.party / 2. Create a new folder, easy-card-bind 3. 4. Open the terminal and run NPM init -y 5. Create a new index.js file and write the plug-in method. 6. Configure related information in scripts in package.json. NPM login 9. Enter the user name and password and email address 10. NPM run publish, the new package is published successfully 11. After modification, add the version number in package.json to 12.npm run update version 13. Run NPM run publish again
How to use an NPM plugin package?
1. Create folder test, open the terminal, and run NPM init -y 2. Install dependency package: NPM I obj-to-url-parameters 3. Create a file called test.js and import the plug-in
import urlParameters from 'obj-to-url-parameters';
console.log(urlParameters({name: "Lily", age: 18}));
Copy the code