(
options: WorksetPathOptions = {}
)
| 222 | |
| 223 | /** Absent file reads as the empty state; a corrupt file throws. */ |
| 224 | export async function readWorksetsState( |
| 225 | options: WorksetPathOptions = {} |
| 226 | ): Promise<WorksetsState> { |
| 227 | const filePath = getWorksetsFilePath(options); |
| 228 | |
| 229 | if (!(await pathIsFile(filePath))) { |
| 230 | return { version: 1, worksets: {} }; |
| 231 | } |
| 232 | |
| 233 | return parseWorksetsState(await fs.readFile(filePath, 'utf-8'), options); |
| 234 | } |
| 235 | |
| 236 | const worksetsLockError = makeLockErrorFactory({ |
| 237 | createSubject: 'the worksets lock file', |
no test coverage detected