nx 19.1.0-canary.20240507-1fe262a → 19.1.0-canary.20240508-fd78152

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.1.0-canary.20240507-1fe262a",
3
+ "version": "19.1.0-canary.20240508-fd78152",
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": {
@@ -66,7 +66,7 @@
66
66
  "yargs-parser": "21.1.1",
67
67
  "node-machine-id": "1.1.12",
68
68
  "ora": "5.3.0",
69
- "@nrwl/tao": "19.1.0-canary.20240507-1fe262a"
69
+ "@nrwl/tao": "19.1.0-canary.20240508-fd78152"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@swc-node/register": "^1.8.0",
@@ -81,16 +81,16 @@
81
81
  }
82
82
  },
83
83
  "optionalDependencies": {
84
- "@nx/nx-darwin-x64": "19.1.0-canary.20240507-1fe262a",
85
- "@nx/nx-darwin-arm64": "19.1.0-canary.20240507-1fe262a",
86
- "@nx/nx-linux-x64-gnu": "19.1.0-canary.20240507-1fe262a",
87
- "@nx/nx-linux-x64-musl": "19.1.0-canary.20240507-1fe262a",
88
- "@nx/nx-win32-x64-msvc": "19.1.0-canary.20240507-1fe262a",
89
- "@nx/nx-linux-arm64-gnu": "19.1.0-canary.20240507-1fe262a",
90
- "@nx/nx-linux-arm64-musl": "19.1.0-canary.20240507-1fe262a",
91
- "@nx/nx-linux-arm-gnueabihf": "19.1.0-canary.20240507-1fe262a",
92
- "@nx/nx-win32-arm64-msvc": "19.1.0-canary.20240507-1fe262a",
93
- "@nx/nx-freebsd-x64": "19.1.0-canary.20240507-1fe262a"
84
+ "@nx/nx-darwin-x64": "19.1.0-canary.20240508-fd78152",
85
+ "@nx/nx-darwin-arm64": "19.1.0-canary.20240508-fd78152",
86
+ "@nx/nx-linux-x64-gnu": "19.1.0-canary.20240508-fd78152",
87
+ "@nx/nx-linux-x64-musl": "19.1.0-canary.20240508-fd78152",
88
+ "@nx/nx-win32-x64-msvc": "19.1.0-canary.20240508-fd78152",
89
+ "@nx/nx-linux-arm64-gnu": "19.1.0-canary.20240508-fd78152",
90
+ "@nx/nx-linux-arm64-musl": "19.1.0-canary.20240508-fd78152",
91
+ "@nx/nx-linux-arm-gnueabihf": "19.1.0-canary.20240508-fd78152",
92
+ "@nx/nx-win32-arm64-msvc": "19.1.0-canary.20240508-fd78152",
93
+ "@nx/nx-freebsd-x64": "19.1.0-canary.20240508-fd78152"
94
94
  },
