@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.
@@ -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
- return new Promise((onSuccess, onError) => {
104
- try {
105
- swc.run(configuration, pathToTsconfig, appName, {
106
- watch: watchMode,
107
- typeCheck: (0, get_value_or_default_1.getValueOrDefault)(configuration, 'compilerOptions.typeCheck', appName, 'typeCheck', options),
108
- tsOptions,
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 new Promise((onSuccess, onError) => {
124
- try {
125
- return webpackCompiler.run(configuration, pathToTsconfig, appName, {
126
- inputs: commandOptions,
127
- webpackConfigFactoryOrConfig,
128
- debug,
129
- watchMode,
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
- return new Promise((onSuccess, onError) => {
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
- return new Promise((onSuccess, onError) => {
156
- try {
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 = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/cli",
3
- "version": "11.0.0-next.1",
3
+ "version": "11.0.0-next.2",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@cli)",
5
5
  "publishConfig": {
6
6
  "access": "public"