A template for dependency modules using preact, htm, and typescript. Uses tape-run for tests in a browser environment. See template-ts for something similar but targeting Node.
See the list for more options.
-
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.
- 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
exportsfield inpackage.jsonto make sure the right format is used by consumers. preversionnpm hook -- lint viastandardx.postversionnpm hook --git push && git push --tags && npm publish- eslint via standardx --
npm run lint - tests run in a browser environment via
tape-run-- seenpm test. Includestaptesting tools -- tapzero and tap-arc - CI via github actions
- Deploy a demo webpage on any push event to the main branch. This will build the
exampledirectory and deploy it to yourgithub.iosite.
We automatically create a changelog from the commit messages, at ./CHANGELOG. Commit messages should contain the text "BREAKING CHANGE" for breaking changes.
This happens automatically via the npm version script.
Use a link like this to see a demo page, built from the example directory.
This means you need to configure some things in github to make github pages work. In the gihub UI, you need to go to settings > Pages, and choose Github Actions in the Build and Deployment source.
Also you should go settings > Environments, and create an environemnt gh-pages.

