xstate-inspect-cli
v0.0.13
Published
I wanted a quick way to open an `@xstate/inspect` panel targeting a local file. By running a quick CLI command, you can target a single file with `vite`, build it with `esbuild`, and open it in the browser.
Downloads
15
Readme
What is the XState Inspector CLI?
I wanted a quick way to open an @xstate/inspect
panel targeting a local file. By running a quick CLI command, you can target a single file with vite
, build it with esbuild
, and open it in the browser.
Changes to the machine will hot-reload into the browser, too.
Getting Started
yarn global add xstate-inspect-cli
Running the CLI
xstate-inspect-cli ./desired-file.ts
The inspector will open at localhost:3001
. Check the console for any errors with your machine, for instance missing guards/services/actions etc.
Limitations
- Your machine must be exported from the module, i.e.
export const machine = createMachine();
, though you can export multiple machines. - Works best in files where the machine is one of very few exports. Likely won't work if you are importing many modules or executing arbitrary code in your machine file.
- Modules which are not parse-able by
vite
may fail the build. - Probably a bunch of others I haven't discovered yet.