(target: string)
| 47 | |
| 48 | const statePath = (target: string) => join(devDir, `${target}.json`); |
| 49 | const readState = (target: string): InstanceState | undefined => { |
| 50 | try { |
| 51 | return JSON.parse(readFileSync(statePath(target), "utf8")) as InstanceState; |
| 52 | } catch { |
| 53 | return undefined; |
| 54 | } |
| 55 | }; |
| 56 | const writeState = (state: InstanceState) => { |
| 57 | mkdirSync(devDir, { recursive: true }); |
| 58 | writeFileSync(statePath(state.target), JSON.stringify(state, null, 1)); |