Skip to content

Commit 9fd60e4

Browse files
committed
feat(core): @nx-dotnet/core:serve can be ran with --watch false (#210)
Closes #151
1 parent 2aad1ae commit 9fd60e4

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

docs/core/executors/serve.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@ Uses `dotnet run` and chokidar to run a .NET app.
3333
### verbosity
3434

3535
- (string): Sets the verbosity level of the command. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]. The default value is m. Available since .NET Core 2.1 SDK.
36+
37+
### watch
38+
39+
- (boolean): Determines if the serve should watch files or just run the built packages

packages/core/src/executors/serve/executor.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ const runDotnetRun = async (
4141
project: string,
4242
options: ServeExecutorSchema,
4343
) => {
44-
const opts: dotnetRunOptions = Object.keys(options).map((x) => ({
44+
const { watch, ...commandLineOptions } = options;
45+
const opts: dotnetRunOptions = Object.keys(commandLineOptions).map((x) => ({
4546
flag: x as dotnetRunFlags,
46-
value: (options as Record<string, string | boolean>)[x],
47+
value: (commandLineOptions as Record<string, string | boolean>)[x],
4748
}));
4849

49-
childProcess = dotnetClient.run(project, true, opts);
50+
childProcess = dotnetClient.run(project, watch, opts);
5051
await handleChildProcessPassthrough(childProcess);
5152
await rimraf(projectDirectory + '/bin');
5253
await rimraf(projectDirectory + '/obj');

packages/core/src/executors/serve/schema.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ export interface ServeExecutorSchema {
1616
| 'n'
1717
| 'd'
1818
| 'diag';
19+
watch: boolean;
1920
}

packages/core/src/executors/serve/schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@
4545
"d",
4646
"diag"
4747
]
48+
},
49+
"watch": {
50+
"type": "boolean",
51+
"description": "Determines if the serve should watch files or just run the built packages",
52+
"default": true
4853
}
4954
},
5055
"required": []

0 commit comments

Comments
 (0)