@nx/web 17.2.0-beta.9 → 17.2.0-canary.20231207-b8d24e6

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": "17.2.0-beta.9",
3
+ "version": "17.2.0-canary.20231207-b8d24e6",
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": "17.2.0-beta.9",
38
- "@nx/js": "17.2.0-beta.9",
39
- "@nrwl/web": "17.2.0-beta.9"
37
+ "@nx/devkit": "17.2.0-canary.20231207-b8d24e6",
38
+ "@nx/js": "17.2.0-canary.20231207-b8d24e6",
39
+ "@nrwl/web": "17.2.0-canary.20231207-b8d24e6"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public"
@@ -9,6 +9,7 @@ const path_1 = require("path");
9
9
  const package_json_1 = require("nx/src/utils/package-json");
10
10
  const detectPort = require("detect-port");
11
11
  const client_1 = require("nx/src/daemon/client/client");
12
+ const utils_1 = require("nx/src/tasks-runner/utils");
12
13
  // platform specific command name
13
14
  const pmCmd = (0, os_1.platform)() === 'win32' ? `npx.cmd` : 'npx';
14
15
  function getHttpServerArgs(options) {
@@ -44,8 +45,15 @@ function getHttpServerArgs(options) {
44
45
  }
45
46
  return args;
46
47
  }
47
- function getBuildTargetCommand(options) {
48
- const cmd = ['nx', 'run', options.buildTarget];
48
+ function getBuildTargetCommand(options, context) {
49
+ const target = (0, devkit_1.parseTargetString)(options.buildTarget, context);
50
+ const cmd = ['nx', 'run'];
51
+ if (target.configuration) {
52
+ cmd.push(`${target.project}:${target.target}:${target.configuration}`);
53
+ }
54
+ else {
55
+ cmd.push(`${target.project}:${target.target}`);
56
+ }
49
57
  if (options.parallel) {
50
58
  cmd.push(`--parallel`);
51
59
  }
@@ -58,16 +66,27 @@ function getBuildTargetOutputPath(options, context) {
58
66
  if (options.staticFilePath) {
59
67
  return options.staticFilePath;
60
68
  }
61
- let buildOptions;
69
+ let outputPath;
62
70
  try {
63
71
  const target = (0, devkit_1.parseTargetString)(options.buildTarget, context);
64
- buildOptions = (0, devkit_1.readTargetOptions)(target, context);
72
+ const buildOptions = (0, devkit_1.readTargetOptions)(target, context);
73
+ if (buildOptions?.outputPath) {
74
+ outputPath = buildOptions.outputPath;
75
+ }
76
+ else {
77
+ const project = context.projectGraph.nodes[context.projectName];
78
+ const buildTarget = project.data.targets[target.target];
79
+ outputPath = buildTarget.outputs?.[0];
80
+ if (outputPath)
81
+ outputPath = (0, utils_1.interpolate)(outputPath, {
82
+ projectName: project.data.name,
83
+ projectRoot: project.data.root,
84
+ });
85
+ }
65
86
  }
66
87
  catch (e) {
67
88
  throw new Error(`Invalid buildTarget: ${options.buildTarget}`);
68
89
  }
69
- // TODO: vsavkin we should also check outputs
70
- const outputPath = buildOptions.outputPath;
71
90
  if (!outputPath) {
72
91
  throw new Error(`Unable to get the outputPath from buildTarget ${options.buildTarget}. Make sure ${options.buildTarget} has an outputPath property or manually provide an staticFilePath property`);
73
92
  }
@@ -104,7 +123,7 @@ async function* fileServerExecutor(options, context) {
104
123
  if (!running) {
105
124
  running = true;
106
125
  try {
107
- const args = getBuildTargetCommand(options);
126
+ const args = getBuildTargetCommand(options, context);
108
127
  (0, child_process_1.execFileSync)(pmCmd, args, {
109
128
  stdio: [0, 1, 2],
110
129
  });
@@ -13,7 +13,7 @@ async function addDroppedDependencies(tree) {
13
13
  for (const [_, projectConfiguration] of projects) {
14
14
  for (const [_, targetConfiguration] of Object.entries(projectConfiguration.targets ?? {})) {
15
15
  for (const droppedDependency of droppedDependencies) {
16
- if (targetConfiguration.executor?.startsWith(droppedDependency + ':')) {
16
+ if (targetConfiguration?.['executor']?.startsWith(droppedDependency + ':')) {
17
17
  devDependencies[droppedDependency] = devkit_1.NX_VERSION;
18
18
  }
19
19
  }
@@ -22,7 +22,7 @@ async function addDroppedDependencies(tree) {
22
22
  const nxJson = (0, devkit_1.readNxJson)(tree);
23
23
  for (const [_, targetConfiguration] of Object.entries(nxJson?.targetDefaults ?? {})) {
24
24
  for (const droppedDependency of droppedDependencies) {
25
- if (targetConfiguration.executor?.startsWith(droppedDependency + ':')) {
25
+ if (targetConfiguration?.['executor']?.startsWith(droppedDependency + ':')) {
26
26
  devDependencies[droppedDependency] = devkit_1.NX_VERSION;
27
27
  }
28
28
  }