nx 19.6.0-canary.20240731-341f295 → 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 +12 -12
- package/schemas/project-schema.json +40 -6
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +1 -0
- package/src/command-line/connect/connect-to-nx-cloud.d.ts +1 -1
- package/src/command-line/connect/connect-to-nx-cloud.js +3 -3
- package/src/command-line/migrate/migrate.js +14 -6
- package/src/config/nx-json.d.ts +4 -0
- package/src/core/graph/main.js +1 -1
- package/src/devkit-internals.d.ts +1 -1
- package/src/devkit-internals.js +2 -1
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +2 -1
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +14 -12
- package/src/nx-cloud/utilities/get-cloud-options.d.ts +1 -1
- package/src/nx-cloud/utilities/get-cloud-options.js +3 -2
- package/src/project-graph/utils/project-configuration-utils.d.ts +1 -0
- package/src/project-graph/utils/project-configuration-utils.js +1 -0
- package/src/tasks-runner/cache.js +1 -1
- package/src/utils/git-utils.js +3 -1
@@ -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';
|
package/src/devkit-internals.js
CHANGED
@@ -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,
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
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,
|
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
|
-
|
9
|
-
|
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,
|
28
|
+
const p = (0, child_process_1.spawn)('node', [scriptPath, `${this.cachePath}`], {
|
29
29
|
stdio: 'ignore',
|
30
30
|
detached: true,
|
31
31
|
shell: false,
|
package/src/utils/git-utils.js
CHANGED
@@ -8,7 +8,9 @@ const child_process_1 = require("child_process");
|
|
8
8
|
const devkit_exports_1 = require("../devkit-exports");
|
9
9
|
function getGithubSlugOrNull() {
|
10
10
|
try {
|
11
|
-
const gitRemote = (0, child_process_1.execSync)('git remote -v'
|
11
|
+
const gitRemote = (0, child_process_1.execSync)('git remote -v', {
|
12
|
+
stdio: 'pipe',
|
13
|
+
}).toString();
|
12
14
|
// If there are no remotes, we default to github
|
13
15
|
if (!gitRemote || gitRemote.length === 0) {
|
14
16
|
return 'github';
|