nichoth / template-ts-browser

Template for typescript projects in a browser environment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

template ts browser

tests types module semantic versioning license

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

use

  1. Use the template button in github. Or clone this then rm -rf .git && git init. Then npm i && npm init.

  2. Edit the source code in src/index.ts.

  3. Delete either .github/workflows/gh-pages-docs.yml or .github/workflows/gh-pages.yml, depending on whether you want to deploy an example or docs to github pages.

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
  • postversion npm hook -- git push --follow-tags && npm publish
  • eslint -- npm run lint
  • tests run in a browser environment via tape-run -- see npm test. Includes tap testing tools -- tapzero and tap-arc
  • CI via github actions

About

Template for typescript projects in a browser environment

License:MIT License


Languages

Language:JavaScript 44.8%Language:TypeScript 28.4%Language:HTML 26.9%