Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jguze/typescript-project-template
My own template for making new typescript projects or libraries. Comes with eslint, prettier, tsc, esbuild, and more.
https://github.com/jguze/typescript-project-template
esbuild node template typescript
Last synced: 13 days ago
JSON representation
My own template for making new typescript projects or libraries. Comes with eslint, prettier, tsc, esbuild, and more.
- Host: GitHub
- URL: https://github.com/jguze/typescript-project-template
- Owner: jguze
- Created: 2021-06-30T08:06:08.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-06-30T09:31:22.000Z (over 3 years ago)
- Last Synced: 2024-10-05T01:41:13.485Z (about 1 month ago)
- Topics: esbuild, node, template, typescript
- Language: JavaScript
- Homepage:
- Size: 74.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# typescript-project-template
A basic typescript project template, for those who aren't always sure where to start. Comes with:
- typescript with a tsconfig.json
- eslint
- prettier
- esbuildThis project is configured to use either `esbuild` or `tsc`. The preference is yours. In the current form, they both output CommonJS and ESM outputs. However, it can be modified to output however you'd like, such as for a browser.
## Linting
To lint, run the following:
```
yarn lint
```## Building
This repo can build using the following interchangeably:
- esbuild
- tscIn the case of `esbuild`, it will bundle as well, and run `tsc` only for typechecking.
### esbuild
```
npm run build
```This will run typechecking with `tsc`, and will output two formats with `esbuild`:
- CommonJS (cjs)
- ES Module (esm)These are shown in the `esbuild.config.mjs` script. If you would like to output only ESM, only CJS, or only IIFE, simply modify that config file to suit your needs.
The `watch` command will run with the following:
```
npm run build:watch
```## tsc
If you want to build using `tsc` only, and avoid `esbuild` altogether, instead run:
```
npm run tsc:build
```This will output two formats:
This will run typechecking with `tsc`, and will output two formats with `esbuild`:- CommonJS (cjs)
- ES Module (esm)These are done using `tsc` itself, and can be modified in the `package.json` npm scripts as appropriate.
### Formats
This project, by default, will output two formats with `esbuild` or `tsc`:
- CommonJS (cjs)
- ES Module (esm)Look at the `package.json`. Notice how the `main` and `module` keys point to the outputs found in `esbuild.config.mjs`. If you want to output only a specific format, you will need to modify those areas.