Skip to content

tksst/typescript-starter-template

 
 

Repository files navigation

typescript-starter-template

A template project for javascript library (for browsers or Node.js) and/or executable for Node.js.

npm scripts

pnpm lint

  • Static analysis of code with ESLint
  • Code format checking with Prettier
  • Type checking of TypeScript with tsc
  • Credential checking with secretlint

pnpm fix

(if modifiable) Code fixes by ESLint and Prettier

pnpm build

  • Build library entry points for both ESM and CJS by tsup
  • Build an executable that runs in ESM mode by tsup

pnpm test

Testing by Vitest

pnpm watch (in each packages/* directory)

Watching mode of build

Note about Vitest

Sometimes the test hangs due to problems outside of Vitest. In that case, it can be fixed by vitest.config.ts with pool: "forks".

scripts for project starter

There are scripts in the `scripts' directory to customize a new project.

Once the project is started, these scripts should be deleted.

changesets

This template is almost ready for using changesets. To enable changesets for releasing to npm registry:

Note about ts-node or something

This template does not mention ts-node, esbuild-register, tsx or other similar software.

The current versions of them do not act in the same way as the official TypeScript compiler.

ts-node and esbuild-register have a different import resolution mechanism from the tsc and will not run if you use .js extension in the import statement.

tsx is somewhat better than these, but I saw that it does not work well when importing CommonJs from ESM.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 78.8%
  • TypeScript 21.2%