Skip to content

Commit

Permalink
fix(@angular-devkit/architect): temporary workaround for TS bug with …
Browse files Browse the repository at this point in the history
…UMDs

The TS bug is microsoft/TypeScript#36780.

The workaround is needed because `ts_library` emits UMDs currently. This will change with bazelbuild/rules_typescript#492 and bazel-contrib/rules_nodejs#1687.
  • Loading branch information
filipesilva committed Mar 31, 2020
1 parent 0226dae commit 56882c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ export class WorkspaceNodeModulesArchitectHost implements ArchitectHost<NodeModu
}

async loadBuilder(info: NodeModulesBuilderInfo): Promise<Builder> {
const builder = (await import(info.import)).default;
const f1 = info.import;
const builder = (await import(f1)).default;
if (builder[BuilderSymbol]) {
return builder;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export class TestingArchitectHost implements ArchitectHost {
this._builderMap.set(builderName, { builderName, description, optionSchema });
}
async addBuilderFromPackage(packageName: string) {
const packageJson = await import(packageName + '/package.json');
const f1 = packageName + '/package.json';
const packageJson = await import(f1);
if (!('builders' in packageJson)) {
throw new Error('Invalid package.json, builders key not found.');
}
Expand All @@ -56,8 +57,10 @@ export class TestingArchitectHost implements ArchitectHost {
const b = builders[builderName];
// TODO: remove this check as v1 is not supported anymore.
if (!b.implementation) { continue; }
const handler = (await import(builderJsonPath + '/../' + b.implementation)).default;
const optionsSchema = await import(builderJsonPath + '/../' + b.schema);
const f2 = builderJsonPath + '/../' + b.implementation;
const handler = (await import(f2)).default;
const f3 = builderJsonPath + '/../' + b.schema;
const optionsSchema = await import(f3);
this.addBuilder(`${packageJson.name}:${builderName}`, handler, b.description, optionsSchema);
}
}
Expand Down

0 comments on commit 56882c0

Please sign in to comment.