1.0.0 • Published 3 years ago
zyz-ts-library-example v1.0.0
Publish to npm
tsc
npm publishsubsequent releases
# make a path / bugfix
npm version patch
# make a new feture
npm version minor
# make a breaking change
npm version majorusage
npm install --save zyz-ts-library-exampleconsume
import { sayHello } from "zyz-ts-library-example";
sayHello();Testing your module locally with npm link
Using npm link you can easily test whether your changes are working correctly.
cd unit-test
npm run linklib
npm testHere npm run linklib is just an alias for npm run --prefix ../library-starter build && npm link ../library-starter.
Check out the full source of the demo library on github: https://github.com/bersling/typescript-library-starter.
The above tutorial contains all the steps necessary to build & publish a working library. However, you should probably also include some unit tests and you might want to test the behavior of your library locally first, without publishing. Here are some more resources for this:
How to unit test your library How to set up a local consumer without publishing to npm How to make your library available as a system command
1.0.0
3 years ago