A minimal TypeScript project template for both frontend and backend development.
- Start a TypeScript project with best practices
- Better developer experience with formatting, linting and fast testing
- A good starting point for both frontend and backend development
Use this template to create your own repo on Github.
Also, you can create a local project with this template.
npx degit lem0nle/typescript-template my-ts-project
cd my-ts-project
# you need to first install pnpm: npm i -g pnpm
pnpm i
If you want to further publish your project as a npm library, you may need some manual modifications to this template.
Modify your package.json
:
{
// replace `"private": true` line with these:
"name": "LIBRARY-NAME",
"version": "1.0.0",
"author": "YOUR-NAME-AND-EMAIL",
"type": "module",
"source": "src/index.ts",
"main": "dist/index.js",
"types": "dist/index.d.ts"
// other fields...
}
Then you can build and publish your library. We recommend using Parcel to build your project for simplicity:
npm install -D parcel
npx parcel build
You can add this to your scripts
field in package.json
:
{
"scripts": {
// ...
"build": "parcel build",
"prepublishOnly": "npm run test && npm run build"
}
}