My personal template for Preact + Typescript with extra addons.
npx preact-cli create Frantss/preact-typescript-template <project-name>
Preact-CLI options:
--name The application name.
--cwd A directory to use instead of $PWD.
--force Force option to create the directory for the new app [boolean] [default: false]
--yarn Installs dependencies with yarn. [boolean] [default: false]
--git Initialize version control using git. [boolean] [default: false]
--install Installs dependencies. [boolean] [default: true]
- Preact: Small runtime with all the React capabilities
- Preact-CLI: Created with all capabilities granted by 3.0
- TypeScript: You need types
- Jest: Don't forget to write tests
- Preact Testing Library: Great library to test all of your components and hooks
- Cypress: For end-to-end tests
- Webpack: For bundling and other great features
- Sass:
- Autoprefixer
- Modules
- Auto-generated types
- Linting: For a clean and consistent codebase
-
yarn install
: Installs dependencies -
yarn dev
: Run a development, HMR server -
yarn serve
: Run a production-like server -
yarn build
: Production-ready build -
yarn lint
: Check linting in typescript and scss files -
yarn lint:fix
: Fix linting issues in typescript and scss files -
yarn test
: Run tests -
yarn test:watch
: Run tests in watch mode -
yarn test:coverage
: Run tests in coverage mode -
yarn test:e2e
: Run all cypress tests
For detailed explanation on how things work, checkout the Preact-CLI Readme.