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 the template button in github. Or clone this then
rm -rf .git && git init. Thennpm i && npm init. -
Edit the source code in
src/index.ts. -
Delete either
.github/workflows/gh-pages-docs.ymlor.github/workflows/gh-pages.yml, depending on whether you want to deploy an example or docs to github pages. -
Edit things
- Use
./README.example.mdas a starter for docs:
cp ./README.example.md ./README.md
- edit the build-example command in
package.jsonso that it has the right namespace for github pages
- Use
- compile the source to both ESM and CJS format, and put compiled files in
dist. - ignore
distand*.jsin 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
prepublishOnlyhook to compile the code before publishing to npm. - use exports field in
package.jsonto make sure the right format is used by consumers. preversionnpm hook -- lintpostversionnpm hook --git push --follow-tags && npm publish- eslint --
npm run lint - tests run in a browser environment via
tape-run-- seenpm test. Includestaptesting tools -- tapzero and tap-spec - CI via github actions