From f4acc259b3db24f8c091fca3435806ef8b6dcac2 Mon Sep 17 00:00:00 2001 From: ai-implementer Date: Tue, 21 Jul 2026 10:12:46 +0000 Subject: [PATCH] [WCTAS-2] Initialize npm/TypeScript project Add package.json with build/start/dev/test scripts, tsconfig.json with strict mode and CommonJS target, .gitignore, and CLAUDE.md documenting the new project structure and commands. Co-Authored-By: Claude Sonnet 4.6 --- .gitignore | 11 +++++++++++ CLAUDE.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 20 ++++++++++++++++++++ tsconfig.json | 18 ++++++++++++++++++ 4 files changed, 100 insertions(+) create mode 100644 .gitignore create mode 100644 CLAUDE.md create mode 100644 package.json create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f7d7d72 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +node_modules/ +dist/ +.env +.env.local +*.log +npm-debug.log* +.DS_Store +.vscode/ +.idea/ +*.js.map +coverage/ diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..43da804 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,51 @@ +# word-counter-api + +## Project Status + +Node.js/TypeScript project initialized with npm and tsconfig. Source code implementation is pending. + +## Build Commands + +```bash +npm install # install dependencies +npm run build # compile TypeScript → dist/ via tsc +``` + +## Test Commands + +```bash +npm test # run full Jest test suite +npm test -- path/to/file.test.ts # run a single test file +npm test -- -t "test name" # run a single named test +``` + +## Development Commands + +```bash +npm run dev # tsx watch src/server.ts (TypeScript watch mode) +npm start # node dist/server.js (production build) +``` + +## Project Structure + +``` +word-counter-api/ +├── src/ # TypeScript source files (to be added) +│ └── server.ts # Entry point +├── dist/ # Compiled JavaScript output (gitignored) +├── package.json # npm manifest with build/start/dev/test scripts +├── tsconfig.json # TypeScript config (CommonJS, strict mode) +├── .gitignore +├── README.md +└── CLAUDE.md # This file +``` + +## Architecture Notes + +- **Purpose**: An API service for counting words in text input. +- **Stack**: Node.js + TypeScript (CommonJS modules, `tsc` build, `tsx` for dev watch). +- Key design decisions still to make: HTTP framework, authentication strategy, request/response format (REST vs. GraphQL), deployment target. + +## Code Style + +TypeScript strict mode is enabled (`"strict": true` in tsconfig.json). No linter or formatter configured yet. Document here once a stack is chosen (e.g., ESLint/Prettier). diff --git a/package.json b/package.json new file mode 100644 index 0000000..41afaa0 --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ +{ + "name": "word-counter-api", + "version": "1.0.0", + "description": "HTTP API that counts words in text input", + "main": "dist/server.js", + "scripts": { + "build": "tsc", + "start": "node dist/server.js", + "dev": "tsx watch src/server.ts", + "test": "jest" + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "@types/node": "^22.0.0", + "tsx": "^4.0.0", + "typescript": "^5.0.0" + } +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..97777f8 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "CommonJS", + "moduleResolution": "node", + "outDir": "dist", + "rootDir": "src", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "declaration": true, + "declarationMap": true, + "sourceMap": true + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"] +}