File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
packages/angular_devkit/architect/node Expand file tree Collapse file tree 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
193193 }
194194
195195 // 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 ) ;
197197 if ( ! schemaPath ) {
198198 throw new Error ( 'Could not find the schema for builder ' + builderStr ) ;
199199 }
@@ -203,7 +203,21 @@ export class WorkspaceNodeModulesArchitectHost implements ArchitectHost<NodeModu
203203 ) ;
204204 }
205205
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' ) ;
207221
208222 return Promise . resolve ( {
209223 name : builderStr ,
You can’t perform that action at this time.
0 commit comments