95
95
  "nx-migrations": {
96
96
  "migrations": "./migrations.json",
@@ -746,19 +746,6 @@ async function generateMigrationsJsonAndUpdatePackageJson(root, opts) {
746
746
  const originalNxJson = (0, configuration_1.readNxJson)();
747
747
  const from = originalNxJson.installation?.version ??
748
748
  readNxVersion(originalPackageJson);
749
- try {
750
- if (['nx', '@nrwl/workspace'].includes(opts.targetPackage) &&
751
- (await isMigratingToNewMajor(from, opts.targetVersion)) &&
752
- !(0, is_ci_1.isCI)() &&
753
- !(0, nx_cloud_utils_1.isNxCloudUsed)(originalNxJson)) {
754
- await (0, connect_to_nx_cloud_1.connectToNxCloudWithPrompt)('migrate');
755
- originalPackageJson = (0, fileutils_1.readJsonFile)((0, path_1.join)(root, 'package.json'));
756
- }
757
- }
758
- catch {
759
- // The above code is to remind folks when updating to a new major and not currently using Nx cloud.
760
- // If for some reason it fails, it shouldn't affect the overall migration process
761
- }
762
749
  logger_1.logger.info(`Fetching meta data about packages.`);
763
750
  logger_1.logger.info(`It may take a few minutes.`);
764
751
  const migrator = new Migrator({
@@ -789,6 +776,28 @@ async function generateMigrationsJsonAndUpdatePackageJson(root, opts) {
789
776
  : `- There are no migrations to run, so migrations.json has not been created.`,
790
777
  ],
791
778
  });
779
+ try {
780
+ if (['nx', '@nrwl/workspace'].includes(opts.targetPackage) &&
781
+ (await isMigratingToNewMajor(from, opts.targetVersion)) &&
782
+ !(0, is_ci_1.isCI)() &&
783
+ !(0, nx_cloud_utils_1.isNxCloudUsed)(originalNxJson)) {
784
+ output_1.output.success({
785
+ title: 'Connect to Nx Cloud',
786
+ bodyLines: [
787
+ 'Nx Cloud is a first-party CI companion for Nx projects. It improves critical aspects of CI:',
788
+ '- Speed: 30% - 70% faster CI',
789
+ '- Cost: 40% - 75% reduction in CI costs',
790
+ '- Reliability: by automatically identifying flaky tasks and re-running them',
791
+ ],
792
+ });
793
+ await (0, connect_to_nx_cloud_1.connectToNxCloudWithPrompt)('migrate');
794
+ originalPackageJson = (0, fileutils_1.readJsonFile)((0, path_1.join)(root, 'package.json'));
795
+ }
796
+ }
797
+ catch {
798
+ // The above code is to remind folks when updating to a new major and not currently using Nx cloud.
799
+ // If for some reason it fails, it shouldn't affect the overall migration process
800
+ }
792
801
  output_1.output.log({
793
802
  title: 'Next steps:',
794
803
  bodyLines: [
@@ -4,17 +4,18 @@ export interface NxShowArgs {
4
4
  json?: boolean;
5
5
  }
6
6
  export type ShowProjectsOptions = NxShowArgs & {
7
- exclude: string;
8
- files: string;
9
- uncommitted: any;
10
- untracked: any;
11
- base: string;
12
- head: string;
13
- affected: boolean;
14
- type: ProjectGraphProjectNode['type'];
15
- projects: string[];
16
- withTarget: string[];
17
- verbose: boolean;
7
+ exclude?: string[];
8
+ files?: string;
9
+ uncommitted?: any;
10
+ untracked?: any;
11
+ base?: string;
12
+ head?: string;
13
+ affected?: boolean;
14
+ type?: ProjectGraphProjectNode['type'];
15
+ projects?: string[];
16
+ withTarget?: string[];
17
+ verbose?: boolean;
18
+ sep?: string;
18
19
  };
19
20
  export type ShowProjectOptions = NxShowArgs & {
20
21
  projectName: string;
@@ -47,12 +47,18 @@ const showProjectsCommand = {
47
47
  type: 'string',
48
48
  description: 'Select only projects of the given type',
49
49
  choices: ['app', 'lib', 'e2e'],
50
+ })
51
+ .option('sep', {
52
+ type: 'string',
53
+ description: 'Outputs projects with the specified seperator',
50
54
  })
51
55
  .implies('untracked', 'affected')
52
56
  .implies('uncommitted', 'affected')
53
57
  .implies('files', 'affected')
54
58
  .implies('base', 'affected')
55
59
  .implies('head', 'affected')
60
+ .conflicts('sep', 'json')
61
+ .conflicts('json', 'sep')
56
62
  .example('$0 show projects --projects "apps/*"', 'Show all projects in the apps directory')
57
63
  .example('$0 show projects --projects "shared-*"', 'Show all projects that start with "shared-"')
58
64
  .example('$0 show projects --affected', 'Show affected projects in the workspace')
@@ -60,7 +66,9 @@ const showProjectsCommand = {
60
66
  .example('$0 show projects --affected --exclude=*-e2e', 'Show affected projects in the workspace, excluding end-to-end projects'),
61
67
  handler: (args) => {
62
68
  return (0, params_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
63
- return (await Promise.resolve().then(() => require('./show'))).showProjectsHandler(args);
69
+ const { showProjectsHandler } = await Promise.resolve().then(() => require('./projects'));
70
+ await showProjectsHandler(args);
71
+ process.exit(0);
64
72
  });
65
73
  },
66
74
  };
@@ -82,16 +90,15 @@ const showProjectCommand = {
82
90
  type: 'boolean',
83
91
  description: 'Prints additional information about the commands (e.g., stack traces)',
84
92
  })
85
- .check((argv) => {
86
- if (argv.web) {
87
- argv.json = false;
88
- }
89
- return true;
90
- })
91
- .example('$0 show project my-app', 'View project information for my-app in JSON format'),
93
+ .conflicts('json', 'web')
94
+ .conflicts('web', 'json')
95
+ .example('$0 show project my-app', 'View project information for my-app in JSON format')
96
+ .example('$0 show project my-app --web', 'View project information for my-app in the browser'),
92
97
  handler: (args) => {
93
98
  return (0, params_1.handleErrors)(args.verbose ?? process.env.NX_VERBOSE_LOGGING === 'true', async () => {
94
- return (await Promise.resolve().then(() => require('./show'))).showProjectHandler(args);
99
+ const { showProjectHandler } = await Promise.resolve().then(() => require('./project'));
100
+ await showProjectHandler(args);
101
+ process.exit(0);
95
102
  });
96
103
  },
97
104
  };
@@ -0,0 +1,2 @@
1
+ import { ShowProjectOptions } from './command-object';
2
+ export declare function showProjectHandler(args: ShowProjectOptions): Promise<void>;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.showProjectHandler = void 0;
4
+ const output_1 = require("../../utils/output");
5
+ const project_graph_1 = require("../../project-graph/project-graph");
6
+ const graph_1 = require("../graph/graph");
7
+ async function showProjectHandler(args) {
8
+ const graph = await (0, project_graph_1.createProjectGraphAsync)();
9
+ const node = graph.nodes[args.projectName];
10
+ if (!node) {
11
+ console.log(`Could not find project ${args.projectName}`);
12
+ process.exit(1);
13
+ }
14
+ if (args.json) {
15
+ console.log(JSON.stringify(node.data));
16
+ }
17
+ else if (args.web) {
18
+ await (0, graph_1.generateGraph)({
19
+ view: 'project-details',
20
+ focus: node.name,
21
+ watch: true,
22
+ open: true,
23
+ }, []);
24
+ }
25
+ else {
26
+ const chalk = require('chalk');
27
+ const logIfExists = (label, key) => {
28
+ if (node.data[key]) {
29
+ console.log(`${chalk.bold(label)}: ${node.data[key]}`);
30
+ }
31
+ };
32
+ logIfExists('Name', 'name');
33
+ logIfExists('Root', 'root');
34
+ logIfExists('Source Root', 'sourceRoot');
35
+ logIfExists('Tags', 'tags');
36
+ logIfExists('Implicit Dependencies', 'implicitDependencies');
37
+ const targets = Object.entries(node.data.targets ?? {});
38
+ const maxTargetNameLength = Math.max(...targets.map(([t]) => t.length));
39
+ const maxExecutorNameLength = Math.max(...targets.map(([, t]) => t?.executor?.length ?? 0));
40
+ if (targets.length > 0) {
41
+ console.log(`${chalk.bold('Targets')}: `);
42
+ for (const [target, targetConfig] of targets) {
43
+ console.log(`- ${chalk.bold((target + ':').padEnd(maxTargetNameLength + 2))} ${(targetConfig?.executor ?? '').padEnd(maxExecutorNameLength + 2)} ${(() => {
44
+ const configurations = Object.keys(targetConfig.configurations ?? {});
45
+ if (configurations.length) {
46
+ return chalk.dim(configurations.join(', '));
47
+ }
48
+ return '';
49
+ })()}`);
50
+ }
51
+ }
52
+ }
53
+ await output_1.output.drain();
54
+ }
55
+ exports.showProjectHandler = showProjectHandler;
@@ -0,0 +1,2 @@
1
+ import { ShowProjectsOptions } from './command-object';
2
+ export declare function showProjectsHandler(args: ShowProjectsOptions): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.showProjectHandler = exports.showProjectsHandler = void 0;
3
+ exports.showProjectsHandler = void 0;
4
4
  const output_1 = require("../../utils/output");
5
5
  const nx_json_1 = require("../../config/nx-json");
6
6
  const affected_project_graph_1 = require("../../project-graph/affected/affected-project-graph");
@@ -10,7 +10,6 @@ const project_graph_1 = require("../../project-graph/project-graph");
10
10
  const all_file_data_1 = require("../../utils/all-file-data");
11
11
  const command_line_utils_1 = require("../../utils/command-line-utils");
12
12
  const find_matching_projects_1 = require("../../utils/find-matching-projects");
13
- const graph_1 = require("../graph/graph");
14
13
  async function showProjectsHandler(args) {
15
14
  let graph = await (0, project_graph_1.createProjectGraphAsync)();
16
15
  const nxJson = (0, nx_json_1.readNxJson)();
@@ -52,64 +51,17 @@ async function showProjectsHandler(args) {
52
51
  if (args.json) {
53
52
  console.log(JSON.stringify(Array.from(selectedProjects)));
54
53
  }
54
+ else if (args.sep) {
55
+ console.log(Array.from(selectedProjects.values()).join(args.sep));
56
+ }
55
57
  else {
56
58
  for (const project of selectedProjects) {
57
59
  console.log(project);
58
60
  }
59
61
  }
60
62
  await output_1.output.drain();
61
- process.exit(0);
62
63
  }
63
64
  exports.showProjectsHandler = showProjectsHandler;
64
- async function showProjectHandler(args) {
65
- const graph = await (0, project_graph_1.createProjectGraphAsync)();
66
- const node = graph.nodes[args.projectName];
67
- if (!node) {
68
- console.log(`Could not find project ${args.projectName}`);
69
- process.exit(1);
70
- }
71
- if (args.json) {
72
- console.log(JSON.stringify(node.data));
73
- }
74
- else if (args.web) {
75
- await (0, graph_1.generateGraph)({
76
- view: 'project-details',
77
- focus: node.name,
78
- watch: true,
79
- open: true,
80
- }, []);
81
- }
82
- else {
83
- const chalk = require('chalk');
84
- const logIfExists = (label, key) => {
85
- if (node.data[key]) {
86
- console.log(`${chalk.bold(label)}: ${node.data[key]}`);
87
- }
88
- };
89
- logIfExists('Name', 'name');
90
- logIfExists('Root', 'root');
91
- logIfExists('Source Root', 'sourceRoot');
92
- logIfExists('Tags', 'tags');
93
- logIfExists('Implicit Dependencies', 'implicitDependencies');
94
- const targets = Object.entries(node.data.targets ?? {});
95
- const maxTargetNameLength = Math.max(...targets.map(([t]) => t.length));
96
- const maxExecutorNameLength = Math.max(...targets.map(([, t]) => t?.executor?.length ?? 0));
97
- if (targets.length > 0) {
98
- console.log(`${chalk.bold('Targets')}: `);
99
- for (const [target, targetConfig] of targets) {
100
- console.log(`- ${chalk.bold((target + ':').padEnd(maxTargetNameLength + 2))} ${(targetConfig?.executor ?? '').padEnd(maxExecutorNameLength + 2)} ${(() => {
101
- const configurations = Object.keys(targetConfig.configurations ?? {});
102
- if (configurations.length) {
103
- return chalk.dim(configurations.join(', '));
104
- }
105
- return '';
106
- })()}`);
107
- }
108
- }
109
- }
110
- process.exit(0);
111
- }
112
- exports.showProjectHandler = showProjectHandler;
113
65
  function getGraphNodesMatchingPatterns(graph, patterns) {
114
66
  const nodes = {};
115
67
  const matches = (0, find_matching_projects_1.findMatchingProjects)(patterns, graph.nodes);
@@ -9,12 +9,12 @@ import { LoadedNxPlugin } from '../plugins/internal-api';
9
9
  * @param nxJson
10
10
  */
11
11
  export declare function retrieveWorkspaceFiles(workspaceRoot: string, projectRootMap: Record<string, string>): Promise<{
12
- allWorkspaceFiles: import("nx/src/devkit-exports").FileData[];
12
+ allWorkspaceFiles: import("../file-utils").FileData[];
13
13
  fileMap: {
14
14
  projectFileMap: ProjectFiles;
15
- nonProjectFiles: import("nx/src/native").FileData[];
15
+ nonProjectFiles: import("../../native").FileData[];
16
16
  };
17
- rustReferences: import("nx/src/native").NxWorkspaceFilesExternals;
17
+ rustReferences: import("../../native").NxWorkspaceFilesExternals;
18
18
  }>;
19
19
  /**
20
20
  * Walk through the workspace and return `ProjectConfigurations`. Only use this if the projectFileMap is not needed.
@@ -11,7 +11,7 @@ declare const messageOptions: {
11
11
  readonly value: "skip";
12
12
  readonly name: "Skip for now";
13
13
  }];
14
- readonly footer: "\nRead more about remote cache at https://nx.dev/ci/features/remote-cache";
14
+ readonly footer: "\nWatch a short video on Nx Cloud at https://nx.dev/ci/intro/why-nx-cloud";
15
15
  readonly hint: "\n(it's free and can be disabled any time)";
16
16
  }];
17
17
  readonly setupViewLogs: readonly [{
@@ -12,7 +12,7 @@ const messageOptions = {
12
12
  { value: 'yes', name: 'Yes' },
13
13
  { value: 'skip', name: 'Skip for now' },
14
14
  ],
15
- footer: '\nRead more about remote cache at https://nx.dev/ci/features/remote-cache',
15
+ footer: '\nWatch a short video on Nx Cloud at https://nx.dev/ci/intro/why-nx-cloud',
16
16
  hint: `\n(it's free and can be disabled any time)`,
17
17
  },
18
18
  ],
@@ -67,7 +67,7 @@ async function recordStat(opts) {
67
67
  if (process.env.NX_VERBOSE_LOGGING === 'true') {
68
68
  console.log(`Record stat. Major: ${major}`);
69
69
  }
70
- if (major < 10 || major > 16)
70
+ if (major < 10 || major > 19)
71
71
  return; // test version, skip it
72
72
  const axios = require('axios');
73
73
  await (axios['default'] ?? axios)
@@ -1,3 +0,0 @@
1
- import { ShowProjectOptions, ShowProjectsOptions } from './command-object';
2
- export declare function showProjectsHandler(args: ShowProjectsOptions): Promise<void>;
3
- export declare function showProjectHandler(args: ShowProjectOptions): Promise<void>;