1.0.5 • Published 5 years ago
amag-corelib2 v1.0.5
README
This node package is mainly consists of domain models that need to be shared with other AMAG application
This package was created by following the step by step instruction on https://itnext.io/step-by-step-building-and-publishing-an-npm-typescript-package-44fe7164964c
Understanding of scripts command in Package.json
- prepare will run both BEFORE the package is packed and published, and on local npm install. Perfect for running building the code.
- prepublishOnly will run BEFORE prepare and ONLY on npm publish.
- preversion will run before bumping a new package version. To be extra sure that we’re not bumping a version with bad code, why not run lint here as well?
- version will run after a new version has been bumped. If your package has a git repository, like in our case, a commit and a new version-tag will be made every time you bump a new version. This command will run BEFORE the commit is made.
- postversion will run after the commit has been made. A perfect place for pushing the commit as well as the tag.
Publish package on npm account
- Login to NPM account first
npm login
- Publish to npm account. You will see that the package will first be built by the prepare script, then test and lint will run by the prepublishOnly script before the package is published.
npm publish
- Bumping a new patch version of the package. Our preversion, version, and postversion will run, create a new tag in git and push it to our remote repository. Then after Publish again.
npm version patch
- Unpublishing entier package
npm unpublish amag-corelib -f
Unit Testing with Jtest
- test file must be ended with .test.ts
- test file under the src and its subfolder will be executed by running following command
npm test
To install this package in other application
npm install amag-corelib