@depup/nestjs__cli 11.0.24-depup.7 → 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 +7 -15
- 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 +9 -41
- 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 +70 -83
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AbstractCommand } from './abstract.command';
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { AbstractCommand } from './abstract.command.js';
|
|
3
3
|
export declare class InfoCommand extends AbstractCommand {
|
|
4
|
-
load(program:
|
|
4
|
+
load(program: Command): void;
|
|
5
5
|
}
|
package/commands/info.command.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const extra_args_warning_1 = require("../lib/utils/extra-args-warning");
|
|
5
|
-
const abstract_command_1 = require("./abstract.command");
|
|
6
|
-
class InfoCommand extends abstract_command_1.AbstractCommand {
|
|
1
|
+
import { exitIfExtraArgs } from '../lib/utils/extra-args-warning.js';
|
|
2
|
+
import { AbstractCommand } from './abstract.command.js';
|
|
3
|
+
export class InfoCommand extends AbstractCommand {
|
|
7
4
|
load(program) {
|
|
8
5
|
program
|
|
9
6
|
.command('info')
|
|
10
7
|
.alias('i')
|
|
11
8
|
.description('Display Nest project details.')
|
|
12
9
|
.action(async (command) => {
|
|
13
|
-
|
|
10
|
+
exitIfExtraArgs(command, 0);
|
|
14
11
|
await this.action.handle();
|
|
15
12
|
});
|
|
16
13
|
}
|
|
17
14
|
}
|
|
18
|
-
exports.InfoCommand = InfoCommand;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AbstractCommand } from './abstract.command';
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { AbstractCommand } from './abstract.command.js';
|
|
3
3
|
export declare class NewCommand extends AbstractCommand {
|
|
4
|
-
load(program:
|
|
4
|
+
load(program: Command): void;
|
|
5
5
|
}
|
package/commands/new.command.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const schematics_1 = require("../lib/schematics");
|
|
5
|
-
const extra_args_warning_1 = require("../lib/utils/extra-args-warning");
|
|
6
|
-
const abstract_command_1 = require("./abstract.command");
|
|
7
|
-
class NewCommand extends abstract_command_1.AbstractCommand {
|
|
1
|
+
import { Collection } from '../lib/schematics/index.js';
|
|
2
|
+
import { AbstractCommand } from './abstract.command.js';
|
|
3
|
+
export class NewCommand extends AbstractCommand {
|
|
8
4
|
load(program) {
|
|
9
5
|
program
|
|
10
6
|
.command('new [name]')
|
|
@@ -16,48 +12,50 @@ class NewCommand extends abstract_command_1.AbstractCommand {
|
|
|
16
12
|
.option('-s, --skip-install', 'Skip package installation.', false)
|
|
17
13
|
.option('-p, --package-manager [packageManager]', 'Specify package manager.')
|
|
18
14
|
.option('-l, --language [language]', 'Programming language to be used (TypeScript or JavaScript)', 'TypeScript')
|
|
19
|
-
.option('-c, --collection [collectionName]', 'Schematics collection to use',
|
|
20
|
-
.option('--strict', 'Enables strict mode in TypeScript.',
|
|
21
|
-
.
|
|
22
|
-
(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
options.push({ name: 'skip-git', value: command.skipGit });
|
|
27
|
-
options.push({ name: 'skip-install', value: command.skipInstall });
|
|
28
|
-
options.push({ name: 'strict', value: command.strict });
|
|
29
|
-
options.push({
|
|
30
|
-
name: 'packageManager',
|
|
31
|
-
value: command.packageManager,
|
|
32
|
-
});
|
|
33
|
-
options.push({ name: 'collection', value: command.collection });
|
|
15
|
+
.option('-c, --collection [collectionName]', 'Schematics collection to use', Collection.NESTJS)
|
|
16
|
+
.option('--strict', 'Enables strict mode in TypeScript.', true)
|
|
17
|
+
.option('-t, --skip-tests', 'Do not generate testing files for the new project.', false)
|
|
18
|
+
.option('--format', 'Format generated files using Prettier.', false)
|
|
19
|
+
.option('--observe', 'Auto-configure observability with @nestjs/observe.')
|
|
20
|
+
.option('--no-observe', 'Skip observability setup without being prompted for it.')
|
|
21
|
+
.action(async (name, options) => {
|
|
34
22
|
const availableLanguages = ['js', 'ts', 'javascript', 'typescript'];
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
let language = options.language;
|
|
24
|
+
if (language) {
|
|
25
|
+
const lowercasedLanguage = language.toLowerCase();
|
|
37
26
|
const langMatch = availableLanguages.includes(lowercasedLanguage);
|
|
38
27
|
if (!langMatch) {
|
|
39
|
-
throw new Error(`Invalid language "${
|
|
28
|
+
throw new Error(`Invalid language "${language}" selected. Available languages are "typescript" or "javascript"`);
|
|
40
29
|
}
|
|
41
30
|
switch (lowercasedLanguage) {
|
|
42
31
|
case 'javascript':
|
|
43
|
-
|
|
32
|
+
language = 'js';
|
|
44
33
|
break;
|
|
45
34
|
case 'typescript':
|
|
46
|
-
|
|
35
|
+
language = 'ts';
|
|
47
36
|
break;
|
|
48
37
|
default:
|
|
49
|
-
|
|
38
|
+
language = lowercasedLanguage;
|
|
50
39
|
break;
|
|
51
40
|
}
|
|
52
41
|
}
|
|
53
|
-
|
|
54
|
-
name
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
42
|
+
const context = {
|
|
43
|
+
name,
|
|
44
|
+
directory: options.directory,
|
|
45
|
+
dryRun: options.dryRun,
|
|
46
|
+
skipGit: options.skipGit,
|
|
47
|
+
skipInstall: options.skipInstall,
|
|
48
|
+
skipTests: options.skipTests,
|
|
49
|
+
packageManager: options.packageManager,
|
|
50
|
+
language,
|
|
51
|
+
collection: options.collection,
|
|
52
|
+
strict: options.strict,
|
|
53
|
+
format: options.format === true,
|
|
54
|
+
// Stays undefined unless a flag was given, which is what tells the
|
|
55
|
+
// action to prompt instead of assuming an answer.
|
|
56
|
+
observe: options.observe,
|
|
57
|
+
};
|
|
58
|
+
await this.action.handle(context);
|
|
60
59
|
});
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
|
-
exports.NewCommand = NewCommand;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AbstractCommand } from './abstract.command';
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { AbstractCommand } from './abstract.command.js';
|
|
3
3
|
export declare class StartCommand extends AbstractCommand {
|
|
4
|
-
load(program:
|
|
4
|
+
load(program: Command): void;
|
|
5
5
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const remaining_flags_1 = require("../lib/utils/remaining-flags");
|
|
6
|
-
const abstract_command_1 = require("./abstract.command");
|
|
7
|
-
class StartCommand extends abstract_command_1.AbstractCommand {
|
|
1
|
+
import { ERROR_PREFIX } from '../lib/ui/index.js';
|
|
2
|
+
import { getRemainingFlags } from '../lib/utils/remaining-flags.js';
|
|
3
|
+
import { AbstractCommand } from './abstract.command.js';
|
|
4
|
+
export class StartCommand extends AbstractCommand {
|
|
8
5
|
load(program) {
|
|
9
6
|
const collect = (value, previous) => {
|
|
10
7
|
return previous.concat([value]);
|
|
@@ -12,15 +9,22 @@ class StartCommand extends abstract_command_1.AbstractCommand {
|
|
|
12
9
|
program
|
|
13
10
|
.command('start [app]')
|
|
14
11
|
.allowUnknownOption()
|
|
12
|
+
// Unknown options are collected into `args`, which commander otherwise
|
|
13
|
+
// rejects as excess arguments once an app name is also present.
|
|
14
|
+
.allowExcessArguments()
|
|
15
15
|
.option('-c, --config [path]', 'Path to nest-cli configuration file.')
|
|
16
16
|
.option('-p, --path [path]', 'Path to tsconfig file.')
|
|
17
17
|
.option('-w, --watch', 'Run in watch mode (live-reload).')
|
|
18
|
-
.option('-b, --builder [name]', 'Builder to be used (tsc, webpack, swc).')
|
|
18
|
+
.option('-b, --builder [name]', 'Builder to be used (tsc, webpack, swc, rspack).')
|
|
19
19
|
.option('--watchAssets', 'Watch non-ts (e.g., .graphql) files mode.')
|
|
20
20
|
.option('-d, --debug [hostport] ', 'Run in debug mode (with --inspect flag).')
|
|
21
21
|
.option('--webpack', 'Use webpack for compilation (deprecated option, use --builder instead).')
|
|
22
22
|
.option('--webpackPath [path]', 'Path to webpack configuration.')
|
|
23
|
-
.option('--
|
|
23
|
+
.option('--rspackPath [path]', 'Path to rspack configuration.')
|
|
24
|
+
.option('--type-check', 'Enable type checking (when SWC is used).', () => true)
|
|
25
|
+
.option('--no-type-check', 'Disable type checking (when SWC is used).', () => false)
|
|
26
|
+
.option('--emit-declarations', 'Emit declaration files (.d.ts) when using SWC builder.')
|
|
27
|
+
.option('--silent', 'Suppress informational compiler logs.')
|
|
24
28
|
.option('--tsc', 'Use typescript compiler for compilation.')
|
|
25
29
|
.option('--sourceRoot [sourceRoot]', 'Points at the root of the source code for the single project in standard mode structures, or the default project in monorepo mode structures.')
|
|
26
30
|
.option('--entryFile [entryFile]', "Path to the entry file where this command will work with. Defaults to the one defined at your Nest's CLI config file.")
|
|
@@ -30,75 +34,46 @@ class StartCommand extends abstract_command_1.AbstractCommand {
|
|
|
30
34
|
.option('--no-shell', 'Do not spawn child processes within a shell.')
|
|
31
35
|
.option('--env-file [path]', 'Path to an env file (.env) to be loaded into the environment.', collect, [])
|
|
32
36
|
.description('Run Nest application.')
|
|
33
|
-
.action(async (app,
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
options.push({ name: 'webpack', value: isWebpackEnabled });
|
|
41
|
-
options.push({ name: 'debug', value: command.debug });
|
|
42
|
-
options.push({ name: 'watch', value: !!command.watch });
|
|
43
|
-
options.push({ name: 'watchAssets', value: !!command.watchAssets });
|
|
44
|
-
options.push({
|
|
45
|
-
name: 'path',
|
|
46
|
-
value: command.path,
|
|
47
|
-
});
|
|
48
|
-
options.push({
|
|
49
|
-
name: 'webpackPath',
|
|
50
|
-
value: command.webpackPath,
|
|
51
|
-
});
|
|
52
|
-
options.push({
|
|
53
|
-
name: 'exec',
|
|
54
|
-
value: command.exec,
|
|
55
|
-
});
|
|
56
|
-
options.push({
|
|
57
|
-
name: 'sourceRoot',
|
|
58
|
-
value: command.sourceRoot,
|
|
59
|
-
});
|
|
60
|
-
options.push({
|
|
61
|
-
name: 'entryFile',
|
|
62
|
-
value: command.entryFile,
|
|
63
|
-
});
|
|
64
|
-
options.push({
|
|
65
|
-
name: 'preserveWatchOutput',
|
|
66
|
-
value: !!command.preserveWatchOutput &&
|
|
67
|
-
!!command.watch &&
|
|
68
|
-
!isWebpackEnabled,
|
|
69
|
-
});
|
|
70
|
-
options.push({
|
|
71
|
-
name: 'shell',
|
|
72
|
-
value: !!command.shell,
|
|
73
|
-
});
|
|
74
|
-
options.push({
|
|
75
|
-
name: 'envFile',
|
|
76
|
-
value: command.envFile,
|
|
77
|
-
});
|
|
78
|
-
const availableBuilders = ['tsc', 'webpack', 'swc'];
|
|
79
|
-
if (command.builder && !availableBuilders.includes(command.builder)) {
|
|
80
|
-
console.error(ui_1.ERROR_PREFIX +
|
|
81
|
-
` Invalid builder option: ${command.builder}. Available builders: ${availableBuilders.join(', ')}`);
|
|
82
|
-
return;
|
|
37
|
+
.action(async (app, options) => {
|
|
38
|
+
const isWebpackEnabled = options.tsc ? false : options.webpack;
|
|
39
|
+
const availableBuilders = ['tsc', 'webpack', 'swc', 'rspack'];
|
|
40
|
+
if (options.builder && !availableBuilders.includes(options.builder)) {
|
|
41
|
+
console.error(ERROR_PREFIX +
|
|
42
|
+
` Invalid builder option: ${options.builder}. Available builders: ${availableBuilders.join(', ')}`);
|
|
43
|
+
process.exit(1);
|
|
83
44
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
45
|
+
const context = {
|
|
46
|
+
app,
|
|
47
|
+
config: options.config,
|
|
48
|
+
webpack: isWebpackEnabled,
|
|
49
|
+
watch: !!options.watch,
|
|
50
|
+
watchAssets: !!options.watchAssets,
|
|
51
|
+
path: options.path,
|
|
52
|
+
webpackPath: options.webpackPath,
|
|
53
|
+
rspackPath: options.rspackPath,
|
|
54
|
+
builder: options.builder,
|
|
55
|
+
typeCheck: options.typeCheck,
|
|
56
|
+
// Left undefined when the flag is absent so `getValueOrDefault` can
|
|
57
|
+
// still fall through to `compilerOptions.emitDeclarations`.
|
|
58
|
+
emitDeclarations: options.emitDeclarations,
|
|
59
|
+
silent: !!options.silent,
|
|
60
|
+
preserveWatchOutput: !!options.preserveWatchOutput &&
|
|
61
|
+
!!options.watch &&
|
|
62
|
+
!isWebpackEnabled,
|
|
63
|
+
debug: options.debug,
|
|
64
|
+
exec: options.exec,
|
|
65
|
+
sourceRoot: options.sourceRoot,
|
|
66
|
+
entryFile: options.entryFile,
|
|
67
|
+
shell: !!options.shell,
|
|
68
|
+
envFile: options.envFile ?? [],
|
|
69
|
+
extraFlags: getRemainingFlags(program),
|
|
70
|
+
};
|
|
95
71
|
try {
|
|
96
|
-
await this.action.handle(
|
|
72
|
+
await this.action.handle(context);
|
|
97
73
|
}
|
|
98
|
-
catch
|
|
74
|
+
catch {
|
|
99
75
|
process.exit(1);
|
|
100
76
|
}
|
|
101
77
|
});
|
|
102
78
|
}
|
|
103
79
|
}
|
|
104
|
-
exports.StartCommand = StartCommand;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AbstractCommand } from './abstract.command.js';
|
|
2
|
+
export class UpgradeCommand extends AbstractCommand {
|
|
3
|
+
load(program) {
|
|
4
|
+
program
|
|
5
|
+
.command('upgrade')
|
|
6
|
+
.alias('update')
|
|
7
|
+
.description('Upgrade your project to the latest NestJS major version.')
|
|
8
|
+
.option('-d, --dry-run', 'Report actions that would be performed without writing out results.')
|
|
9
|
+
.option('-s, --skip-install', 'Skip package installation.', false)
|
|
10
|
+
.option('--observe', 'Set up @nestjs/observe (skips the prompt).')
|
|
11
|
+
.option('--no-observe', 'Do not set up @nestjs/observe (skips the prompt).')
|
|
12
|
+
.option('-t, --tag [tag]', 'Use an npm dist-tag (e.g. "next") instead of the default version ranges.')
|
|
13
|
+
.option('-c, --collection [collectionName]', 'Schematics collection to use.')
|
|
14
|
+
.action(async (options) => {
|
|
15
|
+
const context = {
|
|
16
|
+
dryRun: !!options.dryRun,
|
|
17
|
+
skipInstall: options.skipInstall,
|
|
18
|
+
// Stays `undefined` when neither --observe nor --no-observe was
|
|
19
|
+
// given so the schematic can prompt for it.
|
|
20
|
+
observe: options.observe,
|
|
21
|
+
tag: options.tag,
|
|
22
|
+
collection: options.collection,
|
|
23
|
+
};
|
|
24
|
+
try {
|
|
25
|
+
await this.action.handle(context);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
import { Configuration } from '../configuration';
|
|
1
|
+
import { Configuration } from '../configuration/index.js';
|
|
2
2
|
export declare class AssetsManager {
|
|
3
3
|
private watchAssetsKeyValue;
|
|
4
4
|
private watchers;
|
|
5
|
-
private
|
|
5
|
+
private watcherReadyPromises;
|
|
6
6
|
/**
|
|
7
|
-
* Using on `nest build` to close file watch or the build process will not end
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Using on `nest build` to close file watch or the build process will not end.
|
|
8
|
+
* Waits for all watchers to complete their initial scan before closing them,
|
|
9
|
+
* ensuring all assets are copied regardless of system speed.
|
|
10
|
+
*
|
|
11
|
+
* Returns a Promise that resolves once every watcher has been closed.
|
|
12
|
+
* Callers (e.g. `build.action.ts`, `swc-compiler.ts`) `await` this method,
|
|
13
|
+
* so it must surface the underlying close work — otherwise `await` resolves
|
|
14
|
+
* immediately while file watchers stay open and the build process can race
|
|
15
|
+
* its own exit, leaving handles dangling.
|
|
11
16
|
*/
|
|
12
|
-
closeWatchers(): void
|
|
13
|
-
copyAssets(configuration: Required<Configuration>, appName: string | undefined, outDir: string, watchAssetsMode: boolean): void;
|
|
17
|
+
closeWatchers(): Promise<void>;
|
|
18
|
+
copyAssets(configuration: Required<Configuration>, appName: string | undefined, outDir: string, watchAssetsMode: boolean, onSuccess?: () => void, rootDir?: string): void;
|
|
19
|
+
private collectLibraryAssets;
|
|
20
|
+
/**
|
|
21
|
+
* Runs `actionOnFile` from a watcher callback. A rejected destination must not
|
|
22
|
+
* escalate into an uncaught exception: chokidar emits synchronously, so a
|
|
23
|
+
* throw here would tear down the whole watch session.
|
|
24
|
+
*/
|
|
25
|
+
private safeActionOnFile;
|
|
14
26
|
private actionOnFile;
|
|
15
27
|
}
|