Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.

Commit 1de3944

Browse files
committed
fix(generators): Update resolve path for correct run schematics.js
1 parent cd32d54 commit 1de3944

4 files changed

Lines changed: 24 additions & 14 deletions

File tree

src/commands/angular-entity.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { flags, Command } from '@oclif/command';
2-
import { sep } from 'path';
2+
import { resolve as resolvePath, sep } from 'path';
33
const npmRun = require('npm-run');
44

55
export class AngularEntity extends Command {
@@ -64,8 +64,9 @@ export class AngularEntity extends Command {
6464
});
6565
return new Promise((resolve, reject) => {
6666
const inputFolder = folder ? folder.replace(new RegExp('\\' + sep, 'g'), '/').split(sep).join('/') : undefined;
67-
const command =
68-
'schematics @rucken/schematics:angular-entity ' +
67+
const command = 'node ' +
68+
resolvePath(__dirname, '../../node_modules/@angular-devkit/schematics-cli/bin/schematics.js') +
69+
' @rucken/schematics:angular-entity ' +
6970
(inputFolder ? ('--root=' + inputFolder + ' ') : ' ') +
7071
(name ? ('--name=' + name + ' ') : ' ') +
7172
(fields ? ('--fields=' + fields + ' ') : ' ') +

src/commands/angular-new.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { flags, Command } from '@oclif/command';
2-
import { sep } from 'path';
2+
import { resolve as resolvePath, sep } from 'path';
33
const npmRun = require('npm-run');
44

55
export class AngularNew extends Command {
66
static aliases = ['new:angular', 'angular-new'];
77
static description = 'generate frontend web empty Angular 6+ application based on Rucken template';
88
static flags = {
99
help: flags.help({ char: 'h' }),
10-
name: flags.string({ char: 'n', description: 'application name on ke-bab case', required: true }),
10+
name: flags.string({ char: 'n', description: 'application name on ke-bab case' }),
1111
username: flags.string({ char: 'u', description: 'username' }),
1212
email: flags.string({ char: 'e', description: 'email' })
1313
};
@@ -44,8 +44,12 @@ export class AngularNew extends Command {
4444
});
4545
return new Promise((resolve, reject) => {
4646
const inputFolder = folder ? folder.replace(new RegExp('\\' + sep, 'g'), '/').split(sep).join('/') : undefined;
47-
const command =
48-
'schematics @rucken/schematics:angular-new ' +
47+
if (inputFolder && inputFolder.indexOf('/') === -1 && !name) {
48+
name = inputFolder;
49+
}
50+
const command = 'node ' +
51+
resolvePath(__dirname, '../../node_modules/@angular-devkit/schematics-cli/bin/schematics.js') +
52+
' @rucken/schematics:angular-new ' +
4953
(inputFolder ? ('--root=' + inputFolder + ' ') : ' ') +
5054
(name ? ('--name=' + name + ' ') : ' ') +
5155
(username ? ('--username=' + username + ' ') : ' ') +

src/commands/nestjs-entity.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { flags, Command } from '@oclif/command';
2-
import { sep } from 'path';
2+
import { resolve as resolvePath, sep } from 'path';
33
const npmRun = require('npm-run');
44

55
export class NestJSEntity extends Command {
@@ -59,8 +59,9 @@ export class NestJSEntity extends Command {
5959
});
6060
return new Promise((resolve, reject) => {
6161
const inputFolder = folder ? folder.replace(new RegExp('\\' + sep, 'g'), '/').split(sep).join('/') : undefined;
62-
const command =
63-
'schematics @rucken/schematics:nestjs-entity ' +
62+
const command = 'node ' +
63+
resolvePath(__dirname, '../../node_modules/@angular-devkit/schematics-cli/bin/schematics.js') +
64+
' @rucken/schematics:nestjs-entity ' +
6465
(inputFolder ? ('--root=' + inputFolder + ' ') : ' ') +
6566
(name ? ('--name=' + name + ' ') : ' ') +
6667
(fields ? ('--fields=' + fields + ' ') : ' ') +

src/commands/nestjs-new.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { flags, Command } from '@oclif/command';
2-
import { sep } from 'path';
2+
import { resolve as resolvePath, sep } from 'path';
33
const npmRun = require('npm-run');
44

55
export class NestJSNew extends Command {
66
static aliases = ['new:nestjs', 'nestjs-new'];
77
static description = 'generate empty NestJS backend application';
88
static flags = {
99
help: flags.help({ char: 'h' }),
10-
name: flags.string({ char: 'n', description: 'application name on ke-bab case', required: true }),
10+
name: flags.string({ char: 'n', description: 'application name on ke-bab case' }),
1111
username: flags.string({ char: 'u', description: 'username' }),
1212
email: flags.string({ char: 'e', description: 'email' })
1313
};
@@ -44,8 +44,12 @@ export class NestJSNew extends Command {
4444
});
4545
return new Promise((resolve, reject) => {
4646
const inputFolder = folder ? folder.replace(new RegExp('\\' + sep, 'g'), '/').split(sep).join('/') : undefined;
47-
const command =
48-
'schematics @rucken/schematics:nestjs-new ' +
47+
if (inputFolder && inputFolder.indexOf('/') === -1 && !name) {
48+
name = inputFolder;
49+
}
50+
const command = 'node ' +
51+
resolvePath(__dirname, '../../node_modules/@angular-devkit/schematics-cli/bin/schematics.js') +
52+
' @rucken/schematics:nestjs-new ' +
4953
(inputFolder ? ('--root=' + inputFolder + ' ') : ' ') +
5054
(name ? ('--name=' + name + ' ') : ' ') +
5155
(username ? ('--username=' + username + ' ') : ' ') +

0 commit comments

Comments
 (0)