nx 19.4.0-canary.20240627-c2c6a13 → 19.4.0-rc.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",
3
- "version": "19.4.0-canary.20240627-c2c6a13",
3
+ "version": "19.4.0-rc.0",
4
4
  "private": false,
5
5
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
6
6
  "repository": {
@@ -70,7 +70,7 @@
70
70
  "yargs-parser": "21.1.1",
71
71
  "node-machine-id": "1.1.12",
72
72
  "ora": "5.3.0",
73
- "@nrwl/tao": "19.4.0-canary.20240627-c2c6a13"
73
+ "@nrwl/tao": "19.4.0-rc.0"
74
74
  },
75
75
  "peerDependencies": {
76
76
  "@swc-node/register": "^1.8.0",
@@ -85,16 +85,16 @@
85
85
  }
86
86
  },
87
87
  "optionalDependencies": {
88
- "@nx/nx-darwin-x64": "19.4.0-canary.20240627-c2c6a13",
89
- "@nx/nx-darwin-arm64": "19.4.0-canary.20240627-c2c6a13",
90
- "@nx/nx-linux-x64-gnu": "19.4.0-canary.20240627-c2c6a13",
91
- "@nx/nx-linux-x64-musl": "19.4.0-canary.20240627-c2c6a13",
92
- "@nx/nx-win32-x64-msvc": "19.4.0-canary.20240627-c2c6a13",
93
- "@nx/nx-linux-arm64-gnu": "19.4.0-canary.20240627-c2c6a13",
94
- "@nx/nx-linux-arm64-musl": "19.4.0-canary.20240627-c2c6a13",
95
- "@nx/nx-linux-arm-gnueabihf": "19.4.0-canary.20240627-c2c6a13",
96
- "@nx/nx-win32-arm64-msvc": "19.4.0-canary.20240627-c2c6a13",
97
- "@nx/nx-freebsd-x64": "19.4.0-canary.20240627-c2c6a13"
88
+ "@nx/nx-darwin-x64": "19.4.0-rc.0",
89
+ "@nx/nx-darwin-arm64": "19.4.0-rc.0",
90
+ "@nx/nx-linux-x64-gnu": "19.4.0-rc.0",
91
+ "@nx/nx-linux-x64-musl": "19.4.0-rc.0",
92
+ "@nx/nx-win32-x64-msvc": "19.4.0-rc.0",
93
+ "@nx/nx-linux-arm64-gnu": "19.4.0-rc.0",
94
+ "@nx/nx-linux-arm64-musl": "19.4.0-rc.0",
95
+ "@nx/nx-linux-arm-gnueabihf": "19.4.0-rc.0",
96
+ "@nx/nx-win32-arm64-msvc": "19.4.0-rc.0",
97
+ "@nx/nx-freebsd-x64": "19.4.0-rc.0"
98
98
  },
99
99
  "nx-migrations": {
100
100
  "migrations": "./migrations.json",
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateGraph = void 0;
4
4
  const crypto_1 = require("crypto");
5
+ const node_child_process_1 = require("node:child_process");
5
6
  const fs_1 = require("fs");
6
7
  const fs_extra_1 = require("fs-extra");
7
8
  const http = require("http");
@@ -25,8 +26,8 @@ const native_1 = require("../../native");
25
26
  const transform_objects_1 = require("../../native/transform-objects");
26
27
  const affected_1 = require("../affected/affected");
27
28
  const nx_deps_cache_1 = require("../../project-graph/nx-deps-cache");
28
- const create_task_hasher_1 = require("../../hasher/create-task-hasher");
29
29
  const task_hasher_1 = require("../../hasher/task-hasher");
30
+ const create_task_hasher_1 = require("../../hasher/create-task-hasher");
30
31
  const error_types_1 = require("../../project-graph/error-types");
31
32
  const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils");
32
33
  // maps file extention to MIME types
@@ -373,6 +374,20 @@ async function startServer(html, environmentJs, host, port = 4211, watchForchang
373
374
  res.end(environmentJs);
374
375
  return;
375
376
  }
377
+ if (sanitizePath === 'help') {
378
+ const project = parsedUrl.searchParams.get('project');
379
+ const target = parsedUrl.searchParams.get('target');
380
+ try {
381
+ const text = getHelpTextFromTarget(project, target);
382
+ res.writeHead(200, { 'Content-Type': 'application/javascript' });
383
+ res.end(JSON.stringify({ text, success: true }));
384
+ }
385
+ catch (err) {
386
+ res.writeHead(200, { 'Content-Type': 'application/javascript' });
387
+ res.end(JSON.stringify({ text: err.message, success: false }));
388
+ }
389
+ return;
390
+ }
376
391
  let pathname = (0, path_1.join)(__dirname, '../../core/graph/', sanitizePath);
377
392
  // if the file is not found or is a directory, return index.html
378
393
  if (!(0, fs_1.existsSync)(pathname) || (0, fs_1.statSync)(pathname).isDirectory()) {
@@ -744,3 +759,21 @@ async function createJsonOutput(prunedGraph, rawGraph, projects, targets) {
744
759
  }
745
760
  return response;
746
761
  }
762
+ function getHelpTextFromTarget(projectName, targetName) {
763
+ if (!projectName)
764
+ throw new Error(`Missing project`);
765
+ if (!targetName)
766
+ throw new Error(`Missing target`);
767
+ const project = currentProjectGraphClientResponse.projects?.find((p) => p.name === projectName);
768
+ if (!project)
769
+ throw new Error(`Cannot find project ${projectName}`);
770
+ const target = project.data.targets[targetName];
771
+ if (!target)
772
+ throw new Error(`Cannot find target ${targetName}`);
773
+ const command = target.metadata?.help?.command;
774
+ if (!command)
775
+ throw new Error(`No help command found for ${projectName}:${targetName}`);
776
+ return (0, node_child_process_1.execSync)(command, {
777
+ cwd: (0, path_1.join)(workspace_root_1.workspaceRoot, project.data.root),
778
+ }).toString();
779
+ }
@@ -114,6 +114,13 @@ export interface TargetMetadata {
114
114
  description?: string;
115
115
  technologies?: string[];
116
116
  nonAtomizedTarget?: string;
117
+ help?: {
118
+ command: string;
119
+ example: {
120
+ options?: Record<string, unknown>;
121
+ args?: string[];
122
+ };
123
+ };
117
124
  }
118
125
  export interface TargetDependencyConfig {
119
126
  /**