@nx/devkit 19.0.0-canary.20240503-dbad02a → 19.0.0-canary.20240504-fd5ea92
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/devkit",
|
3
|
-
"version": "19.0.0-canary.
|
3
|
+
"version": "19.0.0-canary.20240504-fd5ea92",
|
4
4
|
"private": false,
|
5
5
|
"description": "The Nx Devkit is used to customize Nx for different technologies and use cases. It contains many utility functions for reading and writing files, updating configuration, working with Abstract Syntax Trees(ASTs), and more. Learn more about [extending Nx by leveraging the Nx Devkit](https://nx.dev/extending-nx/intro/getting-started) on our docs.",
|
6
6
|
"repository": {
|
@@ -36,7 +36,7 @@
|
|
36
36
|
"semver": "^7.5.3",
|
37
37
|
"yargs-parser": "21.1.1",
|
38
38
|
"minimatch": "9.0.3",
|
39
|
-
"@nrwl/devkit": "19.0.0-canary.
|
39
|
+
"@nrwl/devkit": "19.0.0-canary.20240504-fd5ea92"
|
40
40
|
},
|
41
41
|
"peerDependencies": {
|
42
42
|
"nx": ">= 17 <= 20"
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import { ProjectGraph, TargetConfiguration, Tree, CreateNodes } from 'nx/src/devkit-exports';
|
2
2
|
type PluginOptionsBuilder<T> = (targetName: string) => T;
|
3
|
-
type PostTargetTransformer = (targetConfiguration: TargetConfiguration, tree?: Tree
|
3
|
+
type PostTargetTransformer = (targetConfiguration: TargetConfiguration, tree?: Tree, projectDetails?: {
|
4
|
+
projectName: string;
|
5
|
+
root: string;
|
6
|
+
}) => TargetConfiguration;
|
4
7
|
type SkipTargetFilter = (targetConfiguration: TargetConfiguration) => [boolean, string];
|
5
|
-
export declare function migrateExecutorToPlugin<T>(tree: Tree, projectGraph: ProjectGraph, executor: string, pluginPath: string, pluginOptionsBuilder: PluginOptionsBuilder<T>, postTargetTransformer: PostTargetTransformer, createNodes: CreateNodes<T>, specificProjectToMigrate?: string, skipTargetFilter?: SkipTargetFilter): Promise<
|
8
|
+
export declare function migrateExecutorToPlugin<T>(tree: Tree, projectGraph: ProjectGraph, executor: string, pluginPath: string, pluginOptionsBuilder: PluginOptionsBuilder<T>, postTargetTransformer: PostTargetTransformer, createNodes: CreateNodes<T>, specificProjectToMigrate?: string, skipTargetFilter?: SkipTargetFilter): Promise<Map<string, Set<string>>>;
|
6
9
|
export {};
|
@@ -74,7 +74,10 @@ _ExecutorToPluginMigrator_projectGraph = new WeakMap(), _ExecutorToPluginMigrato
|
|
74
74
|
projectTarget = (0, devkit_internals_1.mergeTargetConfigurations)(projectTarget, tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_targetDefaultsForExecutor, "f"));
|
75
75
|
delete projectTarget.executor;
|
76
76
|
(0, plugin_migration_utils_1.deleteMatchingProperties)(projectTarget, createdTarget);
|
77
|
-
projectTarget = tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_postTargetTransformer, "f").call(this, projectTarget, this.tree
|
77
|
+
projectTarget = tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_postTargetTransformer, "f").call(this, projectTarget, this.tree, {
|
78
|
+
projectName,
|
79
|
+
root: projectFromGraph.data.root,
|
80
|
+
});
|
78
81
|
if (projectTarget.options &&
|
79
82
|
Object.keys(projectTarget.options).length === 0) {
|
80
83
|
delete projectTarget.options;
|
@@ -85,6 +88,9 @@ _ExecutorToPluginMigrator_projectGraph = new WeakMap(), _ExecutorToPluginMigrato
|
|
85
88
|
else {
|
86
89
|
delete projectConfig.targets[targetName];
|
87
90
|
}
|
91
|
+
if (!projectConfig['// targets']) {
|
92
|
+
projectConfig['// targets'] = `to see all targets run: nx show project ${projectName} --web`;
|
93
|
+
}
|
88
94
|
(0, devkit_exports_1.updateProjectConfiguration)(this.tree, projectName, projectConfig);
|
89
95
|
return `${projectFromGraph.data.root}/**/*`;
|
90
96
|
}, _ExecutorToPluginMigrator_addPlugins = function _ExecutorToPluginMigrator_addPlugins() {
|
@@ -123,6 +129,17 @@ _ExecutorToPluginMigrator_projectGraph = new WeakMap(), _ExecutorToPluginMigrato
|
|
123
129
|
}
|
124
130
|
}
|
125
131
|
if (!existingPlugin) {
|
132
|
+
const allConfigFilesAreIncluded = tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_configFiles, "f").every((configFile) => {
|
133
|
+
for (const includePattern of plugin.include) {
|
134
|
+
if ((0, minimatch_1.minimatch)(configFile, includePattern, { dot: true })) {
|
135
|
+
return true;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
return false;
|
139
|
+
});
|
140
|
+
if (allConfigFilesAreIncluded) {
|
141
|
+
plugin.include = undefined;
|
142
|
+
}
|
126
143
|
tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_nxJson, "f").plugins.push(plugin);
|
127
144
|
}
|
128
145
|
}
|
@@ -192,7 +209,6 @@ _ExecutorToPluginMigrator_projectGraph = new WeakMap(), _ExecutorToPluginMigrato
|
|
192
209
|
};
|
193
210
|
async function migrateExecutorToPlugin(tree, projectGraph, executor, pluginPath, pluginOptionsBuilder, postTargetTransformer, createNodes, specificProjectToMigrate, skipTargetFilter) {
|
194
211
|
const migrator = new ExecutorToPluginMigrator(tree, projectGraph, executor, pluginPath, pluginOptionsBuilder, postTargetTransformer, createNodes, specificProjectToMigrate, skipTargetFilter);
|
195
|
-
|
196
|
-
return migratedProjectsAndTargets.size;
|
212
|
+
return await migrator.run();
|
197
213
|
}
|
198
214
|
exports.migrateExecutorToPlugin = migrateExecutorToPlugin;
|