File tree 1 file changed +16
-2
lines changed
packages/angular_devkit/architect/node
1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ export class WorkspaceNodeModulesArchitectHost implements ArchitectHost<NodeModu
193
193
}
194
194
195
195
// Determine builder option schema path (relative within package only)
196
- const schemaPath = builder . schema && path . normalize ( builder . schema ) ;
196
+ let schemaPath = builder . schema && path . normalize ( builder . schema ) ;
197
197
if ( ! schemaPath ) {
198
198
throw new Error ( 'Could not find the schema for builder ' + builderStr ) ;
199
199
}
@@ -203,7 +203,21 @@ export class WorkspaceNodeModulesArchitectHost implements ArchitectHost<NodeModu
203
203
) ;
204
204
}
205
205
206
- const schemaText = readFileSync ( path . join ( buildersManifestDirectory , schemaPath ) , 'utf-8' ) ;
206
+ // The file could be either a package reference or in the local manifest directory.
207
+ // Node resolution is tried first then reading the file from the manifest directory if resolution fails.
208
+ try {
209
+ schemaPath = localRequire . resolve ( schemaPath , {
210
+ paths : [ buildersManifestDirectory ] ,
211
+ } ) ;
212
+ } catch ( e ) {
213
+ if ( ( e as NodeJS . ErrnoException ) . code === 'MODULE_NOT_FOUND' ) {
214
+ schemaPath = path . join ( buildersManifestDirectory , schemaPath ) ;
215
+ } else {
216
+ throw e ;
217
+ }
218
+ }
219
+
220
+ const schemaText = readFileSync ( schemaPath , 'utf-8' ) ;
207
221
208
222
return Promise . resolve ( {
209
223
name : builderStr ,
You can’t perform that action at this time.
0 commit comments