Skip to main content

System Requirements

incur requires Node.js 18.0.0 or later and TypeScript 5.0 or later.
Before installing, ensure you have:
  • Node.js 18+ (check with node --version)
  • A package manager (npm, pnpm, or bun)
  • TypeScript 5.0+ in your project

Install incur

Choose your package manager:

Verify Installation

Create a simple test file to verify incur is working:
test.ts
Run it:
You should see:
Use tsx for the fastest TypeScript execution without compilation.

TypeScript Configuration

incur works best with these tsconfig.json settings:
tsconfig.json
The moduleResolution: "bundler" setting is recommended for best compatibility with incur’s ESM exports.

Project Setup

For a new CLI project

  1. Initialize your project:
  1. Update package.json:
package.json
  1. Create your CLI entry point:
src/index.ts
  1. Run in development:

For an existing project

Simply install incur and import it:

Build and Distribution

Compile to JavaScript

Build your CLI for distribution:
This creates dist/index.js which can be executed directly:

Test locally

Link your CLI globally for testing:
Now you can run it from anywhere:
Remember to npm unlink when done testing to avoid conflicts.

Publish to npm

Once ready, publish your CLI:
Users can then install and use it:

Troubleshooting

Ensure your package.json has "type": "module" and your tsconfig.json uses "module": "ESNext".
incur re-exports Zod, so always import from incur:
Make sure you’re using TypeScript 5.0 or later. incur relies on modern TypeScript features for type inference.

Next Steps

Quickstart Tutorial

Build your first CLI with commands and options

Core Concepts

Learn about commands, schemas, and output formats