Skip to content

Commit

Permalink
fix(core): resolve generators and executors with #
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz authored and vsavkin committed Dec 15, 2020
1 parent bd29e0d commit b0c4ac2
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions packages/tao/src/shared/workspace.ts
Expand Up @@ -196,11 +196,9 @@ export class Workspaces {
const executorsDir = path.dirname(executorsFilePath);
const schemaPath = path.join(executorsDir, executorConfig.schema || '');
const schema = JSON.parse(fs.readFileSync(schemaPath).toString());
const module = require(path.join(
executorsDir,
executorConfig.implementation
));
const implementation = module.default;
const [modulePath, exportName] = executorConfig.implementation.split('#');
const module = require(path.join(executorsDir, modulePath));
const implementation = module[exportName || 'default'];
return { schema, implementation };
} catch (e) {
throw new Error(
Expand All @@ -221,13 +219,13 @@ export class Workspaces {
generatorsJson.schematics)[normalizedGeneratorName];
const schemaPath = path.join(generatorsDir, generatorConfig.schema || '');
const schema = JSON.parse(fs.readFileSync(schemaPath).toString());
const module = require(path.join(
generatorsDir,
generatorConfig.implementation
? generatorConfig.implementation
: generatorConfig.factory
));
const implementation = module.default;
generatorConfig.implementation =
generatorConfig.implementation || generatorConfig.factory;
const [modulePath, exportName] = generatorConfig.implementation.split(
'#'
);
const module = require(path.join(generatorsDir, modulePath));
const implementation = module[exportName || 'default'];
return { schema, implementation };
} catch (e) {
throw new Error(
Expand Down

0 comments on commit b0c4ac2

Please sign in to comment.