nx 19.1.0-canary.20240521-1255603 → 19.1.0-canary.20240522-89fdd42
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 +12 -12
- package/src/command-line/migrate/migrate.js +11 -4
- package/src/command-line/release/utils/shared.js +5 -3
- package/src/config/workspace-json-project-json.d.ts +1 -0
- package/src/core/graph/main.js +1 -1
- package/src/plugins/target-defaults/target-defaults-plugin.d.ts +31 -0
- package/src/plugins/target-defaults/target-defaults-plugin.js +9 -0
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +3 -3
- package/src/utils/package-json.d.ts +1 -1
- package/src/utils/package-json.js +8 -2
- package/src/utils/package-manager.d.ts +1 -1
- package/src/utils/package-manager.js +7 -5
@@ -13,6 +13,11 @@ export default TargetDefaultsPlugin;
|
|
13
13
|
*/
|
14
14
|
export declare function getTargetInfo(target: string, projectJsonTargets: Record<string, TargetConfiguration>, packageJsonTargets: Record<string, TargetConfiguration>): {
|
15
15
|
command: string;
|
16
|
+
metadata: {
|
17
|
+
[x: string]: any;
|
18
|
+
description?: string;
|
19
|
+
technologies?: string[];
|
20
|
+
};
|
16
21
|
executor?: undefined;
|
17
22
|
options?: undefined;
|
18
23
|
} | {
|
@@ -22,6 +27,11 @@ export declare function getTargetInfo(target: string, projectJsonTargets: Record
|
|
22
27
|
commands?: undefined;
|
23
28
|
script?: undefined;
|
24
29
|
};
|
30
|
+
metadata: {
|
31
|
+
[x: string]: any;
|
32
|
+
description?: string;
|
33
|
+
technologies?: string[];
|
34
|
+
};
|
25
35
|
command?: undefined;
|
26
36
|
} | {
|
27
37
|
executor: string;
|
@@ -30,9 +40,19 @@ export declare function getTargetInfo(target: string, projectJsonTargets: Record
|
|
30
40
|
command?: undefined;
|
31
41
|
script?: undefined;
|
32
42
|
};
|
43
|
+
metadata: {
|
44
|
+
[x: string]: any;
|
45
|
+
description?: string;
|
46
|
+
technologies?: string[];
|
47
|
+
};
|
33
48
|
command?: undefined;
|
34
49
|
} | {
|
35
50
|
executor: string;
|
51
|
+
metadata: {
|
52
|
+
[x: string]: any;
|
53
|
+
description?: string;
|
54
|
+
technologies?: string[];
|
55
|
+
};
|
36
56
|
command?: undefined;
|
37
57
|
options?: undefined;
|
38
58
|
} | {
|
@@ -42,9 +62,20 @@ export declare function getTargetInfo(target: string, projectJsonTargets: Record
|
|
42
62
|
command?: undefined;
|
43
63
|
commands?: undefined;
|
44
64
|
};
|
65
|
+
metadata: {
|
66
|
+
[x: string]: any;
|
67
|
+
description?: string;
|
68
|
+
technologies?: string[];
|
69
|
+
};
|
45
70
|
command?: undefined;
|
71
|
+
} | {
|
72
|
+
executor: string;
|
73
|
+
command?: undefined;
|
74
|
+
metadata?: undefined;
|
75
|
+
options?: undefined;
|
46
76
|
} | {
|
47
77
|
command?: undefined;
|
78
|
+
metadata?: undefined;
|
48
79
|
executor?: undefined;
|
49
80
|
options?: undefined;
|
50
81
|
};
|
@@ -111,9 +111,14 @@ function getTargetInfo(target, projectJsonTargets, packageJsonTargets) {
|
|
111
111
|
...packageJsonTarget?.options,
|
112
112
|
...projectJsonTarget?.options,
|
113
113
|
};
|
114
|
+
const metadata = {
|
115
|
+
...packageJsonTarget?.metadata,
|
116
|
+
...projectJsonTarget?.metadata,
|
117
|
+
};
|
114
118
|
if (projectJsonTarget?.command) {
|
115
119
|
return {
|
116
120
|
command: projectJsonTarget?.command,
|
121
|
+
metadata,
|
117
122
|
};
|
118
123
|
}
|
119
124
|
if (executor === 'nx:run-commands') {
|
@@ -123,6 +128,7 @@ function getTargetInfo(target, projectJsonTargets, packageJsonTargets) {
|
|
123
128
|
options: {
|
124
129
|
command: targetOptions?.command,
|
125
130
|
},
|
131
|
+
metadata,
|
126
132
|
};
|
127
133
|
}
|
128
134
|
else if (targetOptions?.commands) {
|
@@ -131,10 +137,12 @@ function getTargetInfo(target, projectJsonTargets, packageJsonTargets) {
|
|
131
137
|
options: {
|
132
138
|
commands: targetOptions.commands,
|
133
139
|
},
|
140
|
+
metadata,
|
134
141
|
};
|
135
142
|
}
|
136
143
|
return {
|
137
144
|
executor: 'nx:run-commands',
|
145
|
+
metadata,
|
138
146
|
};
|
139
147
|
}
|
140
148
|
if (executor === 'nx:run-script') {
|
@@ -143,6 +151,7 @@ function getTargetInfo(target, projectJsonTargets, packageJsonTargets) {
|
|
143
151
|
options: {
|
144
152
|
script: targetOptions?.script ?? target,
|
145
153
|
},
|
154
|
+
metadata,
|
146
155
|
};
|
147
156
|
}
|
148
157
|
if (executor) {
|
@@ -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("
|
12
|
+
allWorkspaceFiles: import("nx/src/devkit-exports").FileData[];
|
13
13
|
fileMap: {
|
14
14
|
projectFileMap: ProjectFiles;
|
15
|
-
nonProjectFiles: import("
|
15
|
+
nonProjectFiles: import("nx/src/native").FileData[];
|
16
16
|
};
|
17
|
-
rustReferences: import("
|
17
|
+
rustReferences: import("nx/src/native").NxWorkspaceFilesExternals;
|
18
18
|
}>;
|
19
19
|
/**
|
20
20
|
* Walk through the workspace and return `ProjectConfigurations`. Only use this if the projectFileMap is not needed.
|
@@ -65,7 +65,7 @@ export declare function normalizePackageGroup(packageGroup: PackageGroup): Array
|
|
65
65
|
export declare function readNxMigrateConfig(json: Partial<PackageJson>): NxMigrationsConfiguration & {
|
66
66
|
packageGroup?: ArrayPackageGroup;
|
67
67
|
};
|
68
|
-
export declare function buildTargetFromScript(script: string): TargetConfiguration;
|
68
|
+
export declare function buildTargetFromScript(script: string, scripts?: Record<string, string>): TargetConfiguration;
|
69
69
|
export declare function readTargetsFromPackageJson(packageJson: PackageJson): Record<string, TargetConfiguration<any>>;
|
70
70
|
/**
|
71
71
|
* Uses `require.resolve` to read the package.json for a module.
|
@@ -6,6 +6,7 @@ const path_1 = require("path");
|
|
6
6
|
const project_configuration_utils_1 = require("../project-graph/utils/project-configuration-utils");
|
7
7
|
const fileutils_1 = require("./fileutils");
|
8
8
|
const installation_directory_1 = require("./installation-directory");
|
9
|
+
const package_manager_1 = require("./package-manager");
|
9
10
|
function normalizePackageGroup(packageGroup) {
|
10
11
|
return Array.isArray(packageGroup)
|
11
12
|
? packageGroup.map((x) => typeof x === 'string' ? { package: x, version: '*' } : x)
|
@@ -38,12 +39,17 @@ function readNxMigrateConfig(json) {
|
|
38
39
|
};
|
39
40
|
}
|
40
41
|
exports.readNxMigrateConfig = readNxMigrateConfig;
|
41
|
-
function buildTargetFromScript(script) {
|
42
|
+
function buildTargetFromScript(script, scripts = {}) {
|
43
|
+
const packageManagerCommand = (0, package_manager_1.getPackageManagerCommand)();
|
42
44
|
return {
|
43
45
|
executor: 'nx:run-script',
|
44
46
|
options: {
|
45
47
|
script,
|
46
48
|
},
|
49
|
+
metadata: {
|
50
|
+
scriptContent: scripts[script],
|
51
|
+
runCommand: packageManagerCommand.run(script),
|
52
|
+
},
|
47
53
|
};
|
48
54
|
}
|
49
55
|
exports.buildTargetFromScript = buildTargetFromScript;
|
@@ -53,7 +59,7 @@ function readTargetsFromPackageJson(packageJson) {
|
|
53
59
|
const includedScripts = nx?.includedScripts || Object.keys(scripts ?? {});
|
54
60
|
//
|
55
61
|
for (const script of includedScripts) {
|
56
|
-
res[script] = buildTargetFromScript(script);
|
62
|
+
res[script] = buildTargetFromScript(script, scripts);
|
57
63
|
}
|
58
64
|
for (const targetName in nx?.targets) {
|
59
65
|
res[targetName] = (0, project_configuration_utils_1.mergeTargetConfigurations)(nx?.targets[targetName], res[targetName]);
|
@@ -74,7 +74,7 @@ function getPackageManagerCommand(packageManager = detectPackageManager(), root
|
|
74
74
|
rm: 'yarn remove',
|
75
75
|
exec: 'yarn',
|
76
76
|
dlx: useBerry ? 'yarn dlx' : 'yarn',
|
77
|
-
run: (script, args) => `yarn ${script} ${args}`,
|
77
|
+
run: (script, args) => `yarn ${script}${args ? ` ${args}` : ''}`,
|
78
78
|
list: useBerry ? 'yarn info --name-only' : 'yarn list',
|
79
79
|
getRegistryUrl: useBerry
|
80
80
|
? 'yarn config get npmRegistryServer'
|
@@ -95,9 +95,11 @@ function getPackageManagerCommand(packageManager = detectPackageManager(), root
|
|
95
95
|
rm: 'pnpm rm',
|
96
96
|
exec: modernPnpm ? 'pnpm exec' : 'pnpx',
|
97
97
|
dlx: modernPnpm ? 'pnpm dlx' : 'pnpx',
|
98
|
-
run: (script, args) =>
|
99
|
-
?
|
100
|
-
|
98
|
+
run: (script, args) => `pnpm run ${script}${args
|
99
|
+
? includeDoubleDashBeforeArgs
|
100
|
+
? ' -- ' + args
|
101
|
+
: ` ${args}`
|
102
|
+
: ''}`,
|
101
103
|
list: 'pnpm ls --depth 100',
|
102
104
|
getRegistryUrl: 'pnpm config get registry',
|
103
105
|
};
|
@@ -114,7 +116,7 @@ function getPackageManagerCommand(packageManager = detectPackageManager(), root
|
|
114
116
|
rm: 'npm rm',
|
115
117
|
exec: 'npx',
|
116
118
|
dlx: 'npx',
|
117
|
-
run: (script, args) => `npm run ${script} --
|
119
|
+
run: (script, args) => `npm run ${script}${args ? ' -- ' + args : ''}`,
|
118
120
|
list: 'npm ls',
|
119
121
|
getRegistryUrl: 'npm config get registry',
|
120
122
|
};
|