1.0.0 • Published 1 year ago

zyz-ts-library-example v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Publish to npm

tsc
npm publish

subsequent releases

# make a path / bugfix
npm version patch

# make a new feture
npm version minor

# make a breaking change
npm version major

usage

npm install --save zyz-ts-library-example

consume

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 test

Here 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