nichoth / template-ts

A template for Node typescript dependency modules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

template ts

tests types dependencies semantic versioning license

A template for typescript dependency modules that run in node. See template-ts-browser for the same thing but targeting a browser environment.

use

  1. Use the template button in github. Or clone this then rm -rf .git && git init.
  2. npm i && npm init.
  3. Edit README.md -- change the CI badge URL + rewrite docs
  4. Edit the source code in src/index.ts, edit tests in test

featuring

  • compile the source to both ESM and CJS format, and put compiled files in dist.
  • ignore dist and *.js in git, but don't ignore them in npm. That way we don't commit any compiled code to git, but it is available to consumers.
  • use npm's prepublishOnly hook to compile the code before publishing to npm.
  • use exports field in package.json to make sure the right format is used by consumers.
  • preversion npm hook -- lint via standardx.
  • postversion npm hook -- git push && git push --tags && npm publish
  • eslint via standardx -- npm run lint
  • compile tests and run in a node environment
  • CI via github actions

About

A template for Node typescript dependency modules

License:MIT License


Languages

Language:TypeScript 100.0%