@nx/web 18.2.2 → 18.3.0-beta.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/web",
3
- "version": "18.2.2",
3
+ "version": "18.3.0-beta.0",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Web Components contains generators for managing Web Component applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Cypress, and Storybook.\n\n- Scaffolding for creating buildable libraries that can be published to npm.\n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -34,9 +34,9 @@
34
34
  "detect-port": "^1.5.1",
35
35
  "http-server": "^14.1.0",
36
36
  "tslib": "^2.3.0",
37
- "@nx/devkit": "18.2.2",
38
- "@nx/js": "18.2.2",
39
- "@nrwl/web": "18.2.2"
37
+ "@nx/devkit": "18.3.0-beta.0",
38
+ "@nx/js": "18.3.0-beta.0",
39
+ "@nrwl/web": "18.3.0-beta.0"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public"
@@ -241,8 +241,8 @@ async function applicationGeneratorInternal(host, schema) {
241
241
  const cypressTask = await configurationGenerator(host, {
242
242
  ...options,
243
243
  project: options.e2eProjectName,
244
- devServerTarget: `${options.projectName}:serve`,
245
- baseUrl: 'http://localhost:4200',
244
+ devServerTarget: `${options.projectName}:${options.e2eWebServerTarget}`,
245
+ baseUrl: options.e2eWebServerAddress,
246
246
  directory: 'src',
247
247
  skipFormat: true,
248
248
  });
@@ -265,8 +265,8 @@ async function applicationGeneratorInternal(host, schema) {
265
265
  js: false,
266
266
  linter: options.linter,
267
267
  setParserOptionsProject: options.setParserOptionsProject,
268
- webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx serve ${options.name}`,
269
- webServerAddress: 'http://localhost:4200',
268
+ webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx ${options.e2eWebServerTarget} ${options.name}`,
269
+ webServerAddress: options.e2eWebServerAddress,
270
270
  addPlugin: options.addPlugin,
271
271
  });
272
272
  tasks.push(playwrightTask);
@@ -324,8 +324,35 @@ async function normalizeOptions(host, options) {
324
324
  const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
325
325
  nxJson.useInferencePlugins !== false;
326
326
  options.addPlugin ??= addPluginDefault;
327
+ let e2eWebServerTarget = 'serve';
328
+ if (options.addPlugin) {
329
+ if (nxJson.plugins) {
330
+ for (const plugin of nxJson.plugins) {
331
+ if (options.bundler === 'vite' &&
332
+ typeof plugin === 'object' &&
333
+ plugin.plugin === '@nx/vite/plugin' &&
334
+ plugin.options.serveTargetName) {
335
+ e2eWebServerTarget = plugin.options
336
+ .serveTargetName;
337
+ }
338
+ else if (options.bundler === 'webpack' &&
339
+ typeof plugin === 'object' &&
340
+ plugin.plugin === '@nx/webpack/plugin' &&
341
+ plugin.options.serveTargetName) {
342
+ e2eWebServerTarget = plugin.options
343
+ .serveTargetName;
344
+ }
345
+ }
346
+ }
347
+ }
348
+ let e2ePort = 4200;
349
+ if (nxJson.targetDefaults?.[e2eWebServerTarget] &&
350
+ nxJson.targetDefaults?.[e2eWebServerTarget].options?.port) {
351
+ e2ePort = nxJson.targetDefaults?.[e2eWebServerTarget].options?.port;
352
+ }
327
353
  const e2eProjectName = `${appProjectName}-e2e`;
328
354
  const e2eProjectRoot = `${appProjectRoot}-e2e`;
355
+ const e2eWebServerAddress = `http://localhost:${e2ePort}`;
329
356
  const npmScope = (0, get_npm_scope_1.getNpmScope)(host);
330
357
  const parsedTags = options.tags
331
358
  ? options.tags.split(',').map((s) => s.trim())
@@ -347,6 +374,9 @@ async function normalizeOptions(host, options) {
347
374
  appProjectRoot,
348
375
  e2eProjectRoot,
349
376
  e2eProjectName,
377
+ e2eWebServerAddress,
378
+ e2eWebServerTarget,
379
+ e2ePort,
350
380
  parsedTags,
351
381
  };
352
382
  }