Skip to content

Commit 7d3627a

Browse files
committed
feat(web): add parallel, maxParallel, with-deps to file-serve target
1 parent e9412d5 commit 7d3627a

File tree

5 files changed

+98
-1
lines changed

5 files changed

+98
-1
lines changed

docs/angular/api-web/builders/file-server.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ Type: `string`
2020

2121
Host to listen on.
2222

23+
### maxParallel
24+
25+
Type: `number`
26+
27+
Max number of parallel jobs
28+
29+
### parallel
30+
31+
Default: `true`
32+
33+
Type: `boolean`
34+
35+
Build the target in parallel
36+
2337
### port
2438

2539
Default: `4200`
@@ -53,3 +67,11 @@ SSL certificate to use for serving HTTPS.
5367
Type: `string`
5468

5569
SSL key to use for serving HTTPS.
70+
71+
### withDeps
72+
73+
Default: `true`
74+
75+
Type: `boolean`
76+
77+
Build the target and all its deps

docs/node/api-web/builders/file-server.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@ Type: `string`
2121

2222
Host to listen on.
2323

24+
### maxParallel
25+
26+
Type: `number`
27+
28+
Max number of parallel jobs
29+
30+
### parallel
31+
32+
Default: `true`
33+
34+
Type: `boolean`
35+
36+
Build the target in parallel
37+
2438
### port
2539

2640
Default: `4200`
@@ -54,3 +68,11 @@ SSL certificate to use for serving HTTPS.
5468
Type: `string`
5569

5670
SSL key to use for serving HTTPS.
71+
72+
### withDeps
73+
74+
Default: `true`
75+
76+
Type: `boolean`
77+
78+
Build the target and all its deps

docs/react/api-web/builders/file-server.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@ Type: `string`
2121

2222
Host to listen on.
2323

24+
### maxParallel
25+
26+
Type: `number`
27+
28+
Max number of parallel jobs
29+
30+
### parallel
31+
32+
Default: `true`
33+
34+
Type: `boolean`
35+
36+
Build the target in parallel
37+
2438
### port
2539

2640
Default: `4200`
@@ -54,3 +68,11 @@ SSL certificate to use for serving HTTPS.
5468
Type: `string`
5569

5670
SSL key to use for serving HTTPS.
71+
72+
### withDeps
73+
74+
Default: `true`
75+
76+
Type: `boolean`
77+
78+
Build the target and all its deps

packages/web/src/builders/file-server/file-server.impl.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ export interface FileServerOptions extends JsonObject {
1313
sslCert?: string;
1414
proxyUrl?: string;
1515
buildTarget: string;
16+
parallel: boolean;
17+
maxParalel: number;
18+
withDeps: boolean;
1619
}
1720

1821
function getHttpServerArgs(opts: FileServerOptions) {
@@ -38,6 +41,20 @@ function getHttpServerArgs(opts: FileServerOptions) {
3841
return args;
3942
}
4043

44+
function getBuildTargetCommand(opts: FileServerOptions) {
45+
const cmd = [`npx nx run ${opts.buildTarget}`];
46+
if (opts.withDeps) {
47+
cmd.push(`--with-deps`);
48+
}
49+
if (opts.parallel) {
50+
cmd.push(`--parallel`);
51+
}
52+
if (opts.maxParalel) {
53+
cmd.push(`--maxParallel=${opts.maxParalel}`);
54+
}
55+
return cmd.join(' ');
56+
}
57+
4158
function getBuildTargetOutputPath(
4259
opts: FileServerOptions,
4360
context: TargetContext
@@ -99,7 +116,7 @@ export default async function (
99116
changed = false;
100117
running = true;
101118
try {
102-
execSync(`npx nx run ${opts.buildTarget} --with-deps`, {
119+
execSync(getBuildTargetCommand(opts), {
103120
stdio: [0, 1, 2],
104121
});
105122
} catch (e) {}

packages/web/src/builders/file-server/schema.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@
88
"type": "string",
99
"description": "Target which builds the application"
1010
},
11+
"withDeps": {
12+
"type": "boolean",
13+
"description": "Build the target and all its deps",
14+
"default": true
15+
},
16+
"parallel": {
17+
"type": "boolean",
18+
"description": "Build the target in parallel",
19+
"default": true
20+
},
21+
"maxParallel": {
22+
"type": "number",
23+
"description": "Max number of parallel jobs"
24+
},
1125
"port": {
1226
"type": "number",
1327
"description": "Port to listen on.",

0 commit comments

Comments
 (0)