Quick template to get started with a TypeScript project using Bun and pnpm with Jest-style unit tests, possibly an NPM package, and/or a Github Pages site.
- Source files go in
src/ - Test files go in
test/ - Build scripts and helpers go in
scripts/ - Build artifacts go in
dist/- gitignore'd - Website build files go in
docs/- gitignore'd
Getting started:
- update the
package.jsonfields: name, version, description, repository, keywords, author, license (and update the LICENSE file if license is different) - to build:
pnpm build - to test website:
pnpm devand open http://localhost:8000/
If you want to publish as an NPM package:
- make sure to remove
"private": truefrompackage.json - make the first release manually as normal
npm publish - once it is on NPM, when you make a new version, bump the version in
package.jsonand then manually trigger.github/workflows/publish-package.yaml - if tests fail, it will not publish
If you don't want to publish as an NPM package:
- delete
.github/workflows/publish-package.yaml
If you have a website (docs, demo, etc):
- put your html files in
website/ - if there is more than just
index.html, make sure to list them as entrypoints inscripts/build-website.ts - there is a custom plugin that allows Markdown in elements that look like
<div markdown="block">markdown here</div> - uncomment the "push" event in
.github/workflows/website.yamlif you want to automatically rebuild on every push (it is commented to prevent the workflow from instantly failing when you create the new repo from this template)
If you don't have a website:
- delete the entire
website/directory - delete
.github/workflows/website.yaml - delete
scripts/build-website.ts - possibly merge the two build scripts
- delete the
build:website,clean-docs,dev,dev:watch, anddev:servescripts frompackage.json