nx 19.6.0-canary.20240801-2111841 → 19.6.0-canary.20240803-bd7a2c9

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.6.0-canary.20240801-2111841",
3
+ "version": "19.6.0-canary.20240803-bd7a2c9",
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": {
@@ -71,7 +71,7 @@
71
71
  "yargs-parser": "21.1.1",
72
72
  "node-machine-id": "1.1.12",
73
73
  "ora": "5.3.0",
74
- "@nrwl/tao": "19.6.0-canary.20240801-2111841"
74
+ "@nrwl/tao": "19.6.0-canary.20240803-bd7a2c9"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "@swc-node/register": "^1.8.0",
@@ -86,16 +86,16 @@
86
86
  }
87
87
  },
88
88
  "optionalDependencies": {
89
- "@nx/nx-darwin-x64": "19.6.0-canary.20240801-2111841",
90
- "@nx/nx-darwin-arm64": "19.6.0-canary.20240801-2111841",
91
- "@nx/nx-linux-x64-gnu": "19.6.0-canary.20240801-2111841",
92
- "@nx/nx-linux-x64-musl": "19.6.0-canary.20240801-2111841",
93
- "@nx/nx-win32-x64-msvc": "19.6.0-canary.20240801-2111841",
94
- "@nx/nx-linux-arm64-gnu": "19.6.0-canary.20240801-2111841",
95
- "@nx/nx-linux-arm64-musl": "19.6.0-canary.20240801-2111841",
96
- "@nx/nx-linux-arm-gnueabihf": "19.6.0-canary.20240801-2111841",
97
- "@nx/nx-win32-arm64-msvc": "19.6.0-canary.20240801-2111841",
98
- "@nx/nx-freebsd-x64": "19.6.0-canary.20240801-2111841"
89
+ "@nx/nx-darwin-x64": "19.6.0-canary.20240803-bd7a2c9",
90
+ "@nx/nx-darwin-arm64": "19.6.0-canary.20240803-bd7a2c9",
91
+ "@nx/nx-linux-x64-gnu": "19.6.0-canary.20240803-bd7a2c9",
92
+ "@nx/nx-linux-x64-musl": "19.6.0-canary.20240803-bd7a2c9",
93
+ "@nx/nx-win32-x64-msvc": "19.6.0-canary.20240803-bd7a2c9",
94
+ "@nx/nx-linux-arm64-gnu": "19.6.0-canary.20240803-bd7a2c9",
95
+ "@nx/nx-linux-arm64-musl": "19.6.0-canary.20240803-bd7a2c9",
96
+ "@nx/nx-linux-arm-gnueabihf": "19.6.0-canary.20240803-bd7a2c9",
97
+ "@nx/nx-win32-arm64-msvc": "19.6.0-canary.20240803-bd7a2c9",
98
+ "@nx/nx-freebsd-x64": "19.6.0-canary.20240803-bd7a2c9"
99
99
  },
