Skip to content

Add compile-time type checking to TypeScript template dev scripts#2767

Open
heyitsaamir wants to merge 3 commits intomainfrom
fix/templates-tsx-to-ts-node
Open

Add compile-time type checking to TypeScript template dev scripts#2767
heyitsaamir wants to merge 3 commits intomainfrom
fix/templates-tsx-to-ts-node

Conversation

@heyitsaamir
Copy link
Copy Markdown
Collaborator

@heyitsaamir heyitsaamir commented Apr 20, 2026

Summary

  • Adds concurrently to run tsx watch and tsc --noEmit --watch in parallel during npm run dev
  • Devs get fast hot reload (tsx) + type errors in the same terminal
  • Also adds dev:run and dev:check scripts for running them individually
  • Applies to all 5 TypeScript templates: echo, ai, graph, mcp, mcpclient

Test plan

  • Scaffold a new app from each template and run npm run dev
  • Verify hot reload works (edit a .ts file, confirm restart)
  • Introduce a type error and confirm tsc reports it in the terminal

tsx was causing issues, switch to nodemon + ts-node for the dev script across all 5 TypeScript templates (echo, ai, graph, mcp, mcpclient).

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 20, 2026 22:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the TypeScript app templates’ developer experience by replacing tsx watch with a nodemon + ts-node based dev loop, and adjusting template dependencies accordingly.

Changes:

  • Replaced dev script from tsx watch ... to nodemon ... --exec "ts-node ..." across 5 TS templates.
  • Removed tsx devDependency and added nodemon + ts-node devDependencies in those templates.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/cli/templates/typescript/echo/package.json.hbs Switches dev script to nodemon+ts-node; updates devDependencies.
packages/cli/templates/typescript/ai/package.json.hbs Switches dev script to nodemon+ts-node; updates devDependencies.
packages/cli/templates/typescript/graph/package.json.hbs Switches dev script to nodemon+ts-node; updates devDependencies.
packages/cli/templates/typescript/mcp/package.json.hbs Switches dev script to nodemon+ts-node; updates devDependencies (also contains an invalid multi-line script string).
packages/cli/templates/typescript/mcpclient/package.json.hbs Switches dev script to nodemon+ts-node; updates devDependencies.

Comment thread packages/cli/templates/typescript/graph/package.json.hbs Outdated
Comment thread packages/cli/templates/typescript/mcp/package.json.hbs Outdated
Comment thread packages/cli/templates/typescript/mcpclient/package.json.hbs Outdated
Comment thread packages/cli/templates/typescript/mcp/package.json.hbs Outdated
Comment thread packages/cli/templates/typescript/echo/package.json.hbs Outdated
Comment thread packages/cli/templates/typescript/ai/package.json.hbs Outdated
Use concurrently to run tsx watch + tsc --noEmit --watch in parallel,
giving fast hot reload and type errors in the same terminal. Adds
dev:run and dev:check scripts for running them individually.

Co-Authored-By: Claude <noreply@anthropic.com>
@heyitsaamir heyitsaamir changed the title Replace tsx with ts-node in TypeScript templates Add compile-time type checking to TypeScript template dev scripts Apr 20, 2026
@heyitsaamir heyitsaamir requested a review from Copilot April 20, 2026 23:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment on lines 19 to 20
"inspect": "npx cross-env SERVER_PORT=9000 npx @modelcontextprotocol/inspector -e NODE_NO_WARNINGS=1 -e PORT=3978 node
-r dotenv/config ."
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[CRITICAL] scripts.inspect string contains a literal newline (between node and -r ...), which makes the generated package.json invalid JSON and will break npm install/npm run inspect. Put the command on a single line (or otherwise avoid unescaped newlines inside JSON strings).

Suggested change
"inspect": "npx cross-env SERVER_PORT=9000 npx @modelcontextprotocol/inspector -e NODE_NO_WARNINGS=1 -e PORT=3978 node
-r dotenv/config ."
"inspect": "npx cross-env SERVER_PORT=9000 npx @modelcontextprotocol/inspector -e NODE_NO_WARNINGS=1 -e PORT=3978 node -r dotenv/config ."

Copilot uses AI. Check for mistakes.
Put the inspect command on a single line to avoid invalid JSON in the generated package.json.

Co-Authored-By: Claude <noreply@anthropic.com>
"start": "node .",
"dev": "tsx watch -r dotenv/config src/index.ts"
"dev": "concurrently \"tsx watch -r dotenv/config src/index.ts\" \"tsc --noEmit --watch\"",
"dev:run": "tsx watch -r dotenv/config src/index.ts",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not using the --env-file flag?

the -r dotnev/config seems obscure and dated in 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants