-
Clone and setup:
git clone <your-repo-url> cd leetcode-ts mise install # Installs Node.js and pnpm versions from .mise.toml pnpm install # Installs all dependencies
-
Create your first problem:
# Create a new problem manually pnpm new # Follow the prompts to create a new problem file # Or fetch from LeetCode pnpm new --from-leetcode --leetcode-slug two-sum
-
Run tests:
pnpm test # Run all tests once pnpm test:watch # Run tests in watch mode
-
Build and view the website:
pnpm build:data # Generate data from problems pnpm build:site # Build the static site pnpm build # Build both data and site pnpm dev # Start development mode (data watching + site dev server)
All scripts now use the unified CLI (packages/src/cli.ts):
pnpm new- Create a new problem file (supports--from-leetcodeand--leetcode-slugoptions)pnpm test- Run all problem testspnpm test:watch- Run tests in watch modepnpm build:data- Generate website data from problemspnpm build:site- Build the static websitepnpm build- Build both data and sitepnpm dev- Start development mode (data watching + site dev server)pnpm lint- Run ESLintpnpm lint:fix- Fix linting and formatting issues automaticallypnpm format- Format code with Prettierpnpm type-check- Run TypeScript type checking
This project uses ES modules exclusively. All configuration files and source code use import/export syntax. The project is configured with "type": "module" in package.json, which means:
- All
.jsfiles are treated as ES modules - Use
importinstead ofrequire() - Use
export defaultinstead ofmodule.exports - Configuration files use ES module syntax
-
Create a new problem from LeetCode:
pnpm new --from-leetcode --leetcode-slug [leetcode-slug]
-
Solve the problem:
- Edit the generated file in
problems/[leetcode-slug].ts - Add your solution and test cases
- Edit the generated file in
-
Build and view:
pnpm build:data # Generate data from your solution pnpm build:site # Build the website # OR pnpm dev # Start development mode for live updates