mattpocock / xstate-codegen

A codegen tool for 100% TS type-safety in XState
MIT License
245 stars 12 forks source link

Watch mode crashes and exits on any errors. #82

Open threehams opened 3 years ago

threehams commented 3 years ago

I'm trying this out on a new project (which means I'm making lots of mistakes), and in watch mode, xstate-codegen appears to crash and exit on any error, instead of logging to the console and continuing to watch. This means I'm having to manually restart the process on almost every change.

For example, when I create a new file called error.machine.ts:

    at StateNode.formatTransitions (node_modules\xstate\lib\StateNode.js:1367:114)node_modules\xstate-codegen\bin\index.js:159
                        throw new Error("Could not read from path " + filePath);
                              ^

Error: Could not read from path apps\frontend\lib\error.machine.ts
    at node_modules\xstate-codegen\bin\index.js:159:31
    // etc
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I'm about to set up a watcher on top of it so I can make mistakes without having to restart the process manually every time I make a mistake.

Is this expected, or maybe something environment-related?

Environment: xstate-codegen 0.3.0 Windows PowerShell Node 16.0.0