@nestjs/cli 11.0.0-next.1 → 11.0.0-next.2
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/actions/build.action.js +23 -53
- package/commands/start.command.js +1 -0
- package/package.json +1 -1
package/actions/build.action.js
CHANGED
|
@@ -49,8 +49,7 @@ class BuildAction extends abstract_action_1.AbstractAction {
|
|
|
49
49
|
async runBuild(commandInputs, commandOptions, watchMode, watchAssetsMode, isDebugEnabled = false, onSuccess) {
|
|
50
50
|
const configFileName = commandOptions.find((option) => option.name === 'config').value;
|
|
51
51
|
const configuration = await this.loader.load(configFileName);
|
|
52
|
-
const buildAll = commandOptions.find((opt) => opt.name === 'all')
|
|
53
|
-
.value;
|
|
52
|
+
const buildAll = commandOptions.find((opt) => opt.name === 'all')?.value;
|
|
54
53
|
let appNames;
|
|
55
54
|
if (buildAll) {
|
|
56
55
|
// If the "all" flag is set, we need to build all projects in a monorepo.
|
|
@@ -85,82 +84,53 @@ class BuildAction extends abstract_action_1.AbstractAction {
|
|
|
85
84
|
}
|
|
86
85
|
switch (builder.type) {
|
|
87
86
|
case 'tsc':
|
|
88
|
-
await this.runTsc(watchMode, commandOptions, configuration, pathToTsconfig, appName);
|
|
87
|
+
await this.runTsc(watchMode, commandOptions, configuration, pathToTsconfig, appName, onSuccess);
|
|
89
88
|
break;
|
|
90
89
|
case 'webpack':
|
|
91
|
-
await this.runWebpack(configuration, appName, commandOptions, pathToTsconfig, isDebugEnabled, watchMode);
|
|
90
|
+
await this.runWebpack(configuration, appName, commandOptions, pathToTsconfig, isDebugEnabled, watchMode, onSuccess);
|
|
92
91
|
break;
|
|
93
92
|
case 'swc':
|
|
94
|
-
await this.runSwc(configuration, appName, pathToTsconfig, watchMode, commandOptions, tsOptions);
|
|
93
|
+
await this.runSwc(configuration, appName, pathToTsconfig, watchMode, commandOptions, tsOptions, onSuccess);
|
|
95
94
|
break;
|
|
96
95
|
}
|
|
97
96
|
}
|
|
98
|
-
onSuccess?.();
|
|
99
97
|
}
|
|
100
|
-
async runSwc(configuration, appName, pathToTsconfig, watchMode, options, tsOptions) {
|
|
98
|
+
async runSwc(configuration, appName, pathToTsconfig, watchMode, options, tsOptions, onSuccess) {
|
|
101
99
|
const { SwcCompiler } = await Promise.resolve().then(() => require('../lib/compiler/swc/swc-compiler'));
|
|
102
100
|
const swc = new SwcCompiler(this.pluginsLoader);
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
assetsManager: this.assetsManager,
|
|
110
|
-
}, onSuccess);
|
|
111
|
-
}
|
|
112
|
-
catch (error) {
|
|
113
|
-
onError(error);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
101
|
+
await swc.run(configuration, pathToTsconfig, appName, {
|
|
102
|
+
watch: watchMode,
|
|
103
|
+
typeCheck: (0, get_value_or_default_1.getValueOrDefault)(configuration, 'compilerOptions.typeCheck', appName, 'typeCheck', options),
|
|
104
|
+
tsOptions,
|
|
105
|
+
assetsManager: this.assetsManager,
|
|
106
|
+
}, onSuccess);
|
|
116
107
|
}
|
|
117
|
-
async runWebpack(configuration, appName, commandOptions, pathToTsconfig, debug, watchMode) {
|
|
108
|
+
async runWebpack(configuration, appName, commandOptions, pathToTsconfig, debug, watchMode, onSuccess) {
|
|
118
109
|
const { WebpackCompiler } = await Promise.resolve().then(() => require('../lib/compiler/webpack-compiler'));
|
|
119
110
|
const webpackCompiler = new WebpackCompiler(this.pluginsLoader);
|
|
120
111
|
const webpackPath = (0, get_webpack_config_path_1.getWebpackConfigPath)(configuration, commandOptions, appName) ??
|
|
121
112
|
defaults_1.defaultWebpackConfigFilename;
|
|
122
113
|
const webpackConfigFactoryOrConfig = this.getWebpackConfigFactoryByPath(webpackPath, defaults_1.defaultWebpackConfigFilename);
|
|
123
|
-
return
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
assetsManager: this.assetsManager,
|
|
131
|
-
}, onSuccess);
|
|
132
|
-
}
|
|
133
|
-
catch (error) {
|
|
134
|
-
onError(error);
|
|
135
|
-
}
|
|
136
|
-
});
|
|
114
|
+
return webpackCompiler.run(configuration, pathToTsconfig, appName, {
|
|
115
|
+
inputs: commandOptions,
|
|
116
|
+
webpackConfigFactoryOrConfig,
|
|
117
|
+
debug,
|
|
118
|
+
watchMode,
|
|
119
|
+
assetsManager: this.assetsManager,
|
|
120
|
+
}, onSuccess);
|
|
137
121
|
}
|
|
138
|
-
async runTsc(watchMode, options, configuration, pathToTsconfig, appName) {
|
|
122
|
+
async runTsc(watchMode, options, configuration, pathToTsconfig, appName, onSuccess) {
|
|
139
123
|
if (watchMode) {
|
|
140
124
|
const { WatchCompiler } = await Promise.resolve().then(() => require('../lib/compiler/watch-compiler'));
|
|
141
125
|
const watchCompiler = new WatchCompiler(this.pluginsLoader, this.tsConfigProvider, this.tsLoader);
|
|
142
126
|
const isPreserveWatchOutputEnabled = options.find((option) => option.name === 'preserveWatchOutput' && option.value === true)?.value;
|
|
143
|
-
|
|
144
|
-
try {
|
|
145
|
-
watchCompiler.run(configuration, pathToTsconfig, appName, { preserveWatchOutput: isPreserveWatchOutputEnabled }, onSuccess);
|
|
146
|
-
}
|
|
147
|
-
catch (error) {
|
|
148
|
-
onError(error);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
127
|
+
watchCompiler.run(configuration, pathToTsconfig, appName, { preserveWatchOutput: isPreserveWatchOutputEnabled }, onSuccess);
|
|
151
128
|
}
|
|
152
129
|
else {
|
|
153
130
|
const { Compiler } = await Promise.resolve().then(() => require('../lib/compiler/compiler'));
|
|
154
131
|
const compiler = new Compiler(this.pluginsLoader, this.tsConfigProvider, this.tsLoader);
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
compiler.run(configuration, pathToTsconfig, appName, undefined, onSuccess);
|
|
158
|
-
this.assetsManager.closeWatchers();
|
|
159
|
-
}
|
|
160
|
-
catch (error) {
|
|
161
|
-
onError(error);
|
|
162
|
-
}
|
|
163
|
-
});
|
|
132
|
+
compiler.run(configuration, pathToTsconfig, appName, undefined, onSuccess);
|
|
133
|
+
this.assetsManager.closeWatchers();
|
|
164
134
|
}
|
|
165
135
|
}
|
|
166
136
|
getWebpackConfigFactoryByPath(webpackPath, defaultPath) {
|
|
@@ -24,6 +24,7 @@ class StartCommand extends abstract_command_1.AbstractCommand {
|
|
|
24
24
|
.option('-e, --exec [binary]', 'Binary to run (default: "node").')
|
|
25
25
|
.option('--preserveWatchOutput', 'Use "preserveWatchOutput" option when using tsc watch mode.')
|
|
26
26
|
.option('--shell', "Spawn child processes within a shell (see node's child_process.spawn() method docs). Default: true.", true)
|
|
27
|
+
.option('--no-shell', 'Do not spawn child processes within a shell.')
|
|
27
28
|
.description('Run Nest application.')
|
|
28
29
|
.action(async (app, command) => {
|
|
29
30
|
const options = [];
|