chore(cli): migrate index, scaffoldHandler, baremetalHandler, and deploy templates from JS to TS#2018
Conversation
…loy templates from JS to TS
Convert 10 files in packages/cli/src from JavaScript to TypeScript:
- src/index.js → index.ts (add types, fix error narrowing)
- commands/generate/scaffold/scaffoldHandler.js → .ts (ScaffoldField/ScaffoldModel interfaces, ListrTaskWrapper types)
- commands/deploy/baremetal/baremetalHandler.js → .ts (ServerConfig/BaremetalYargs/LifecycleHooks interfaces)
- commands/setup/deploy/templates/{baremetal,flightcontrol,netlify,netlifyUD,render}.js → .ts
- commands/setup/deploy/templates/serverless/{api,web}.js → .ts
Remove @ts-expect-error suppressions from netlifyHandler, renderHandler,
serverlessHandler, and baremetalHandler (setup) that referenced these files.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
👷 Deploy request for cedarjs pending review.Visit the deploys page to approve it
|
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run-many -t build:pack --exclude create-ceda... |
✅ Succeeded | 4s | View ↗ |
nx run-many -t build |
✅ Succeeded | 4s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-06-30 08:10:19 UTC
Greptile SummaryThis PR converts several CLI files from JavaScript to TypeScript. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (4): Last reviewed commit: "fix(cli): run prettier with project conf..." | Re-trigger Greptile |
Greptile identified that baremetalHandler and scaffoldHandler were reading errno instead of exitCode when exiting on error, causing SSH command failures to always exit 1 instead of preserving actual status.
|
Greptile P1/P2 on exit code handling are false positives — both const exitCode =
e instanceof Error && 'exitCode' in e
? ((e as Error & { exitCode?: number | null }).exitCode ?? 1)
: 1This matches the original JS ( |
- baremetalHandler.ts: add blank line between parent and sibling import groups - scaffoldHandler.ts: Array<T> -> T[], remove unnecessary `as string` assertion - index.ts: split destructuring so cwd uses `let`, telemetry/help/version use `const` - Rename index.d.ts -> global.d.ts to avoid conflict with index.ts (TS skips index.d.ts when index.ts exists, causing ESLint parserOptions.project error) - Run prettier on baremetal.ts, baremetalHandler.ts, index.ts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Fixed CI failures in 1e94bb5: Lint errors:
Prettier:
|
…Handler.ts, index.ts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The changes in this PR are now available on npm. Try them out by running Or try it in a new app with |

Summary
Converts 10 JavaScript files in
packages/cli/srcto TypeScript:src/index.js→src/index.ts— typedgetTomlDirparam, error narrowing in catchcommands/generate/scaffold/scaffoldHandler.js→.ts—ScaffoldField/ScaffoldModelinterfaces,ListrTaskWrappertypes, proper error narrowingcommands/deploy/baremetal/baremetalHandler.js→.ts—ServerConfig,BaremetalYargs,LifecycleHooksinterfaces, error narrowing in all catch blockscommands/setup/deploy/templates/baremetal.js→.tscommands/setup/deploy/templates/flightcontrol.js→.tscommands/setup/deploy/templates/netlify.js→.tscommands/setup/deploy/templates/netlifyUD.js→.tscommands/setup/deploy/templates/render.js→.ts— typeddatabase: stringparamcommands/setup/deploy/templates/serverless/api.js→.tscommands/setup/deploy/templates/serverless/web.js→.tsAlso removes
@ts-expect-errorsuppression comments from 4 handler files that were silencing missing types from these now-converted template files.Type safety
as any, no@ts-ignoree instanceof Error ? e.message : String(e)throughoutascasts are limited to genuine typing boundaries (e.g. DMMF models fromgetSchema()return an opaque union type)ScaffoldField,ScaffoldModel,ServerConfig, etc.) describe the actual shapes usedTest plan
yarn workspace @cedarjs/cli tsc --noEmitpasses (no new errors)yarn cedar generate scaffold Postyarn workspace @cedarjs/cli test baremetal🤖 Generated with Claude Code