Closed jkomoros closed 2 years ago
npm run build:clean:generated
also run, npm run build:full
works, and then separately verify npm run start:clean
works.npm run start:clean
can be factored out to not do regeneration back and forth for bisect. (maybe create a new npm run start:bisect
src/simulators/types/*.GENERATED.ts
files for each itemsrc/simulator-types.ts
automaticallynpm run generate:schema
automaticallysrc/tools/
node scriptsnpm run generate
when it changesnpm run generate
)src/simulators/types/.cache
generate:types-stubs
command, that runs when start runs.npm run start
from a fresh checkout worksgenerate:types
handle if the javascript isn't generated (tsc hasn't been run)All rendering code should be after 'export default' in your simulator file
requirementIn branch auto-generate-simulator-types
All remaining issues now tracked in sub issues
Currently creators of a simulator have to generate both their SIMULATORSimOptions typescript type and their optionsConfig, and keep them in sync.
Ideally we'd have some tooling that would inspect the optionsConfig and then generate a SIMULATORSimOptions type, keeping hte optionsConfig canonical.
Then we could generate a file in
simulators/types/SIMULATORNAME.ts
for each one.Then the
SimOptions
type can be a discrimnated union, where we include the proper simoptions type for each Simulator.The optionsConfig is not necessarily JSON (it can include other constants, and like e.g. a
hide()
function). We'd probably need to swap in a temporaryany
typed SimOptions, and then load up the files, extract the values, and then it should be pretty simple to declaratively generate a Typescript type based on the options config.See also #71