100
100
  "nx-migrations": {
101
101
  "migrations": "./migrations.json",
@@ -1,2 +1,2 @@
1
1
  export declare const allowedProjectExtensions: readonly ["tags", "implicitDependencies", "configFilePath", "$schema", "generators", "namedInputs", "name", "files", "root", "sourceRoot", "projectType", "release", "includedScripts", "metadata"];
2
- export declare const allowedWorkspaceExtensions: readonly ["implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins"];
2
+ export declare const allowedWorkspaceExtensions: readonly ["implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins", "neverConnectToCloud"];
@@ -60,6 +60,7 @@ exports.allowedWorkspaceExtensions = [
60
60
  'cacheDirectory',
61
61
  'useDaemonProcess',
62
62
  'useInferencePlugins',
63
+ 'neverConnectToCloud',
63
64
  ];
64
65
  if (!patched) {
65
66
  Module.prototype.require = function () {
@@ -4,7 +4,7 @@ import { NxArgs } from '../../utils/command-line-utils';
4
4
  import { MessageKey } from '../../utils/ab-testing';
5
5
  export declare function onlyDefaultRunnerIsUsed(nxJson: NxJsonConfiguration): boolean;
6
6
  export declare function connectToNxCloudIfExplicitlyAsked(opts: NxArgs): Promise<void>;
7
- export declare function connectWorkspaceToCloud(options: ConnectToNxCloudOptions): Promise<string>;
7
+ export declare function connectWorkspaceToCloud(options: ConnectToNxCloudOptions, directory?: string): Promise<string>;
8
8
  export declare function connectToNxCloudCommand(command?: string): Promise<boolean>;
9
9
  export declare function connectExistingRepoToNxCloudPrompt(command?: string, key?: MessageKey): Promise<boolean>;
10
10
  export declare function connectToNxCloudWithPrompt(command: string): Promise<void>;
@@ -46,11 +46,11 @@ async function connectToNxCloudIfExplicitlyAsked(opts) {
46
46
  process.exit(0);
47
47
  }
48
48
  }
49
- async function connectWorkspaceToCloud(options) {
50
- const tree = new tree_1.FsTree(workspace_root_1.workspaceRoot, false, 'connect-to-nx-cloud');
49
+ async function connectWorkspaceToCloud(options, directory = workspace_root_1.workspaceRoot) {
50
+ const tree = new tree_1.FsTree(directory, false, 'connect-to-nx-cloud');
51
51
  const accessToken = await (0, connect_to_nx_cloud_1.connectToNxCloud)(tree, options);
52
52
  tree.lock();
53
- (0, tree_1.flushChanges)(workspace_root_1.workspaceRoot, tree.listChanges());
53
+ (0, tree_1.flushChanges)(directory, tree.listChanges());
54
54
  return accessToken;
55
55
  }
56
56
  async function connectToNxCloudCommand(command) {
@@ -404,6 +404,10 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
404
404
  * Set this to false to disable adding inference plugins when generating new projects
405
405
  */
406
406
  useInferencePlugins?: boolean;
407
+ /**
408
+ * Set this to false to disable connection to Nx Cloud
409
+ */
410
+ neverConnectToCloud?: boolean;
407
411
  }
408
412
  export type PluginConfiguration = string | ExpandedPluginConfiguration;
409
413
  export type ExpandedPluginConfiguration<T = unknown> = {
@@ -8,7 +8,7 @@ export { getExecutorInformation } from './command-line/run/executor-utils';
8
8
  export { readNxJson as readNxJsonFromDisk } from './config/nx-json';
9
9
  export { calculateDefaultProjectName } from './config/calculate-default-project-name';
10
10
  export { retrieveProjectConfigurationsWithAngularProjects } from './project-graph/utils/retrieve-workspace-files';
11
- export { mergeTargetConfigurations } from './project-graph/utils/project-configuration-utils';
11
+ export { mergeTargetConfigurations, findMatchingConfigFiles, } from './project-graph/utils/project-configuration-utils';
12
12
  export { readProjectConfigurationsFromRootMap } from './project-graph/utils/project-configuration-utils';
13
13
  export { splitTarget } from './utils/split-target';
14
14
  export { combineOptionsForExecutor } from './utils/params';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.interpolate = exports.registerTsProject = exports.LoadedNxPlugin = exports.retrieveProjectConfigurations = exports.findProjectForPath = exports.createProjectRootMappingsFromProjectConfigurations = exports.hashWithWorkspaceContext = exports.hashObject = exports.splitByColons = exports.readModulePackageJson = exports.stripIndent = exports.sortObjectByKeys = exports.combineOptionsForExecutor = exports.splitTarget = exports.readProjectConfigurationsFromRootMap = exports.mergeTargetConfigurations = exports.retrieveProjectConfigurationsWithAngularProjects = exports.calculateDefaultProjectName = exports.readNxJsonFromDisk = exports.getExecutorInformation = exports.createTempNpmDirectory = void 0;
3
+ exports.interpolate = exports.registerTsProject = exports.LoadedNxPlugin = exports.retrieveProjectConfigurations = exports.findProjectForPath = exports.createProjectRootMappingsFromProjectConfigurations = exports.hashWithWorkspaceContext = exports.hashObject = exports.splitByColons = exports.readModulePackageJson = exports.stripIndent = exports.sortObjectByKeys = exports.combineOptionsForExecutor = exports.splitTarget = exports.readProjectConfigurationsFromRootMap = exports.findMatchingConfigFiles = exports.mergeTargetConfigurations = exports.retrieveProjectConfigurationsWithAngularProjects = exports.calculateDefaultProjectName = exports.readNxJsonFromDisk = exports.getExecutorInformation = exports.createTempNpmDirectory = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  /**
6
6
  * Note to developers: STOP! These exports are available via requireNx in @nx/devkit.
@@ -19,6 +19,7 @@ var retrieve_workspace_files_1 = require("./project-graph/utils/retrieve-workspa
19
19
  Object.defineProperty(exports, "retrieveProjectConfigurationsWithAngularProjects", { enumerable: true, get: function () { return retrieve_workspace_files_1.retrieveProjectConfigurationsWithAngularProjects; } });
20
20
  var project_configuration_utils_1 = require("./project-graph/utils/project-configuration-utils");
21
21
  Object.defineProperty(exports, "mergeTargetConfigurations", { enumerable: true, get: function () { return project_configuration_utils_1.mergeTargetConfigurations; } });
22
+ Object.defineProperty(exports, "findMatchingConfigFiles", { enumerable: true, get: function () { return project_configuration_utils_1.findMatchingConfigFiles; } });
22
23
  var project_configuration_utils_2 = require("./project-graph/utils/project-configuration-utils");
23
24
  Object.defineProperty(exports, "readProjectConfigurationsFromRootMap", { enumerable: true, get: function () { return project_configuration_utils_2.readProjectConfigurationsFromRootMap; } });
24
25
  var split_target_1 = require("./utils/split-target");
Binary file
@@ -1,4 +1,5 @@
1
1
  import { Tree } from '../../../generators/tree';
2
+ import { NxJsonConfiguration } from '../../../config/nx-json';
2
3
  export declare function printSuccessMessage(token: string | undefined, installationSource: string, usesGithub: boolean): Promise<string>;
3
4
  export interface ConnectToNxCloudOptions {
4
5
  analytics?: boolean;
@@ -7,5 +8,5 @@ export interface ConnectToNxCloudOptions {
7
8
  github?: boolean;
8
9
  directory?: string;
9
10
  }
10
- export declare function connectToNxCloud(tree: Tree, schema: ConnectToNxCloudOptions): Promise<string>;
11
+ export declare function connectToNxCloud(tree: Tree, schema: ConnectToNxCloudOptions, nxJson?: NxJsonConfiguration<string[] | "*">): Promise<string>;
11
12
  export default connectToNxCloud;
@@ -9,6 +9,7 @@ const nx_json_1 = require("../../../generators/utils/nx-json");
9
9
  const format_changed_files_with_prettier_if_available_1 = require("../../../generators/internal-utils/format-changed-files-with-prettier-if-available");
10
10
  const url_shorten_1 = require("../../utilities/url-shorten");
11
11
  const get_cloud_options_1 = require("../../utilities/get-cloud-options");
12
+ const path_1 = require("path");
12
13
  function printCloudConnectionDisabledMessage() {
13
14
  output_1.output.error({
14
15
  title: `Connections to Nx Cloud are disabled for this workspace`,
@@ -68,20 +69,21 @@ async function printSuccessMessage(token, installationSource, usesGithub) {
68
69
  });
69
70
  return connectCloudUrl;
70
71
  }
71
- function addNxCloudOptionsToNxJson(tree, nxJson, token) {
72
- nxJson ??= {
73
- extends: 'nx/presets/npm.json',
74
- };
75
- nxJson.nxCloudAccessToken = token;
76
- const overrideUrl = process.env.NX_CLOUD_API || process.env.NRWL_API;
77
- if (overrideUrl) {
78
- nxJson.nxCloudUrl = overrideUrl;
72
+ function addNxCloudOptionsToNxJson(tree, token, directory = tree.root) {
73
+ const nxJsonPath = (0, path_1.join)(directory, 'nx.json');
74
+ if (tree.exists(nxJsonPath)) {
75
+ (0, json_1.updateJson)(tree, (0, path_1.join)(directory, 'nx.json'), (nxJson) => {
76
+ const overrideUrl = process.env.NX_CLOUD_API || process.env.NRWL_API;
77
+ if (overrideUrl) {
78
+ nxJson.nxCloudUrl = overrideUrl;
79
+ }
80
+ nxJson.nxCloudAccessToken = token;
81
+ return nxJson;
82
+ });
79
83
  }
80
- (0, nx_json_1.updateNxJson)(tree, nxJson);
81
84
  }
82
- async function connectToNxCloud(tree, schema) {
85
+ async function connectToNxCloud(tree, schema, nxJson = (0, nx_json_1.readNxJson)(tree)) {
83
86
  schema.installationSource ??= 'user';
84
- const nxJson = (0, nx_json_1.readNxJson)(tree);
85
87
  if (nxJson?.neverConnectToCloud) {
86
88
  printCloudConnectionDisabledMessage();
87
89
  return null;
@@ -93,7 +95,7 @@ async function connectToNxCloud(tree, schema) {
93
95
  // if user is using github and is running nx-connect
94
96
  if (!(usesGithub && schema.installationSource === 'nx-connect')) {
95
97
  responseFromCreateNxCloudWorkspace = await createNxCloudWorkspace(getRootPackageName(tree), schema.installationSource, getNxInitDate());
96
- addNxCloudOptionsToNxJson(tree, nxJson, responseFromCreateNxCloudWorkspace?.token);
98
+ addNxCloudOptionsToNxJson(tree, responseFromCreateNxCloudWorkspace?.token, schema.directory);
97
99
  await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
98
100
  silent: schema.hideFormatLogs,
99
101
  });
@@ -1,4 +1,4 @@
1
1
  import { CloudTaskRunnerOptions } from '../nx-cloud-tasks-runner-shell';
2
- export declare function getCloudOptions(): CloudTaskRunnerOptions;
2
+ export declare function getCloudOptions(directory?: string): CloudTaskRunnerOptions;
3
3
  export declare function getCloudUrl(): string;
4
4
  export declare function removeTrailingSlash(apiUrl: string): string;
@@ -5,8 +5,9 @@ exports.getCloudUrl = getCloudUrl;
5
5
  exports.removeTrailingSlash = removeTrailingSlash;
6
6
  const nx_json_1 = require("../../config/nx-json");
7
7
  const run_command_1 = require("../../tasks-runner/run-command");
8
- function getCloudOptions() {
9
- const nxJson = (0, nx_json_1.readNxJson)();
8
+ const workspace_root_1 = require("../../utils/workspace-root");
9
+ function getCloudOptions(directory = workspace_root_1.workspaceRoot) {
10
+ const nxJson = (0, nx_json_1.readNxJson)(directory);
10
11
  // TODO: The default is not always cloud? But it's not handled at the moment
11
12
  return (0, run_command_1.getRunnerOptions)('default', nxJson, {}, true);
12
13
  }
@@ -37,6 +37,7 @@ export type ConfigurationResult = {
37
37
  */
38
38
  export declare function createProjectConfigurations(root: string, nxJson: NxJsonConfiguration, projectFiles: string[], // making this parameter allows devkit to pick up newly created projects
39
39
  plugins: LoadedNxPlugin[]): Promise<ConfigurationResult>;
40
+ export declare function findMatchingConfigFiles(projectFiles: string[], pattern: string, include: string[], exclude: string[]): string[];
40
41
  export declare function readProjectConfigurationsFromRootMap(projectRootMap: Record<string, ProjectConfiguration>): Record<string, ProjectConfiguration>;
41
42
  export declare function validateProject(project: ProjectConfiguration, knownProjects: Record<string, ProjectConfiguration>): void;
42
43
  export declare function mergeTargetDefaultWithTargetDefinition(targetName: string, project: ProjectConfiguration, targetDefault: Partial<TargetConfiguration>, sourceMap: Record<string, SourceInformation>): TargetConfiguration;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mergeProjectConfigurationIntoRootMap = mergeProjectConfigurationIntoRootMap;
4
4
  exports.mergeMetadata = mergeMetadata;
5
5
  exports.createProjectConfigurations = createProjectConfigurations;
6
+ exports.findMatchingConfigFiles = findMatchingConfigFiles;
6
7
  exports.readProjectConfigurationsFromRootMap = readProjectConfigurationsFromRootMap;
7
8
  exports.validateProject = validateProject;
8
9
  exports.mergeTargetDefaultWithTargetDefinition = mergeTargetDefaultWithTargetDefinition;
@@ -25,7 +25,7 @@ class Cache {
25
25
  if (shouldSpawnProcess) {
26
26
  const scriptPath = require.resolve('./remove-old-cache-records.js');
27
27
  try {
28
- const p = (0, child_process_1.spawn)('node', [scriptPath, `"${this.cachePath}"`], {
28
+ const p = (0, child_process_1.spawn)('node', [scriptPath, `${this.cachePath}`], {
29
29
  stdio: 'ignore',
30
30
  detached: true,
31
31
  shell: false,