1.0.9 • Published 4 years ago
@zeuscoder-public/microservices-course-common v1.0.9
Custom NPM Module that contains reusable code for the Microservices Course
Steps to create a custom NPM package
- Create the org in NPM
- run
npm init
oryarn init
to create apackage.json
inside the root folder of the module/package - update the name and the version number - be sure to refer to the NPM org name that you want the module to belong to
- initialize a git repo in the module root folder. add /build and node_modules to a
.gitignore
rile in the root dir - add files to git and do an initial commit. You do not need to push to a remote repo as the local git repo is used only by NPM.
- run
npm publish --access public
- the default is private so you must specify public if its a public org. In future, to automatically update the version, runnpm version patch
to increase the patch version number - if there is an issue logging in with npm, run
npm login
to make sure you're logged in. - in package.json, set the "main", "types" and "files" properties
Tech
The package is written in typescript, but transpiled into JS for publishing. Steps for this:
- run
tsc --init
in the root folder to create a tsconfig file - yarn install typescript as a dev dep. also install del-cli for clean fresh builds