npm-init-ts
v2.0.2
Published
CLI to scaffold Node.js projects with full TypeScript setup.
Maintainers
Readme
npm-init-ts
Create Node.js TypeScript projects in seconds!
This CLI scaffolds a Node.js TypeScript project with a ready-to-use structure, env loading, oxlint, prettier, and tsc-alias.
How to Use
Go to the directory where you want the project folder to be created:
cd /path/to/projects
npx npm-init-tsThen enter a value for Project Name. The CLI will:
- create a folder using the slugified project name
- use the exact value you typed in the generated
README.md - use the slug for
package.jsonnameand GitHub URLs - leave
<your_github_username>inpackage.jsonfor you to replace manually
What It Generates
- Copies a complete
package.jsontemplate - Creates the structure:
src/index.tswith central env loadingsrc/config/env.tsusingloadEnvFile().gitignore,README.md,.env,.env.exampleLICENSE.txt
- Installs development dependencies:
typescript,tsx,tsc-alias,@types/node,oxlint,prettier
- Creates
tsconfig.json - Adds
oxlint,prettier, andtsc-aliasconfiguration - Fills
nameand GitHub placeholder fields inpackage.json - Creates
.envin the project root
After generation, edit <your_github_username> in these package.json fields:
homepagerepository.urlbugs.url
Final Structure
📦 your-project/
├── node_modules/
├── src/
│ ├── config/
│ │ └── env.ts
│ └── index.ts
├── .env
├── .env.example
├── .gitignore
├── .prettierrc
├── LICENSE.txt
├── oxlintrc.json
├── package-lock.json
├── package.json
└── README.md
├── tsconfig.jsonGenerated Scripts
npm run devruns the project in watch modenpm run buildcompiles withtscand resolves import paths withtsc-aliasnpm run startruns the built outputnpm run lintruns formatting, linting, and type-checkingnpm run formatappliesoxlint --fixandprettier --write
Root Env
The generated project creates .env in the project root. Default content:
NODE_ENV=developmentLicense
This project automatically adds a LICENSE.txt to your project under GPL-3.0.
