@nx/web 23.3.0-pr.37068.f95e11e → 23.3.0-pr.37224.268062c
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.
- package/README.md +1 -1
- package/dist/src/generators/application/application.js +23 -7
- package/dist/src/generators/application/files/app-webpack/webpack.config.js__tmpl__ +1 -1
- package/dist/src/generators/application/schema.d.ts +1 -0
- package/dist/src/generators/application/schema.json +4 -0
- package/dist/src/generators/static-serve/schema.json +4 -0
- package/dist/src/generators/static-serve/static-serve-configuration.d.ts +1 -0
- package/dist/src/generators/static-serve/static-serve-configuration.js +2 -0
- package/package.json +11 -11
- package/readme-template.md +18 -0
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
[](<>)
|
|
13
13
|
[](http://commitizen.github.io/cz-cli/)
|
|
14
14
|
[](https://go.nx.dev/community)
|
|
15
|
-
[](https://nx.dev/nx-cloud)
|
|
16
16
|
|
|
17
17
|
</div>
|
|
18
18
|
|
|
@@ -29,6 +29,7 @@ function createApplicationFiles(tree, options) {
|
|
|
29
29
|
tmpl: '',
|
|
30
30
|
offsetFromRoot: rootOffset,
|
|
31
31
|
rootTsConfigPath,
|
|
32
|
+
devServerPort: options.port ?? 4200,
|
|
32
33
|
webpackPluginOptions: (0, has_webpack_plugin_1.hasWebpackPlugin)(tree)
|
|
33
34
|
? {
|
|
34
35
|
compiler: options.compiler,
|
|
@@ -96,6 +97,12 @@ async function setupBundler(tree, options) {
|
|
|
96
97
|
addPlugin: options.addPlugin,
|
|
97
98
|
});
|
|
98
99
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
|
|
100
|
+
// Only when asked: @nx/webpack:dev-server already defaults to 4200.
|
|
101
|
+
if (options.port != null && project.targets?.serve) {
|
|
102
|
+
project.targets.serve.options ??= {};
|
|
103
|
+
project.targets.serve.options.port = options.port;
|
|
104
|
+
(0, devkit_1.updateProjectConfiguration)(tree, options.projectName, project);
|
|
105
|
+
}
|
|
99
106
|
if (project.targets?.build) {
|
|
100
107
|
const prodConfig = project.targets.build.configurations.production;
|
|
101
108
|
const buildOptions = project.targets.build.options;
|
|
@@ -261,6 +268,7 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
261
268
|
inSourceTests: options.inSourceTests,
|
|
262
269
|
skipFormat: true,
|
|
263
270
|
addPlugin: options.addPlugin,
|
|
271
|
+
port: options.port,
|
|
264
272
|
});
|
|
265
273
|
tasks.push(viteTask);
|
|
266
274
|
createOrEditViteConfig(host, {
|
|
@@ -268,6 +276,8 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
268
276
|
includeLib: false,
|
|
269
277
|
includeVitest: options.unitTestRunner === 'vitest',
|
|
270
278
|
inSourceTests: options.inSourceTests,
|
|
279
|
+
port: options.port,
|
|
280
|
+
previewPort: options.port,
|
|
271
281
|
useEsmExtension: true,
|
|
272
282
|
}, false);
|
|
273
283
|
}
|
|
@@ -313,26 +323,27 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
313
323
|
await (0, static_serve_configuration_1.default)(host, {
|
|
314
324
|
buildTarget: `${options.projectName}:build`,
|
|
315
325
|
spa: true,
|
|
326
|
+
port: options.port,
|
|
316
327
|
});
|
|
317
328
|
}
|
|
318
329
|
let e2eWebServerInfo = {
|
|
319
|
-
e2eWebServerAddress: `http://localhost
|
|
330
|
+
e2eWebServerAddress: `http://localhost:${options.port ?? 4200}`,
|
|
320
331
|
e2eWebServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx run ${options.projectName}:serve`,
|
|
321
332
|
e2eCiWebServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx run ${options.projectName}:serve-static`,
|
|
322
|
-
e2eCiBaseUrl: `http://localhost
|
|
333
|
+
e2eCiBaseUrl: `http://localhost:${options.port ?? 4200}`,
|
|
323
334
|
e2eDevServerTarget: `${options.projectName}:serve`,
|
|
324
335
|
};
|
|
325
336
|
if (options.bundler === 'webpack') {
|
|
326
337
|
const { getWebpackE2EWebServerInfo } = (0, devkit_1.ensurePackage)('@nx/webpack', versions_1.nxVersion);
|
|
327
338
|
e2eWebServerInfo = await getWebpackE2EWebServerInfo(host, options.projectName, (0, devkit_1.joinPathFragments)(options.appProjectRoot, `webpack.config.js`), options.addPlugin,
|
|
328
|
-
//
|
|
329
|
-
|
|
330
|
-
// is what lets targetDefaults still apply.
|
|
331
|
-
undefined);
|
|
339
|
+
// Undefined unless --port was passed, so targetDefaults still apply.
|
|
340
|
+
options.port);
|
|
332
341
|
}
|
|
333
342
|
else if (options.bundler === 'vite') {
|
|
334
343
|
const { getViteE2EWebServerInfo } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
|
|
335
|
-
e2eWebServerInfo = await getViteE2EWebServerInfo(host, options.projectName, (0, devkit_1.joinPathFragments)(options.appProjectRoot, `vite.config.ts`), options.addPlugin, 4200
|
|
344
|
+
e2eWebServerInfo = await getViteE2EWebServerInfo(host, options.projectName, (0, devkit_1.joinPathFragments)(options.appProjectRoot, `vite.config.ts`), options.addPlugin, options.port ?? 4200,
|
|
345
|
+
// An explicit port serves both dev and preview, as in @nx/react:app.
|
|
346
|
+
options.port);
|
|
336
347
|
}
|
|
337
348
|
if (options.e2eTestRunner === 'cypress') {
|
|
338
349
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
@@ -438,6 +449,11 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
438
449
|
target: 'es2016',
|
|
439
450
|
},
|
|
440
451
|
});
|
|
452
|
+
// @swc/core's postinstall only installs a wasm fallback for platforms not
|
|
453
|
+
// covered by its prebuilt optional dependencies, so skip it.
|
|
454
|
+
(0, internal_1.acknowledgeBuildScripts)(host, (0, devkit_1.detectPackageManager)(host.root), {
|
|
455
|
+
'@swc/core': false,
|
|
456
|
+
});
|
|
441
457
|
const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, {}, { '@swc/core': internal_2.swcCoreVersion, 'swc-loader': versions_1.swcLoaderVersion });
|
|
442
458
|
tasks.push(installTask);
|
|
443
459
|
}
|
|
@@ -114,6 +114,10 @@
|
|
|
114
114
|
"useProjectJson": {
|
|
115
115
|
"type": "boolean",
|
|
116
116
|
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
117
|
+
},
|
|
118
|
+
"port": {
|
|
119
|
+
"type": "number",
|
|
120
|
+
"description": "The port to use for the development server. Defaults to 4200."
|
|
117
121
|
}
|
|
118
122
|
},
|
|
119
123
|
"required": ["directory"],
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
"type": "boolean",
|
|
24
24
|
"description": "Whether to set the 'spa' flag on the generated target.",
|
|
25
25
|
"default": true
|
|
26
|
+
},
|
|
27
|
+
"port": {
|
|
28
|
+
"type": "number",
|
|
29
|
+
"description": "The port to serve on. Defaults to 4200."
|
|
26
30
|
}
|
|
27
31
|
},
|
|
28
32
|
"required": ["buildTarget"]
|
|
@@ -75,6 +75,8 @@ function addStaticConfig(tree, opts) {
|
|
|
75
75
|
buildTarget: opts.buildTarget,
|
|
76
76
|
staticFilePath: opts.outputPath,
|
|
77
77
|
spa: opts.spa,
|
|
78
|
+
// Only when asked: @nx/web:file-server already defaults to 4200.
|
|
79
|
+
...(opts.port != null ? { port: opts.port } : {}),
|
|
78
80
|
},
|
|
79
81
|
};
|
|
80
82
|
projectConfig.targets[opts.targetName] = staticServeOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/web",
|
|
3
|
-
"version": "23.3.0-pr.
|
|
3
|
+
"version": "23.3.0-pr.37224.268062c",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
@@ -79,20 +79,20 @@
|
|
|
79
79
|
"http-server": "^14.1.0",
|
|
80
80
|
"picocolors": "^1.1.0",
|
|
81
81
|
"tslib": "^2.3.0",
|
|
82
|
-
"@nx/
|
|
83
|
-
"@nx/
|
|
82
|
+
"@nx/devkit": "23.3.0-pr.37224.268062c",
|
|
83
|
+
"@nx/js": "23.3.0-pr.37224.268062c"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"
|
|
87
|
-
"nx": "23.3.0-pr.
|
|
86
|
+
"nx": "23.3.0-pr.37224.268062c",
|
|
87
|
+
"@nx/vitest": "23.3.0-pr.37224.268062c"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
|
-
"@nx/cypress": "23.3.0-pr.
|
|
91
|
-
"@nx/eslint": "23.3.0-pr.
|
|
92
|
-
"@nx/
|
|
93
|
-
"@nx/
|
|
94
|
-
"@nx/
|
|
95
|
-
"@nx/webpack": "23.3.0-pr.
|
|
90
|
+
"@nx/cypress": "23.3.0-pr.37224.268062c",
|
|
91
|
+
"@nx/eslint": "23.3.0-pr.37224.268062c",
|
|
92
|
+
"@nx/jest": "23.3.0-pr.37224.268062c",
|
|
93
|
+
"@nx/playwright": "23.3.0-pr.37224.268062c",
|
|
94
|
+
"@nx/vite": "23.3.0-pr.37224.268062c",
|
|
95
|
+
"@nx/webpack": "23.3.0-pr.37224.268062c"
|
|
96
96
|
},
|
|
97
97
|
"peerDependenciesMeta": {
|
|
98
98
|
"@nx/cypress": {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<p style="text-align: center;">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
|
|
4
|
+
<img alt="Nx - Smart Monorepos · Fast Builds" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
{{links}}
|
|
9
|
+
|
|
10
|
+
<hr>
|
|
11
|
+
|
|
12
|
+
# Nx: Smart Monorepos · Fast Builds
|
|
13
|
+
|
|
14
|
+
Get to green PRs in half the time. Nx optimizes your builds, scales your CI, and fixes failed PRs. Built for developers and AI agents.
|
|
15
|
+
|
|
16
|
+
This package is a [Web plugin for Nx](https://nx.dev/nx-api/web).
|
|
17
|
+
|
|
18
|
+
{{content}}
|