TypeScript (Template)
A template project for TypeScript with the usual scripts to run, lint, build and test the source code.
π€ Usage
Clone the repository and in the project directory install its dependencies by running yarn
in the terminal. Afterwards you can run the following scripts:
yarn build
: to create an app bundle. The entry point is the file./src/index.ts
and the resolving binary will be saved in./build/app.bundle.js
.yarn lint
: to statically check the code with ESLint.yarn start
: to execute the code. The entry point is the file.src/index.ts
.yarn test
: to run the tests specified in the folder./test
.
𧩠Dependencies
This template depends on a few Node packages in order to work. All dependencies under the devDependencies scope are mandatory; the most notable ones are:
- eslint: a tool for identifying and reporting problems in TypeScript code.
- jest: a JavaScript test framework.
- ts-node: a TypeScript execution environment.
- typescript: the TypeScript language support.
- webpack: a module bundler for JavaScript.
π Directory Structure
This project follows the directory structure below:
[root]
βββ build/
βββ src/
β βββ index.ts
βββ test/
where:
build/
: is the directory containing the binaries created by the project. This folder is auto-generated and you shouldn't manually put any file here.src/
: is the directory where you will place the project code. The entry point of the project's execution is the fileindex.ts
.test/
: is the directory where you will place your test scripts.
Important Files
.eslintrc
: ESLint configuration file; you can change the linting rules here.jest.config.js
: Jest configuration file; you can change the test parameters here.tsconfig.json
: TypeScript configuration file; you can change how TypeScript transpile the files here.types.d.ts
: File where you create the definitions for the JS modules that don't have TypeScript support.webpack.config.ts
: Webpack configuration file; you can change how the project bundle is created here.
π License
TypeScript (Template) is released under the ISC License. See LICENSE for details.
π¨πΎβπ» Author
Vinicius Egidio (vinicius.io)