Quick notes on how to bootstrap a project where you intend to use Typescript and Node.js
mkdir foo && cd foo
npx gitignore node
npm init
npm intall typescript --save-dev
npm install ts-node --save-dev
npx tsc --init --target es2023 --module node16 --moduleResolution node16 --resolveJsonModule true
To run code: ts-node <your-file>.ts
or user the shebang #!/usr/bin/env ts-node
To compile code to javascript: [to come]
- If you're new to typescript and struggling too hard to be productive in the face of typing errors, consider setting
"noImplicitAny": false
in yourtsconfig.json
- If you'd like to add a license,
npx license
is a handy tool.- It writes the license file to
LICENSE
by default - Given no arguments, it provides a list of all the open source licenses to scroll or search
- You can also provide your preferred license as an argument, like
npx license mit
- More info here.
- It writes the license file to
npx covgen
will add a Contributor Covenant for you- By default, it uses the email address in your git config and writes to
CODE_OF_CONDUCT.md
- More command options here.
- By default, it uses the email address in your git config and writes to
- "How to Set Up a New Typescript Project", Digital Ocean
- "How to start a Node.js project", Phil Nash