1.0.0 • Published 1 year ago

@gemacho/simple-npm-package v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Simple npm Package

A simple npm package for demonstration purposes and use in a Node.js app.

Known Vulnerabilities GitHub Discord Twitch Status Twitter Follow

Get Started

Follow these steps to publish your own npm package for your own project or using this project.

This is using the CommonJS module format for use in Node.js apps. You can read more about CommonJS vs. ESM module formats in Node.js on the LogRocket Blog

  1. Create a GitHub Repository
  2. Clone the repo locally. Example git clone https://github.com/clarkio/simple-npm-package.git
  3. Open your terminal and change directories to the folder of your cloned project. Example cd simple-npm-package
  4. Run npm init -y to create a package.json file. Note: if you cloned this repository you won't need to do this step.
  5. Update package.json name property with a scoped name. Example @clarkio/simple-npm-package. Be sure to use your username or organization name instead of mine.
  6. Write code for the package (or just use the hello world example in index.js)
  7. Sign up with npm. Also for better security be sure to enable two-factor authentication on your npm account.
  8. Sign in with your npm account in your terminal using the command npm login and follow the on-screen instructions.
  9. Run npx npm-packlist to see the contents that will be included in the published version of the package.
  10. Run npm publish --dry-run to see what would be done when actually running the command.
  11. Run npm publish --access=public to actually publish the package to npm. Note: --access=public is needed for scoped packages (@clarkio/simple-npm-package) as they're private by default. If it's not scoped and doesn't have the private field set to true in package.json it will be public as well.
1.0.0

1 year ago