Skip to content

Commit 0ac1482

Browse files
FrozenPandazvsavkin
authored andcommitted
fix(core): fix generators on windows
1 parent 58e6e84 commit 0ac1482

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

packages/tao/src/commands/generate.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,15 @@ function parseGenerateOpts(
6363
) {
6464
throwInvalidInvocation();
6565
}
66-
[collectionName, generatorName] = (generatorOptions['_'] as string[])
67-
.shift()
68-
.split(':');
69-
if (!generatorName) {
70-
generatorName = collectionName;
66+
const generatorDescriptor = (generatorOptions['_'] as string[]).shift();
67+
const separatorIndex = generatorDescriptor.lastIndexOf(':');
68+
69+
if (separatorIndex > 0) {
70+
collectionName = generatorDescriptor.substr(0, separatorIndex);
71+
generatorName = generatorDescriptor.substr(separatorIndex + 1);
72+
} else {
7173
collectionName = defaultCollection;
74+
generatorName = generatorDescriptor;
7275
}
7376
} else {
7477
collectionName = generatorOptions.collection as string;

packages/workspace/src/command-line/workspace-generators.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ function constructCollection() {
129129
if (exists(path.join(childDir, 'schema.json'))) {
130130
generators[c] = {
131131
factory: `./${c}`,
132-
schema: `./${path.join(c, 'schema.json')}`,
132+
schema: `./${normalize(path.join(c, 'schema.json'))}`,
133133
description: `Schematic ${c}`,
134134
};
135135
}

0 commit comments

Comments
 (0)