Skip to content

Generate Node config types from schema - #1413

Merged
BYVoid merged 1 commit into
masterfrom
generate-node-config-types
Jul 8, 2026
Merged

BYVoid merged 1 commit into
masterfrom
generate-node-config-types

Conversation

@BYVoid

@BYVoid BYVoid commented Jul 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • generate Node OpenCCConfig declaration types from data/config/opencc_config.schema.json
  • replace the broad Record<string, unknown> config type with schema-derived config, segmentation, conversion, and dictionary unions
  • add npm run generate:node-config-types for refreshing declarations
  • add Bazel targets for generation and generated-output checking:
    • bazel run //scripts:generate_node_config_types
    • bazel test //scripts:generate_node_config_types_test

Tests

  • node scripts/generate-node-opencc-config-types.js --check
  • npm run generate:node-config-types
  • bazel run //scripts:generate_node_config_types
  • bazel test //scripts:generate_node_config_types_test
  • TypeScript ESM/CJS smoke compile with npx -p typescript tsc
  • npm test

@BYVoid
BYVoid force-pushed the generate-node-config-types branch 2 times, most recently from 2b18746 to f64cebd Compare July 8, 2026 23:23
Derive OpenCCConfig typings from the JSON schema with json-schema-to-typescript instead of keeping a broad Record type. Keep regeneration on the npm script path and document it in the Node README.
@BYVoid
BYVoid force-pushed the generate-node-config-types branch from f64cebd to 75505eb Compare July 8, 2026 23:33
@BYVoid
BYVoid marked this pull request as ready for review July 8, 2026 23:36
@BYVoid
BYVoid merged commit 91a334e into master Jul 8, 2026
42 of 43 checks passed
@BYVoid
BYVoid deleted the generate-node-config-types branch July 9, 2026 00:38
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