( level: 'local' | 'global' = 'local', )
| 218 | * NB: This method is intended to be used only for `ng config`. |
| 219 | */ |
| 220 | export async function getWorkspaceRaw( |
| 221 | level: 'local' | 'global' = 'local', |
| 222 | ): Promise<[JSONFile | null, string | null]> { |
| 223 | let configPath = level === 'local' ? await projectFilePath() : globalFilePath(); |
| 224 | |
| 225 | if (!configPath) { |
| 226 | if (level === 'global') { |
| 227 | configPath = defaultGlobalFilePath; |
| 228 | // Config doesn't exist, force create it. |
| 229 | |
| 230 | const globalWorkspace = await getWorkspace('global'); |
| 231 | await globalWorkspace.save(); |
| 232 | } else { |
| 233 | return [null, null]; |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | return [new JSONFile(configPath), configPath]; |
| 238 | } |
| 239 | |
| 240 | export async function validateWorkspace(data: json.JsonObject, isGlobal: boolean): Promise<void> { |
| 241 | const schema = readAndParseJson(workspaceSchemaPath); |
no test coverage detected