Typescript template for npm packages with testing and automatic documentation.
Start by cloning the template repository to desired directory.
git clone https://github.com/equinor/videx-npm-template.git
Fields that need to be modified are:
Install all dev dependencies defined in package.json using node.
npm install
The entry point for the actual npm package is defined as 'src/index.ts'. This can be changed within 'rollup.config.js'. Any public variables, functions and classes should be exported within this file.
npm run docs
Three part process:
The copying of images makes it possible to refer to local images within the README!
The empty .nojekyll file makes it possible to upload html pages starting wth underscore to GitHub pages.
All tests are defined within the test-folder. Jest naming convention is to place tests for SOMESCRIPT.ts in a single file SOMESCRIPT.test.ts.
npm run test
Executes all tests defined within the test folder.
npm run test:watch
Executes all tests, but does not return immediately. Makes it possible to re-run failed tests quickly.
npm run build
Compiles the code found within the src-folder. Build is outputted to a new dist-folder.
npm run pub
Attemps to publish the package to npm. As part of the publishing process, the source code is re-compiled.
GitHub pages is used to show documentation. To set up GitHub pages, start by navigating to the settings tab within the GitHub repository.
Scroll down and set GitHub pages source to the docs-folder of the master branch.
Publishing the documentation will produce a link. This link can be included in the README for easy navigation.
Sample documentation can be found here.
hello |
Generated using TypeDoc