bencmbrook-typescript-template
v1.0.4
Published
TODO
Readme
typescript-template
Starter template for TypeScript projects. Using tsx, Node 22, ESLint, Prettier.
Publishable Node modules (from src/index.ts) and a CLI (from src/bin/cli.mts) which is runnable via npx.
The only dependency is zod (you can remove it) and consola (for the CLI). Check out extra boilerplate for other common modifications.
Usage
TypeScript
import { sayHello } from 'todo';
sayHello({
message: 'world!',
});CLI
$ npx todo
Hello world!Developers
pnpm installpnpm startPublishing
pnpm publishThis runs lint, test, and build before publishing.
Extra boilerplate
Remove zod
pnpm remove zod
rm src/helpers/validation.tsRemove CLI
pnpm remove consola
rm -rf src/binEdit package.json:
- "bin": "./dist/esm/bin/cli.mjs", "files": [
"dist",
"src",
- "bin"
], "scripts": {
"dev": "tsx --watch src/index.ts",
- "cli": "tsx src/bin/cli.mts",
- "build": "tshy && echo '#!/usr/bin/env node --input-type=module\n'\"$(cat ./dist/esm/bin/cli.mjs)\" > ./dist/esm/bin/cli.mjs",
+ "build": "tshy",