nichoth / template-netlify-app

Template for netlify, htm, preact, & typescript applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

template netlify app tests

A template for applications using preact, htm, typescript, and netlify as host. Use tape-run for tests in a browser environment.

See template-ts-preact-htm-app for the same thing, but not using netlify.

See template-ts-preact-htm for something similar but for dependency modules.

use

  1. Use the template button in github. Or clone this then rm -rf .git && git init.
  2. Then npm i && npm init.
  3. Edit the source code in src/.
  4. Add the project to netlify, and add a link to the netlify site in the README file.

featuring

  • preversion npm hook -- lint.
  • postversion npm hook -- git push && git push --tags
  • eslint via standardx -- npm run lint
  • test in a browser environment via tape-run -- see npm test. Includes tap testing tools -- tapzero and tap-arc
  • CI via github actions
  • routing via route-event and @nichoth/routes

develop

Start a localhost server, and serve the netlify serverless functions locally. Note the lambda functions are accessible at the path /api/ from the frontend code.

npm start

architecture

See this article for more details about application architecture.

We create application state and logic in the file ./src/state.ts. This exports static functions, creates a state object, and sets up URL routing.

In the view code, you would call the functions exposed in state with a state instance in response to application events.

About

Template for netlify, htm, preact, & typescript applications


Languages

Language:TypeScript 69.9%Language:JavaScript 18.1%Language:HTML 7.4%Language:CSS 4.7%