mirror of https://github.com/abpframework/abp.git
2 changed files with 19 additions and 0 deletions
@ -1,2 +1,3 @@ |
|||||
export * from './angular'; |
export * from './angular'; |
||||
export * from './text'; |
export * from './text'; |
||||
|
export * from './workspace'; |
||||
|
|||||
@ -0,0 +1,18 @@ |
|||||
|
import { experimental } from '@angular-devkit/core'; |
||||
|
import { SchematicsException, Tree } from '@angular-devkit/schematics'; |
||||
|
import { Exception } from '../enums'; |
||||
|
|
||||
|
export function readWorkspaceSchema(tree: Tree) { |
||||
|
const workspaceBuffer = tree.read('/angular.json') || tree.read('/workspace.json'); |
||||
|
if (!workspaceBuffer) throw new SchematicsException(Exception.NoWorkspace); |
||||
|
|
||||
|
let workspaceSchema: experimental.workspace.WorkspaceSchema; |
||||
|
|
||||
|
try { |
||||
|
workspaceSchema = JSON.parse(workspaceBuffer.toString()); |
||||
|
} catch (_) { |
||||
|
throw new SchematicsException(Exception.InvalidWorkspace); |
||||
|
} |
||||
|
|
||||
|
return workspaceSchema; |
||||
|
} |
||||
Loading…
Reference in new issue