npm
Installing dependencies from package.json
run npm install .
Publishing to npm
- Create a
packagefolder, this will be where the final published thing will live.cdto this folder - Create a
package.jsonfile in the folder usingnpm init, can edit later.namewill be the name of the package- the
mainkey in the.jsonshould be the file name of the package entry point - prefixing
@muahchee/in front of the packagenamewill create a namespaced package, with "muahchee" being my username, prevent name clash
- add
exports.name-of-module = class {}to the main part of the entry pointjsfile - Publishing
cdinto thepackagefolder- run
npm loginto login to npm account - run
npm publish --access=public. Namespaced packages are automatically assumed to be private packages, which we need to sign up for, thus the extra specification.
- If you need to publish an update to the package, make sure to update the
versionkey in thepackage.jsonfile
My npm modules
npm install @muachee/module-name