File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030 "extra-bundles" : " node tasks/extra_bundles.mjs" ,
3131 "locales" : " node tasks/locales.js" ,
3232 "schema" : " node tasks/schema.mjs" ,
33- "schema-typegen-diff-check" : " npm run schema && git diff --exit-code src/types/generated/" ,
33+ "schema-typegen-diff-check" : " npm run schema && git diff --exit-code src/types/generated/ test/plot-schema.json " ,
3434 "stats" : " node tasks/stats.js" ,
3535 "find-strings" : " node tasks/find_locale_strings.js" ,
3636 "preprocess" : " ts-node tasks/preprocess.js" ,
Original file line number Diff line number Diff line change @@ -94,16 +94,18 @@ should be added to the corresponding `Full*` interface instead.
9494### 6. Verify
9595
9696``` bash
97- npm run typecheck # zero errors
98- npm run schema # schema regenerates clean
99- git diff test/plot-schema.json
100- # the relevant section should be byte-identical
101- # to before the conversion
97+ npm run typecheck # zero errors
98+ npm run schema-typegen-diff-check # regen + check test/plot-schema.json
99+ # and src/types/generated/ are unchanged
102100```
103101
104- If the schema diff is non-empty, the attribute object's runtime shape
105- changed somewhere — most often a missed ` as const ` or a typo. Compare
106- character-by-character with the original ` .js ` file.
102+ The ` schema-typegen-diff-check ` script regenerates both the runtime schema
103+ and the generated ` .d.ts ` , then ` git diff --exit-code ` s them. A correct
104+ conversion produces a byte-identical schema; CI fails otherwise. This is
105+ the conversion's safety net — if either file diffs after the conversion,
106+ the attribute object's runtime shape changed (most often a missed
107+ ` as const ` or a typo). Compare character-by-character with the original
108+ ` .js ` file.
107109
108110### 7. Commit
109111
Original file line number Diff line number Diff line change @@ -317,7 +317,15 @@ exported-but-not-re-exported types.
317317
318318## CI integration
319319
320- ` npm run schema-typegen-diff-check ` runs the generator and then verifies the output
321- hasn't drifted via ` git diff --exit-code ` . If the working tree differs,
322- exit code 1 — meaning a developer changed the schema but didn't commit
323- the regenerated declarations.
320+ ` npm run schema-typegen-diff-check ` runs the generator and then verifies that
321+ both ` test/plot-schema.json ` and ` src/types/generated/ ` are unchanged via
322+ ` git diff --exit-code ` . If either differs, exit code 1 — meaning either a
323+ developer changed the source schema but didn't commit the regenerated
324+ artifacts, or an attribute-file conversion silently altered the runtime
325+ schema and the change wasn't intentionally committed.
326+
327+ This is what makes the JS-to-TS conversion workflow safe: a correct
328+ conversion produces a byte-identical schema, so the check passes; an
329+ incorrect conversion (typo in a ` values ` array, missed default, wrong
330+ ` valType ` ) changes the schema and CI fails until the developer fixes the
331+ source or commits a deliberate change.
You can’t perform that action at this time.
0 commit comments