https://github.com/nichoth/template-ts-preact-htm
Template for peact, htm, and typescript
https://github.com/nichoth/template-ts-preact-htm
Last synced: over 1 year ago
JSON representation
Template for peact, htm, and typescript
- Host: GitHub
- URL: https://github.com/nichoth/template-ts-preact-htm
- Owner: nichoth
- Created: 2023-10-26T19:00:22.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-25T17:07:29.000Z (over 1 year ago)
- Last Synced: 2025-02-25T18:23:09.069Z (over 1 year ago)
- Language: JavaScript
- Size: 506 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# template ts preact htm 
A template for *dependency* modules using `preact`, `htm`, and typescript. Uses `tape-run` for tests in a browser environment. See [template-ts](https://github.com/nichoth/template-ts) for something similar but targeting Node.
## more templates
[See the list](https://github.com/nichoth/#templates) for more options.
## 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`.
## 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](https://www.npmjs.com/package/standardx) -- `npm run lint`
* tests run in a browser environment via `tape-run` -- see `npm test`. Includes `tap` testing tools -- [tapzero](https://github.com/nichoth/tapzero) and [tap-arc](https://www.npmjs.com/package/tap-arc)
* CI via github actions
* Deploy a demo webpage on any push event to the main branch. This will build the `example` directory and deploy it to your `github.io` site.
## changelog
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](./package.json#L15).
## demo
Use [a link like this](https://nichoth.github.io/template-ts-preact-htm/) 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`.
