Skip to content

Commit b923083

Browse files
committed
feat: support --preserveWatchOutput for 'build' command
1 parent ff52a06 commit b923083

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

actions/build.action.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ export class BuildAction extends AbstractAction {
186186
watchMode: boolean,
187187
onSuccess: (() => void) | undefined,
188188
) {
189-
const { WebpackCompiler } = await import('../lib/compiler/webpack-compiler')
189+
const { WebpackCompiler } = await import(
190+
'../lib/compiler/webpack-compiler'
191+
);
190192
const webpackCompiler = new WebpackCompiler(this.pluginsLoader);
191193

192194
const webpackPath =

commands/build.command.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ export class BuildCommand extends AbstractCommand {
1818
)
1919
.option('--type-check', 'Enable type checking (when SWC is used).')
2020
.option('--webpackPath [path]', 'Path to webpack configuration.')
21-
.option('--tsc', 'Use tsc for compilation.')
21+
.option('--tsc', 'Use typescript compiler for compilation.')
22+
.option(
23+
'--preserveWatchOutput',
24+
'Use "preserveWatchOutput" option when using tsc watch mode.',
25+
)
2226
.description('Build Nest application.')
2327
.action(async (app: string, command: Command) => {
2428
const options: Input[] = [];
@@ -67,6 +71,14 @@ export class BuildCommand extends AbstractCommand {
6771
value: command.typeCheck,
6872
});
6973

74+
options.push({
75+
name: 'preserveWatchOutput',
76+
value:
77+
!!command.preserveWatchOutput &&
78+
!!command.watch &&
79+
!isWebpackEnabled,
80+
});
81+
7082
const inputs: Input[] = [];
7183
inputs.push({ name: 'app', value: app });
7284
await this.action.handle(inputs, options);

commands/start.command.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class StartCommand extends AbstractCommand {
2323
)
2424
.option('--webpackPath [path]', 'Path to webpack configuration.')
2525
.option('--type-check', 'Enable type checking (when SWC is used).')
26-
.option('--tsc', 'Use tsc for compilation.')
26+
.option('--tsc', 'Use typescript compiler for compilation.')
2727
.option(
2828
'--sourceRoot [sourceRoot]',
2929
'Points at the root of the source code for the single project in standard mode structures, or the default project in monorepo mode structures.',
@@ -35,7 +35,7 @@ export class StartCommand extends AbstractCommand {
3535
.option('-e, --exec [binary]', 'Binary to run (default: "node").')
3636
.option(
3737
'--preserveWatchOutput',
38-
'Use "preserveWatchOutput" option when tsc watch mode.',
38+
'Use "preserveWatchOutput" option when using tsc watch mode.',
3939
)
4040
.description('Run Nest application.')
4141
.action(async (app: string, command: Command) => {

lib/schematics/abstract.collection.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { Schematic } from './nest.collection';
33
import { SchematicOption } from './schematic.option';
44

55
export abstract class AbstractCollection {
6-
constructor(protected collection: string, protected runner: AbstractRunner) {}
6+
constructor(
7+
protected collection: string,
8+
protected runner: AbstractRunner,
9+
) {}
710

811
public async execute(
912
name: string,

0 commit comments

Comments
 (0)