Starter for nodejs typescript projects.
Based on the project created with the online CLI.
Refactored according my preferences (the project structure and organization, tools, ci/cd, e.t.c.)
.
├── .cspell.json
├── .editorconfig
├── .eslintrc.json
├── .github
│ ├── ISSUE*TEMPLATE.md
│ └── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── .husky
│ ├── *
│ ├── pre-commit
│ └── pre-push
├── .prettierignore
├── .vscode
├── LICENSE
├── README.md
├── jest.config.js
├── package-lock.json
├── package.json
├── src
│ ├── index.ts
│ └── types
│ └── example.d.ts
└── tsconfig.json
Typescript,
cspell - A CLI tool and library for spell checking code,
npm-run-all - A CLI tool to run multiple npm-scripts in parallel or sequential,
rimraf - a deep deletion module for node.
ESLint - a static code analysis tool,
eslint-config-prettier - Turns off all rules that are unnecessary or might conflict with Prettier,
eslint-plugin-eslint-comments - Additional ESLint rules for ESLint directive comments (e.g. //eslint-disable-line),
eslint-plugin-functional - An ESLint plugin to disable mutation and promote functional programming in JavaScript and TypeScript,
eslint-plugin-import - A plugin to support linting of ES2015+ (ES6+) import/export syntax, and prevent issues with misspelling of file paths and import names,
prettier - A code formatter,
jest - A testing framework,
ts-jest - A Jest transformer with source map support that lets to use Jest to test projects written in TypeScript,
husky - a tool that allows to use Git hooks.
Create a folder:
mkdir <new-package-name>
cd <new-package-name>
Clone the repository, remove git folder, init the new local git repo and rename the branch from master to main:
git clone https://github.com/ekarpovs/node-typescript-starter.git .
rm -r .git
git init
git branch -m master main
Install:
npm install
Activate Git hooks:
npm run prepare
Note: After the command is executed once, the Git hooks will run automatically before each commit and push.
Put your code under the src folder.
Put you tests under the test folder.
Linting:
npm run lint
Fix the linting issues:
npm run fix
Testing:
npm test
Clean build output:
npm run clean
Build:
npm run build
Prepare:
npm run prepare
Git client hooks:
.husky/pre-commit
.husky/pre-push