Good day fellow people. This is an opinionated skeleton for Typescript projects. The Typescript code will be compiled into CommonJS to be used in a Node environment.
This skeleton includes building, testing, linting and formatting for Typescript code. Furthermore does it offer a proven structure to document the project over the documentation-skeleton.
Feel free to use it under the MIT license.
- install dependencies
npm i
- start development mode
npm run dev
- change the code and have fun with it
To run the code the system one uses needs to fulfill the following requirements:
- Node.js 20.X.X or higher
- npm 10.X.X or higher
- Install all dependencies
npm i
- Run the build command
npm run build
- Run the compiled script
npm run start
For the development process one can omit the build and run steps and use the dev command to run the code after every saved change:
npm run dev
Functionality can be tested with Jest.
One sample test is already available in the tests
folder.
It is best practice to have one test file for each code file one wants to test. The test file should include the name of the code file, e.g.:
- code file:
./src/Index.ts
- test file:
./tests/Index.test.ts
To run the tests a npm script is provided:
npm run test
Once one is familiar with this skeleton feel free to use it as a base to set up a new Typescript project to get head start.