(filePath: string)
| 165 | * The file must contain a single frame object (not wrapped in `{ frames: [...] }`). |
| 166 | */ |
| 167 | export function addUserFrameFromFile(filePath: string): AddUserFrameResult { |
| 168 | const resolved = path.resolve(filePath); |
| 169 | let raw: unknown; |
| 170 | try { |
| 171 | const text = fs.readFileSync(resolved, 'utf-8'); |
| 172 | raw = JSON.parse(text); |
| 173 | } catch (err) { |
| 174 | throw new Error(`Could not read frame file ${resolved}: ${(err as Error).message}`); |
| 175 | } |
| 176 | const frame = parseFrame(raw); |
| 177 | return addUserFrame(frame); |
| 178 | } |
| 179 | |
| 180 | /** |
| 181 | * Validate an optional frame id from user input (CLI flag, API field, etc). |
no test coverage detected