Skip to content

Commit

Permalink
feat(core): @nx-dotnet/core:serve can be ran with --watch false (#210)
Browse files Browse the repository at this point in the history
Closes #151
  • Loading branch information
AgentEnder committed Oct 15, 2021
1 parent 2aad1ae commit 9fd60e4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/core/executors/serve.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ Uses `dotnet run` and chokidar to run a .NET app.
### verbosity

- (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.

### watch

- (boolean): Determines if the serve should watch files or just run the built packages
7 changes: 4 additions & 3 deletions packages/core/src/executors/serve/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ const runDotnetRun = async (
project: string,
options: ServeExecutorSchema,
) => {
const opts: dotnetRunOptions = Object.keys(options).map((x) => ({
const { watch, ...commandLineOptions } = options;
const opts: dotnetRunOptions = Object.keys(commandLineOptions).map((x) => ({
flag: x as dotnetRunFlags,
value: (options as Record<string, string | boolean>)[x],
value: (commandLineOptions as Record<string, string | boolean>)[x],
}));

childProcess = dotnetClient.run(project, true, opts);
childProcess = dotnetClient.run(project, watch, opts);
await handleChildProcessPassthrough(childProcess);
await rimraf(projectDirectory + '/bin');
await rimraf(projectDirectory + '/obj');
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/executors/serve/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ export interface ServeExecutorSchema {
| 'n'
| 'd'
| 'diag';
watch: boolean;
}
5 changes: 5 additions & 0 deletions packages/core/src/executors/serve/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
"d",
"diag"
]
},
"watch": {
"type": "boolean",
"description": "Determines if the serve should watch files or just run the built packages",
"default": true
}
},
"required": []
Expand Down

0 comments on commit 9fd60e4

Please sign in to comment.