Skip to content

feat: migrate to TypeScript#19

Merged
dirkjanfaber merged 2 commits into
mainfrom
feat/typescript-migration
Jun 5, 2026
Merged

feat: migrate to TypeScript#19
dirkjanfaber merged 2 commits into
mainfrom
feat/typescript-migration

Conversation

@dirkjanfaber

Copy link
Copy Markdown
Owner

Summary

  • Converts all source files from JavaScript to TypeScript (lib/, src/nodes/, test/)
  • Aligns project structure with node-red-contrib-interactive-inject as a reference
  • Replaces any types with proper Node-RED types from @types/node-red (NodeAPI, NodeDef, Node, NodeStatusFill, NodeMessageInFlow)

Key structural changes

  • Flat src/ layout (src/threshold-control.ts, src/threshold-logic.ts)
  • Tests moved to src/__tests__/ (collocated with source, matches reference)
  • tsconfig.json with rootDir: ./src → clean dist/threshold-control.js output
  • tsconfig.build.json extending base config with sourcemaps disabled for prod
  • jest.config.js uses inline tsconfig instead of a separate tsconfig.test.json
  • Build pipeline: tsc -p tsconfig.build.json + html-minifier-terser + cp -r src/icons dist/icons
  • files field lists explicit dist entries instead of the whole directory
  • Added clean, watch, peerDependencies, and overrides for typescript

Test plan

  • npm test — 22 tests pass
  • npm run build — compiles cleanly to dist/, HTML minified, icons copied
  • npm run lint — no errors
  • npm pack --dry-run — verify only dist/ files are included

- Convert all source files to TypeScript (lib/, src/nodes/, test/)
- Flatten layout to src/ root matching node-red-contrib-interactive-inject
- Move tests to src/__tests__/ with inline ts-jest config
- Add tsconfig.build.json (no sourcemaps for prod), tsconfig.json for IDE
- Use proper Node-RED types: NodeAPI, NodeDef, Node, NodeStatusFill, NodeMessageInFlow
- Build pipeline: tsc + html-minifier-terser + icon copy to dist/
- Add clean script, watch script, peerDependencies, and overrides for typescript
- Update files field to explicit dist/ entries only
neostandard 0.13.0 bumped find-up to ^8.0.0 (ESM-only), which breaks
on Node 18 because neostandard's resolve-gitignore.js uses require().
Version 0.12.2 uses find-up ^5.0.0 (CJS) and still supports ts:true.
@dirkjanfaber dirkjanfaber merged commit aa63e13 into main Jun 5, 2026
2 checks passed
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.

1 participant