@depup/nestjs__cli 11.0.24-depup.8 → 12.0.0-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -14
- package/actions/abstract.action.d.ts +1 -2
- package/actions/abstract.action.js +1 -5
- package/actions/add.action.d.ts +3 -4
- package/actions/add.action.js +44 -53
- package/actions/build.action.d.ts +18 -11
- package/actions/build.action.js +172 -79
- package/actions/deploy.action.d.ts +6 -0
- package/actions/deploy.action.js +51 -0
- package/actions/generate.action.d.ts +3 -3
- package/actions/generate.action.js +61 -59
- package/actions/index.d.ts +9 -7
- package/actions/index.js +9 -23
- package/actions/info.action.d.ts +18 -28
- package/actions/info.action.js +80 -60
- package/actions/new.action.d.ts +3 -3
- package/actions/new.action.js +108 -104
- package/actions/start.action.d.ts +4 -7
- package/actions/start.action.js +40 -47
- package/actions/upgrade.action.d.ts +6 -0
- package/actions/upgrade.action.js +53 -0
- package/bin/nest.js +11 -10
- package/changes.json +6 -38
- package/commands/abstract.command.d.ts +3 -3
- package/commands/abstract.command.js +2 -5
- package/commands/add.command.d.ts +3 -3
- package/commands/add.command.js +17 -20
- package/commands/build.command.d.ts +3 -3
- package/commands/build.command.js +52 -56
- package/commands/command.input.js +1 -2
- package/commands/command.loader.d.ts +2 -2
- package/commands/command.loader.js +29 -22
- package/commands/context/add.context.d.ts +7 -0
- package/commands/context/add.context.js +1 -0
- package/commands/context/build.context.d.ts +17 -0
- package/commands/context/build.context.js +1 -0
- package/commands/context/deploy.context.d.ts +7 -0
- package/commands/context/deploy.context.js +1 -0
- package/commands/context/generate.context.d.ts +18 -0
- package/commands/context/generate.context.js +1 -0
- package/commands/context/index.d.ts +7 -0
- package/commands/context/index.js +7 -0
- package/commands/context/new.context.d.ts +19 -0
- package/commands/context/new.context.js +1 -0
- package/commands/context/start.context.d.ts +22 -0
- package/commands/context/start.context.js +1 -0
- package/commands/context/upgrade.context.d.ts +11 -0
- package/commands/context/upgrade.context.js +1 -0
- package/commands/deploy.command.d.ts +5 -0
- package/commands/deploy.command.js +22 -0
- package/commands/generate.command.d.ts +3 -3
- package/commands/generate.command.js +35 -66
- package/commands/index.d.ts +3 -2
- package/commands/index.js +3 -18
- package/commands/info.command.d.ts +3 -3
- package/commands/info.command.js +4 -8
- package/commands/new.command.d.ts +3 -3
- package/commands/new.command.js +34 -36
- package/commands/start.command.d.ts +3 -3
- package/commands/start.command.js +48 -73
- package/commands/upgrade.command.d.ts +5 -0
- package/commands/upgrade.command.js +32 -0
- package/lib/compiler/assets-manager.d.ts +20 -8
- package/lib/compiler/assets-manager.js +199 -63
- package/lib/compiler/base-compiler.d.ts +5 -5
- package/lib/compiler/base-compiler.js +10 -13
- package/lib/compiler/compiler.d.ts +6 -6
- package/lib/compiler/compiler.js +7 -9
- package/lib/compiler/defaults/rspack-defaults.d.ts +3 -0
- package/lib/compiler/defaults/rspack-defaults.js +179 -0
- package/lib/compiler/defaults/swc-defaults.d.ts +5 -2
- package/lib/compiler/defaults/swc-defaults.js +22 -6
- package/lib/compiler/defaults/webpack-defaults.d.ts +2 -2
- package/lib/compiler/defaults/webpack-defaults.js +59 -19
- package/lib/compiler/helpers/append-extension.js +3 -6
- package/lib/compiler/helpers/copy-path-resolve.js +2 -5
- package/lib/compiler/helpers/delete-out-dir.d.ts +1 -1
- package/lib/compiler/helpers/delete-out-dir.js +45 -10
- package/lib/compiler/helpers/get-builder.d.ts +9 -7
- package/lib/compiler/helpers/get-builder.js +3 -6
- package/lib/compiler/helpers/get-effective-root-dir.d.ts +16 -0
- package/lib/compiler/helpers/get-effective-root-dir.js +56 -0
- package/lib/compiler/helpers/get-rspack-config-path.d.ts +10 -0
- package/lib/compiler/helpers/get-rspack-config-path.js +19 -0
- package/lib/compiler/helpers/get-tsc-config.path.d.ts +2 -3
- package/lib/compiler/helpers/get-tsc-config.path.js +6 -9
- package/lib/compiler/helpers/get-value-or-default.d.ts +2 -3
- package/lib/compiler/helpers/get-value-or-default.js +3 -8
- package/lib/compiler/helpers/get-webpack-config-path.d.ts +2 -3
- package/lib/compiler/helpers/get-webpack-config-path.js +4 -7
- package/lib/compiler/helpers/glob.d.ts +19 -0
- package/lib/compiler/helpers/glob.js +185 -0
- package/lib/compiler/helpers/manual-restart.js +4 -8
- package/lib/compiler/helpers/path-confinement.d.ts +33 -0
- package/lib/compiler/helpers/path-confinement.js +63 -0
- package/lib/compiler/helpers/tsconfig-provider.d.ts +7 -6
- package/lib/compiler/helpers/tsconfig-provider.js +32 -13
- package/lib/compiler/hooks/tsconfig-paths.hook.js +13 -13
- package/lib/compiler/interfaces/readonly-visitor.interface.js +1 -2
- package/lib/compiler/plugins/plugin-metadata-generator.d.ts +37 -1
- package/lib/compiler/plugins/plugin-metadata-generator.js +113 -13
- package/lib/compiler/plugins/plugin-metadata-printer.d.ts +1 -1
- package/lib/compiler/plugins/plugin-metadata-printer.js +5 -9
- package/lib/compiler/plugins/plugins-loader.d.ts +2 -2
- package/lib/compiler/plugins/plugins-loader.js +12 -12
- package/lib/compiler/rspack-compiler.d.ts +21 -0
- package/lib/compiler/rspack-compiler.js +111 -0
- package/lib/compiler/swc/constants.d.ts +0 -1
- package/lib/compiler/swc/constants.js +9 -13
- package/lib/compiler/swc/forked-type-checker.js +13 -18
- package/lib/compiler/swc/swc-compiler.d.ts +13 -6
- package/lib/compiler/swc/swc-compiler.js +116 -70
- package/lib/compiler/swc/type-checker-host.js +31 -24
- package/lib/compiler/typescript-loader.js +7 -9
- package/lib/compiler/watch-compiler.d.ts +5 -5
- package/lib/compiler/watch-compiler.js +13 -15
- package/lib/compiler/watchers/recursive-directory-watcher.d.ts +37 -0
- package/lib/compiler/watchers/recursive-directory-watcher.js +334 -0
- package/lib/compiler/webpack-compiler.d.ts +6 -7
- package/lib/compiler/webpack-compiler.js +46 -23
- package/lib/configuration/configuration.d.ts +16 -3
- package/lib/configuration/configuration.js +1 -2
- package/lib/configuration/configuration.loader.d.ts +1 -1
- package/lib/configuration/configuration.loader.js +1 -2
- package/lib/configuration/defaults.d.ts +2 -1
- package/lib/configuration/defaults.js +8 -10
- package/lib/configuration/index.d.ts +3 -3
- package/lib/configuration/index.js +3 -19
- package/lib/configuration/nest-configuration.loader.d.ts +3 -3
- package/lib/configuration/nest-configuration.loader.js +28 -29
- package/lib/package-managers/abstract.package-manager.d.ts +4 -4
- package/lib/package-managers/abstract.package-manager.js +21 -32
- package/lib/package-managers/bun.package-manager.d.ts +7 -0
- package/lib/package-managers/bun.package-manager.js +22 -0
- package/lib/package-managers/index.d.ts +9 -8
- package/lib/package-managers/index.js +9 -24
- package/lib/package-managers/npm.package-manager.d.ts +2 -2
- package/lib/package-managers/npm.package-manager.js +6 -10
- package/lib/package-managers/package-manager-commands.js +1 -2
- package/lib/package-managers/package-manager.d.ts +2 -1
- package/lib/package-managers/package-manager.factory.d.ts +2 -2
- package/lib/package-managers/package-manager.factory.js +23 -20
- package/lib/package-managers/package-manager.js +3 -5
- package/lib/package-managers/pnpm.package-manager.d.ts +2 -2
- package/lib/package-managers/pnpm.package-manager.js +6 -10
- package/lib/package-managers/project.dependency.js +1 -2
- package/lib/package-managers/yarn.package-manager.d.ts +2 -2
- package/lib/package-managers/yarn.package-manager.js +6 -10
- package/lib/questions/questions.d.ts +5 -1
- package/lib/questions/questions.js +2 -7
- package/lib/readers/file-system.reader.d.ts +1 -1
- package/lib/readers/file-system.reader.js +6 -9
- package/lib/readers/index.d.ts +2 -2
- package/lib/readers/index.js +2 -18
- package/lib/readers/reader.js +3 -5
- package/lib/runners/abstract.runner.js +40 -21
- package/lib/runners/bun.runner.d.ts +4 -0
- package/lib/runners/bun.runner.js +6 -0
- package/lib/runners/git.runner.d.ts +1 -1
- package/lib/runners/git.runner.js +2 -6
- package/lib/runners/index.d.ts +3 -3
- package/lib/runners/index.js +3 -19
- package/lib/runners/mau.runner.d.ts +8 -0
- package/lib/runners/mau.runner.js +10 -0
- package/lib/runners/npm.runner.d.ts +1 -1
- package/lib/runners/npm.runner.js +2 -6
- package/lib/runners/pnpm.runner.d.ts +1 -1
- package/lib/runners/pnpm.runner.js +2 -6
- package/lib/runners/runner.d.ts +2 -1
- package/lib/runners/runner.factory.d.ts +7 -6
- package/lib/runners/runner.factory.js +18 -20
- package/lib/runners/runner.js +3 -5
- package/lib/runners/schematic.runner.d.ts +1 -1
- package/lib/runners/schematic.runner.js +5 -7
- package/lib/runners/yarn.runner.d.ts +1 -1
- package/lib/runners/yarn.runner.js +2 -6
- package/lib/schematics/abstract.collection.d.ts +3 -3
- package/lib/schematics/abstract.collection.js +3 -5
- package/lib/schematics/collection.factory.d.ts +2 -2
- package/lib/schematics/collection.factory.js +9 -13
- package/lib/schematics/collection.js +2 -5
- package/lib/schematics/custom.collection.d.ts +2 -2
- package/lib/schematics/custom.collection.js +4 -8
- package/lib/schematics/index.d.ts +4 -4
- package/lib/schematics/index.js +4 -20
- package/lib/schematics/nest.collection.d.ts +3 -3
- package/lib/schematics/nest.collection.js +113 -109
- package/lib/schematics/schematic.option.js +10 -9
- package/lib/ui/banner.js +1 -4
- package/lib/ui/emojis.d.ts +17 -17
- package/lib/ui/emojis.js +19 -22
- package/lib/ui/errors.js +1 -4
- package/lib/ui/index.d.ts +5 -5
- package/lib/ui/index.js +5 -21
- package/lib/ui/messages.d.ts +8 -0
- package/lib/ui/messages.js +23 -18
- package/lib/ui/prefixes.js +3 -6
- package/lib/utils/extra-args-warning.js +3 -6
- package/lib/utils/formatting.js +1 -4
- package/lib/utils/get-default-tsconfig-path.js +4 -7
- package/lib/utils/gracefully-exit-on-prompt-error.js +1 -4
- package/lib/utils/is-esm-project.d.ts +5 -0
- package/lib/utils/is-esm-project.js +16 -0
- package/lib/utils/is-interactive.d.ts +8 -0
- package/lib/utils/is-interactive.js +10 -0
- package/lib/utils/is-module-available.js +3 -4
- package/lib/utils/load-configuration.d.ts +1 -1
- package/lib/utils/load-configuration.js +4 -7
- package/lib/utils/local-binaries.d.ts +2 -2
- package/lib/utils/local-binaries.js +8 -11
- package/lib/utils/mau.d.ts +14 -0
- package/lib/utils/mau.js +46 -0
- package/lib/utils/os-info.utils.js +1 -4
- package/lib/utils/project-utils.d.ts +1 -3
- package/lib/utils/project-utils.js +16 -28
- package/lib/utils/remaining-flags.d.ts +2 -2
- package/lib/utils/remaining-flags.js +13 -8
- package/lib/utils/tree-kill.js +7 -10
- package/lib/utils/type-assertions.js +1 -4
- package/package.json +64 -77
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const ui_1 = require("../ui");
|
|
8
|
-
class AbstractRunner {
|
|
1
|
+
import { red } from 'ansis';
|
|
2
|
+
import { spawn } from 'child_process';
|
|
3
|
+
import { MESSAGES } from '../ui/index.js';
|
|
4
|
+
export class AbstractRunner {
|
|
5
|
+
binary;
|
|
6
|
+
args;
|
|
9
7
|
constructor(binary, args = []) {
|
|
10
8
|
this.binary = binary;
|
|
11
9
|
this.args = args;
|
|
12
10
|
}
|
|
13
11
|
async run(command, collect = false, cwd = process.cwd()) {
|
|
14
12
|
const args = [command];
|
|
15
|
-
const isWindows = (0, os_1.platform)() === 'win32';
|
|
16
13
|
const options = {
|
|
17
14
|
cwd,
|
|
18
15
|
stdio: collect ? 'pipe' : 'inherit',
|
|
@@ -20,19 +17,42 @@ class AbstractRunner {
|
|
|
20
17
|
};
|
|
21
18
|
return new Promise((resolve, reject) => {
|
|
22
19
|
const fullCommand = [this.binary, ...this.args, ...args].join(' ');
|
|
23
|
-
const child =
|
|
20
|
+
const child = spawn(fullCommand, options);
|
|
24
21
|
if (collect) {
|
|
25
|
-
|
|
22
|
+
const chunks = [];
|
|
23
|
+
const errorChunks = [];
|
|
24
|
+
child.stdout.on('data', (data) => chunks.push(data));
|
|
25
|
+
// stderr is piped in collect mode and must be consumed too: an unread
|
|
26
|
+
// pipe blocks the child once the OS buffer fills (e.g. npm printing
|
|
27
|
+
// peer-dependency warnings), and `close` would then never fire.
|
|
28
|
+
child.stderr.on('data', (data) => errorChunks.push(data));
|
|
29
|
+
child.on('close', (code) => {
|
|
30
|
+
if (code === 0) {
|
|
31
|
+
resolve(Buffer.concat(chunks)
|
|
32
|
+
.toString()
|
|
33
|
+
.replace(/\r\n|\n/g, ''));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
console.error(red(MESSAGES.RUNNER_EXECUTION_ERROR(fullCommand)));
|
|
37
|
+
const errorOutput = Buffer.concat(errorChunks).toString().trim();
|
|
38
|
+
if (errorOutput) {
|
|
39
|
+
console.error(red(errorOutput));
|
|
40
|
+
}
|
|
41
|
+
reject();
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
child.on('close', (code) => {
|
|
47
|
+
if (code === 0) {
|
|
48
|
+
resolve(null);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
console.error(red(MESSAGES.RUNNER_EXECUTION_ERROR(fullCommand)));
|
|
52
|
+
reject();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
26
55
|
}
|
|
27
|
-
child.on('close', (code) => {
|
|
28
|
-
if (code === 0) {
|
|
29
|
-
resolve(null);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
console.error((0, ansis_1.red)(ui_1.MESSAGES.RUNNER_EXECUTION_ERROR(fullCommand)));
|
|
33
|
-
reject();
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
56
|
});
|
|
37
57
|
}
|
|
38
58
|
/**
|
|
@@ -44,4 +64,3 @@ class AbstractRunner {
|
|
|
44
64
|
return `${this.binary} ${commandArgs.join(' ')}`;
|
|
45
65
|
}
|
|
46
66
|
}
|
|
47
|
-
exports.AbstractRunner = AbstractRunner;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.GitRunner = void 0;
|
|
4
|
-
const abstract_runner_1 = require("./abstract.runner");
|
|
5
|
-
class GitRunner extends abstract_runner_1.AbstractRunner {
|
|
1
|
+
import { AbstractRunner } from './abstract.runner.js';
|
|
2
|
+
export class GitRunner extends AbstractRunner {
|
|
6
3
|
constructor() {
|
|
7
4
|
super('git');
|
|
8
5
|
}
|
|
9
6
|
}
|
|
10
|
-
exports.GitRunner = GitRunner;
|
package/lib/runners/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './runner';
|
|
2
|
-
export * from './runner.factory';
|
|
3
|
-
export * from './abstract.runner';
|
|
1
|
+
export * from './runner.js';
|
|
2
|
+
export * from './runner.factory.js';
|
|
3
|
+
export * from './abstract.runner.js';
|
package/lib/runners/index.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./runner"), exports);
|
|
18
|
-
__exportStar(require("./runner.factory"), exports);
|
|
19
|
-
__exportStar(require("./abstract.runner"), exports);
|
|
1
|
+
export * from './runner.js';
|
|
2
|
+
export * from './runner.factory.js';
|
|
3
|
+
export * from './abstract.runner.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AbstractRunner } from './abstract.runner.js';
|
|
2
|
+
/**
|
|
3
|
+
* Runs the `mau` executable from `@nestjs/mau` through the current Node
|
|
4
|
+
* binary, mirroring how the schematics CLI is invoked.
|
|
5
|
+
*/
|
|
6
|
+
export declare class MauRunner extends AbstractRunner {
|
|
7
|
+
constructor(binaryPath: string);
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AbstractRunner } from './abstract.runner.js';
|
|
2
|
+
/**
|
|
3
|
+
* Runs the `mau` executable from `@nestjs/mau` through the current Node
|
|
4
|
+
* binary, mirroring how the schematics CLI is invoked.
|
|
5
|
+
*/
|
|
6
|
+
export class MauRunner extends AbstractRunner {
|
|
7
|
+
constructor(binaryPath) {
|
|
8
|
+
super('node', [`"${binaryPath}"`]);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.NpmRunner = void 0;
|
|
4
|
-
const abstract_runner_1 = require("./abstract.runner");
|
|
5
|
-
class NpmRunner extends abstract_runner_1.AbstractRunner {
|
|
1
|
+
import { AbstractRunner } from './abstract.runner.js';
|
|
2
|
+
export class NpmRunner extends AbstractRunner {
|
|
6
3
|
constructor() {
|
|
7
4
|
super('npm');
|
|
8
5
|
}
|
|
9
6
|
}
|
|
10
|
-
exports.NpmRunner = NpmRunner;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.PnpmRunner = void 0;
|
|
4
|
-
const abstract_runner_1 = require("./abstract.runner");
|
|
5
|
-
class PnpmRunner extends abstract_runner_1.AbstractRunner {
|
|
1
|
+
import { AbstractRunner } from './abstract.runner.js';
|
|
2
|
+
export class PnpmRunner extends AbstractRunner {
|
|
6
3
|
constructor() {
|
|
7
4
|
super('pnpm');
|
|
8
5
|
}
|
|
9
6
|
}
|
|
10
|
-
exports.PnpmRunner = PnpmRunner;
|
package/lib/runners/runner.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { NpmRunner } from './npm.runner';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { NpmRunner } from './npm.runner.js';
|
|
2
|
+
import { PnpmRunner } from './pnpm.runner.js';
|
|
3
|
+
import { Runner } from './runner.js';
|
|
4
|
+
import { SchematicRunner } from './schematic.runner.js';
|
|
5
|
+
import { YarnRunner } from './yarn.runner.js';
|
|
6
|
+
import { BunRunner } from './bun.runner.js';
|
|
6
7
|
export declare class RunnerFactory {
|
|
7
|
-
static create(runner: Runner): NpmRunner |
|
|
8
|
+
static create(runner: Runner): NpmRunner | PnpmRunner | SchematicRunner | YarnRunner | BunRunner;
|
|
8
9
|
}
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const yarn_runner_1 = require("./yarn.runner");
|
|
9
|
-
const pnpm_runner_1 = require("./pnpm.runner");
|
|
10
|
-
class RunnerFactory {
|
|
1
|
+
import { NpmRunner } from './npm.runner.js';
|
|
2
|
+
import { PnpmRunner } from './pnpm.runner.js';
|
|
3
|
+
import { Runner } from './runner.js';
|
|
4
|
+
import { SchematicRunner } from './schematic.runner.js';
|
|
5
|
+
import { YarnRunner } from './yarn.runner.js';
|
|
6
|
+
import { BunRunner } from './bun.runner.js';
|
|
7
|
+
export class RunnerFactory {
|
|
11
8
|
static create(runner) {
|
|
12
9
|
switch (runner) {
|
|
13
|
-
case
|
|
14
|
-
return new
|
|
15
|
-
case
|
|
16
|
-
return new
|
|
17
|
-
case
|
|
18
|
-
return new
|
|
19
|
-
case
|
|
20
|
-
return new
|
|
10
|
+
case Runner.SCHEMATIC:
|
|
11
|
+
return new SchematicRunner();
|
|
12
|
+
case Runner.NPM:
|
|
13
|
+
return new NpmRunner();
|
|
14
|
+
case Runner.YARN:
|
|
15
|
+
return new YarnRunner();
|
|
16
|
+
case Runner.PNPM:
|
|
17
|
+
return new PnpmRunner();
|
|
18
|
+
case Runner.BUN:
|
|
19
|
+
return new BunRunner();
|
|
21
20
|
default:
|
|
22
|
-
|
|
21
|
+
throw new Error(`Unsupported runner: ${runner}`);
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
|
-
exports.RunnerFactory = RunnerFactory;
|
package/lib/runners/runner.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Runner = void 0;
|
|
4
|
-
var Runner;
|
|
1
|
+
export var Runner;
|
|
5
2
|
(function (Runner) {
|
|
6
3
|
Runner[Runner["SCHEMATIC"] = 0] = "SCHEMATIC";
|
|
7
4
|
Runner[Runner["NPM"] = 1] = "NPM";
|
|
8
5
|
Runner[Runner["YARN"] = 2] = "YARN";
|
|
9
6
|
Runner[Runner["PNPM"] = 3] = "PNPM";
|
|
10
|
-
|
|
7
|
+
Runner[Runner["BUN"] = 4] = "BUN";
|
|
8
|
+
})(Runner || (Runner = {}));
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class SchematicRunner extends abstract_runner_1.AbstractRunner {
|
|
1
|
+
import { createRequire } from 'module';
|
|
2
|
+
import { AbstractRunner } from './abstract.runner.js';
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
export class SchematicRunner extends AbstractRunner {
|
|
6
5
|
constructor() {
|
|
7
6
|
super(`node`, [`"${SchematicRunner.findClosestSchematicsBinary()}"`]);
|
|
8
7
|
}
|
|
9
8
|
static getModulePaths() {
|
|
10
|
-
return
|
|
9
|
+
return require.resolve.paths('@angular-devkit/schematics-cli') ?? [];
|
|
11
10
|
}
|
|
12
11
|
static findClosestSchematicsBinary() {
|
|
13
12
|
try {
|
|
@@ -18,4 +17,3 @@ class SchematicRunner extends abstract_runner_1.AbstractRunner {
|
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
|
-
exports.SchematicRunner = SchematicRunner;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.YarnRunner = void 0;
|
|
4
|
-
const abstract_runner_1 = require("./abstract.runner");
|
|
5
|
-
class YarnRunner extends abstract_runner_1.AbstractRunner {
|
|
1
|
+
import { AbstractRunner } from './abstract.runner.js';
|
|
2
|
+
export class YarnRunner extends AbstractRunner {
|
|
6
3
|
constructor() {
|
|
7
4
|
super('yarn');
|
|
8
5
|
}
|
|
9
6
|
}
|
|
10
|
-
exports.YarnRunner = YarnRunner;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AbstractRunner } from '../runners';
|
|
2
|
-
import { Schematic } from './nest.collection';
|
|
3
|
-
import { SchematicOption } from './schematic.option';
|
|
1
|
+
import { AbstractRunner } from '../runners/index.js';
|
|
2
|
+
import { Schematic } from './nest.collection.js';
|
|
3
|
+
import { SchematicOption } from './schematic.option.js';
|
|
4
4
|
export declare abstract class AbstractCollection {
|
|
5
5
|
protected collection: string;
|
|
6
6
|
protected runner: AbstractRunner;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class AbstractCollection {
|
|
1
|
+
export class AbstractCollection {
|
|
2
|
+
collection;
|
|
3
|
+
runner;
|
|
5
4
|
constructor(collection, runner) {
|
|
6
5
|
this.collection = collection;
|
|
7
6
|
this.runner = runner;
|
|
@@ -20,4 +19,3 @@ class AbstractCollection {
|
|
|
20
19
|
}, '');
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
|
-
exports.AbstractCollection = AbstractCollection;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AbstractCollection } from './abstract.collection';
|
|
2
|
-
import { Collection } from './collection';
|
|
1
|
+
import { AbstractCollection } from './abstract.collection.js';
|
|
2
|
+
import { Collection } from './collection.js';
|
|
3
3
|
export declare class CollectionFactory {
|
|
4
4
|
static create(collection: Collection | string): AbstractCollection;
|
|
5
5
|
}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const custom_collection_1 = require("./custom.collection");
|
|
7
|
-
const nest_collection_1 = require("./nest.collection");
|
|
8
|
-
class CollectionFactory {
|
|
1
|
+
import { Runner, RunnerFactory } from '../runners/index.js';
|
|
2
|
+
import { Collection } from './collection.js';
|
|
3
|
+
import { CustomCollection } from './custom.collection.js';
|
|
4
|
+
import { NestCollection } from './nest.collection.js';
|
|
5
|
+
export class CollectionFactory {
|
|
9
6
|
static create(collection) {
|
|
10
|
-
const schematicRunner =
|
|
11
|
-
if (collection ===
|
|
12
|
-
return new
|
|
7
|
+
const schematicRunner = RunnerFactory.create(Runner.SCHEMATIC);
|
|
8
|
+
if (collection === Collection.NESTJS) {
|
|
9
|
+
return new NestCollection(schematicRunner);
|
|
13
10
|
}
|
|
14
11
|
else {
|
|
15
|
-
return new
|
|
12
|
+
return new CustomCollection(collection, schematicRunner);
|
|
16
13
|
}
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
|
-
exports.CollectionFactory = CollectionFactory;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Collection = void 0;
|
|
4
|
-
var Collection;
|
|
1
|
+
export var Collection;
|
|
5
2
|
(function (Collection) {
|
|
6
3
|
Collection["NESTJS"] = "@nestjs/schematics";
|
|
7
|
-
})(Collection || (
|
|
4
|
+
})(Collection || (Collection = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AbstractCollection } from './abstract.collection';
|
|
2
|
-
import { Schematic } from './nest.collection';
|
|
1
|
+
import { AbstractCollection } from './abstract.collection.js';
|
|
2
|
+
import { Schematic } from './nest.collection.js';
|
|
3
3
|
export interface CollectionSchematic {
|
|
4
4
|
schema: string;
|
|
5
5
|
description: string;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const tools_1 = require("@angular-devkit/schematics/tools");
|
|
5
|
-
const abstract_collection_1 = require("./abstract.collection");
|
|
6
|
-
class CustomCollection extends abstract_collection_1.AbstractCollection {
|
|
1
|
+
import { NodeWorkflow } from '@angular-devkit/schematics/tools/index.js';
|
|
2
|
+
import { AbstractCollection } from './abstract.collection.js';
|
|
3
|
+
export class CustomCollection extends AbstractCollection {
|
|
7
4
|
getSchematics() {
|
|
8
|
-
const workflow = new
|
|
5
|
+
const workflow = new NodeWorkflow(process.cwd(), {});
|
|
9
6
|
const collection = workflow.engine.createCollection(this.collection);
|
|
10
7
|
const collectionDescriptions = [
|
|
11
8
|
collection.description,
|
|
@@ -30,4 +27,3 @@ class CustomCollection extends abstract_collection_1.AbstractCollection {
|
|
|
30
27
|
return schematics.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
31
28
|
}
|
|
32
29
|
}
|
|
33
|
-
exports.CustomCollection = CustomCollection;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './collection';
|
|
2
|
-
export * from './collection.factory';
|
|
3
|
-
export * from './schematic.option';
|
|
4
|
-
export * from './abstract.collection';
|
|
1
|
+
export * from './collection.js';
|
|
2
|
+
export * from './collection.factory.js';
|
|
3
|
+
export * from './schematic.option.js';
|
|
4
|
+
export * from './abstract.collection.js';
|
package/lib/schematics/index.js
CHANGED
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./collection"), exports);
|
|
18
|
-
__exportStar(require("./collection.factory"), exports);
|
|
19
|
-
__exportStar(require("./schematic.option"), exports);
|
|
20
|
-
__exportStar(require("./abstract.collection"), exports);
|
|
1
|
+
export * from './collection.js';
|
|
2
|
+
export * from './collection.factory.js';
|
|
3
|
+
export * from './schematic.option.js';
|
|
4
|
+
export * from './abstract.collection.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AbstractRunner } from '../runners';
|
|
2
|
-
import { AbstractCollection } from './abstract.collection';
|
|
3
|
-
import { SchematicOption } from './schematic.option';
|
|
1
|
+
import { AbstractRunner } from '../runners/index.js';
|
|
2
|
+
import { AbstractCollection } from './abstract.collection.js';
|
|
3
|
+
import { SchematicOption } from './schematic.option.js';
|
|
4
4
|
export interface Schematic {
|
|
5
5
|
name: string;
|
|
6
6
|
alias: string;
|