I created this repository at a time when I thought that it was too complicated to get started with small TypeScript projects. But today I would probably use something like Vite's templates over this starter pack. Since I don't have any use for the project myself I have archived it to stop Dependabot from telling me I need to keep it updated.
This is a small starter pack for getting a TypeScript project started using Webpack and ts-loader. It also contains launch.json and tasks.json files for Visual Studio Code integration.
It is not meant to be super idiomatic or production ready. The goal is to have a base that is simple enough that you can build on top of it with confidence that you wont break something and not understand why.
- Clone this repository.
- Run
npm install
in the cloned directory. - If using TSX but not using React, change the
jsxFactory
property in tsconfig.json.
If using VS Code and Google Chrome:
- Press
ctrl-shift-p
and type inRun task
. Press enter. Choose thenpm: start
task. - Press F5 to start debugging in Chrome.
Otherwise:
- Open a terminal and execute
npm run start
- Open your web browser and go to http://localhost:8080/
Finally:
- Start developing. The entry point for the application is src/index.ts.
Use the start-test
npm task to start a Karma server that will watch files in src/ and test/ and run tests in modified files.
For testing, Jasmine + Karma is used.
Prettier is installed by default along with lint-staged. This ensures that code in the repository has a coherent coding style. When committing to the repository, prettier will be ran against the staged files and will update them if there is any code in the files that violates the coding style.
For Visual Studio Code users, it is recommended to install the prettier-vscode plugin. This will make the built in format on save functionality use prettier's coding style.
There are some alternatives listed here to run prettier on save in other editors.
Prettier is also ran in the ci
GitHub Action which is included in this repository. The action will fail if you commit code that violates the coding style.