tsconfig-gen-cli
v1.0.0
Published
Generate tsconfig.json files for different project types with best-practice defaults
Maintainers
Readme
tsconfig-gen-cli
Generate tsconfig.json files for different project types with best-practice defaults and inline documentation.
Installation
npm install -g tsconfig-gen-cli
# or use without installing:
npx tsconfig-gen-cliUsage
Interactive mode
tsconfig-genPrompts you to choose a preset, strict mode, and output filename.
Presets
tsconfig-gen --preset node # Node.js backend / CLI
tsconfig-gen --preset react # React / Vite frontend
tsconfig-gen --preset library # npm library / package
tsconfig-gen --preset next # Next.js application
tsconfig-gen --preset monorepo # Monorepo root configOptions
| Flag | Alias | Description | Default |
|------|-------|-------------|---------|
| --preset <name> | -p | Project type preset | (interactive) |
| --strict | -s | Enable all strict options | false |
| --output <file> | -o | Output filename | tsconfig.json |
| --version | -V | Show version | |
| --help | -h | Show help | |
Examples
# Generate a strict library config
tsconfig-gen --preset library --strict
# Generate a React config to a custom file
tsconfig-gen --preset react --output tsconfig.app.json
# Generate a strict Node.js config
tsconfig-gen -p node -sOverwriting existing files
If tsconfig.json already exists, the tool shows a diff between the current file and the generated config, then asks for confirmation before overwriting.
Presets
node — Node.js backend / CLI
target: ES2022,module: NodeNext,moduleResolution: NodeNext- Source maps, declaration files, strict type checking
- Excludes test files from compilation
react — React / Vite frontend
target: ES2020,module: ESNext,moduleResolution: bundlerjsx: react-jsx(new transform, no import needed)noEmit: true(Vite handles compilation)verbatimModuleSyntax,isolatedModules
library — npm library / package
target: ES2018for broad compatibility- Emits
.d.ts+ declaration maps todist/types/ composite: false,preserveConstEnums- Strict optional checks when
--strictis used
next — Next.js application
jsx: preserve(Next.js SWC handles JSX)noEmit: true, incremental compilation@ → ./*path alias pre-configured- Next.js TypeScript plugin enabled
monorepo — Monorepo root
composite: truefor project references- Pre-configured
referencesarray for packages - Root config has no
include— packages manage their own files
License
MIT © okirmio-create
