A template for JS web applications
This template is configured with the latest LTS version of Node (v14).
Use npm start to start the dev server.
Use npm run build to create production build.
- The dev server runs on port 8080.
- The bundle is put in
buildfolder. - Babel presets are configured in
babel.config.json. - The main entrypoint is
src/app.ts. - The only included polyfills are from
@babel/polyfill. Custom polyfills can be added insrc/polyfill.js. - The current config only supports css. CSS frameworks such as SASS and Less can be enabled in
module.rulesinwebpack.common.js.
webpack.common.js(shared config)webpack.dev.jswebpack.prod.js
HtmlWebpackPlugin: Uses src/index.html as the main entrypoint for the project.
DefinePlugin: Defines the following environment variables:
| Variable | default value | Notes |
|---|---|---|
ENV |
test, development, production |
The value is set automatically based on the running environment |
PUBLIC_PATH |
/ |
The context that the app is running in (e.g. /app if the app is accessible at https://<domain>/app). It can be set via PUBLIC_PATH environment variable and must end with a slash. |
FaviconsWebpackPlugin: Generates favorite icons from the image in src/images/favicon.png.
MiniCssExtractPlugin: Extracts the styling from JS files into css files.
CleanWebpackPlugin: Removes and cleans up the build folder before a new build.
BundleAnalyzerPlugin: Provides information and analytics on the generated bundle. It can be accessed on localhost:8081 and is only available in development mode.
- See
tsconfig.jsonfor customized features. - Global types are in
src/types/index.d.ts.
Use npm run lint to see a list of linting issues.
Use npm run lint:fix to fix those issues that can be handled automatically.
- See
.prettierrcfor Prettier configs. - See
.eslintrcfor Eslint configs and.eslintignorefor the ignored patterns.
Use npm run test to run the test units.
Use npm run test:watch to start the test runner in watch mode.
- See
jest.config.jsfor customized features. - Jest is called with
coverageflag to report code coverage. - Uses the following patterns to discover tests:
**/__tests__/**/*.[jt]s?(x)**/?(*.)+(spec|test).[tj]s?(x)
Use npm run docs to generate docs.
- Configured in
typedoc.json. - Generated documentation is put in
docsfolder.
- Configured in
.huskyrcand.lintstagedrc. The only check iseslintrules.
The repo has one Github workflow that checks the linting rules and runs the tests (see .github/workflows/test.yaml).
There are issue and PR templates in .github.