| 28 | export const shortAppId = (app?: FirebaseApp) => app?.appId?.split("/").pop(); |
| 29 | |
| 30 | export function getWorkspace(host: Tree): { |
| 31 | path: string; |
| 32 | workspace: Workspace; |
| 33 | } { |
| 34 | const path = "/angular.json"; |
| 35 | |
| 36 | const configBuffer = path && host.read(path); |
| 37 | if (!configBuffer) { |
| 38 | throw new SchematicsException(`Could not find angular.json`); |
| 39 | } |
| 40 | |
| 41 | // eslint-disable-next-line @typescript-eslint/no-var-requires |
| 42 | const { parse } = require("jsonc-parser"); |
| 43 | |
| 44 | const workspace = parse(configBuffer.toString()) as Workspace | undefined; |
| 45 | if (!workspace) { |
| 46 | throw new SchematicsException("Could not parse angular.json"); |
| 47 | } |
| 48 | |
| 49 | return { |
| 50 | path, |
| 51 | workspace, |
| 52 | }; |
| 53 | } |
| 54 | |
| 55 | export const getProject = (options: DeployOptions, host: Tree) => { |
| 56 | const { workspace } = getWorkspace(host); |