Getting Started
Prerequisites
- Node.js 22 or higher
- npm 9 or higher (or pnpm/yarn)
bash
node -v
npm -vInstallation
Global Install
bash
npm install -g tsnapOr Use npx
No installation needed:
bash
npx tsnap --versionTIP
Use npx tsnap instead of tsnap in all commands if you prefer not to install globally.
Quick Start
Create a Project
bash
tsnap init my-projectYou'll be prompted with interactive questions:
✔ Use ESLint? (Y/n)
✔ Use Prettier? (Y/n)
✔ Run npm install now? (Y/n)
ℹ️ Creating project at /path/to/my-project
✅️ Project created
✨ Project initialization is completedThen navigate to your project:
bash
cd my-projectTIP
You can choose which tools to include during initialization, or add them later with tsnap add.
Project Structure
After initialization:
my-project/
├── src/
│ └── index.ts
├── .gitignore
├── package.json
├── tsconfig.json
└── README.mdAdding Tools Later
Add development tools anytime after initialization:
bash
# Add ESLint
tsnap add eslint
# Add Prettier
tsnap add prettier
# Add Vite (with interactive template selection)
tsnap add viteWhen adding Vite, you'll choose a template:
? Select a Vite template:
❯ Vanilla (TypeScript)
React (TypeScript)WARNING
tsnap won't overwrite existing files without confirmation.
Available Tools
| Tool | Description | Command |
|---|---|---|
| ESLint | TypeScript linter | tsnap add eslint |
| Prettier | Code formatter | tsnap add prettier |
| Vite | Build tool & dev server | tsnap add vite |
Example Workflows
Minimal Setup (No Tools)
bash
# With global install
tsnap init my-project
# Answer "No" to all prompts
cd my-project
npm installFull Setup (All Tools)
bash
# With global install
tsnap init my-project
# Answer "Yes" to ESLint and Prettier
cd my-project
tsnap add vite
npm run devUsing npx
bash
# No installation needed
npx tsnap init my-project
cd my-project
npx tsnap add vite
npm install
npm run devCommon Commands
bash
tsnap --version # Check version
tsnap --help # View help
tsnap init <name> # Create project (interactive)
tsnap add <tool> # Add toolNext Steps
- Configure
tsconfig.jsonfor your needs - Explore tool-specific documentation
- Start building your TypeScript application