@@ -14,9 +14,7 @@ import { NodeJsSyncHost } from '@angular-devkit/core/node';
14
14
import { findUp } from './find-up' ;
15
15
16
16
function getSchemaLocation ( ) : string {
17
- const packagePath = require . resolve ( '@angular-devkit/core/package.json' ) ;
18
-
19
- return path . join ( path . dirname ( packagePath ) , 'src/workspace/workspace-schema.json' ) ;
17
+ return path . join ( __dirname , '../lib/config/schema.json' ) ;
20
18
}
21
19
22
20
export const workspaceSchemaPath = getSchemaLocation ( ) ;
@@ -59,12 +57,8 @@ export function getWorkspace(
59
57
let configPath = level === 'local' ? projectFilePath ( ) : globalFilePath ( ) ;
60
58
61
59
if ( ! configPath ) {
62
- if ( level === 'global' ) {
63
- configPath = createGlobalSettings ( ) ;
64
- } else {
65
- cachedWorkspaces . set ( level , null ) ;
66
- return null ;
67
- }
60
+ cachedWorkspaces . set ( level , null ) ;
61
+ return null ;
68
62
}
69
63
70
64
const root = normalize ( path . dirname ( configPath ) ) ;
@@ -79,7 +73,7 @@ export function getWorkspace(
79
73
return workspace ;
80
74
}
81
75
82
- function createGlobalSettings ( ) : string {
76
+ export function createGlobalSettings ( ) : string {
83
77
const home = os . homedir ( ) ;
84
78
if ( ! home ) {
85
79
throw new Error ( 'No home directory found.' ) ;
@@ -135,7 +129,7 @@ export function validateWorkspace(json: JsonValue) {
135
129
}
136
130
137
131
export function getPackageManager ( ) : string {
138
- let workspace = getWorkspace ( ) ;
132
+ let workspace = getWorkspace ( 'local' ) ;
139
133
140
134
if ( workspace ) {
141
135
const project = workspace . getProjectByPath ( normalize ( process . cwd ( ) ) ) ;
@@ -144,7 +138,8 @@ export function getPackageManager(): string {
144
138
if ( typeof value == 'string' ) {
145
139
return value ;
146
140
}
147
- } else if ( workspace . getCli ( ) ) {
141
+ }
142
+ if ( workspace . getCli ( ) ) {
148
143
const value = workspace . getCli ( ) [ 'packageManager' ] ;
149
144
if ( typeof value == 'string' ) {
150
145
return value ;
@@ -253,7 +248,8 @@ export function isWarningEnabled(warning: string): boolean {
253
248
return value ;
254
249
}
255
250
}
256
- } else if ( workspace . getCli ( ) ) {
251
+ }
252
+ if ( workspace . getCli ( ) ) {
257
253
const warnings = workspace . getCli ( ) [ 'warnings' ] ;
258
254
if ( typeof warnings == 'object' && ! Array . isArray ( warnings ) ) {
259
255
const value = warnings [ warning ] ;
0 commit comments