@nx/dotnet 24.0.0-beta.2 → 24.0.0-beta.4
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.
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateNodes, TargetConfiguration } from '@nx/devkit';
|
|
1
|
+
import { CreateNodes, ProjectConfiguration, TargetConfiguration } from '@nx/devkit';
|
|
2
2
|
export type TargetConfigurationWithName = Partial<TargetConfiguration> & {
|
|
3
3
|
/**
|
|
4
4
|
* The name of the target. Defaults to the target type (e.g., 'build', 'test', etc.)
|
|
@@ -54,10 +54,12 @@ export interface DotNetPluginOptions {
|
|
|
54
54
|
*/
|
|
55
55
|
clean?: TargetConfigurationWithName | false;
|
|
56
56
|
/**
|
|
57
|
-
* Configuration for the restore target.
|
|
58
|
-
*
|
|
57
|
+
* Configuration for the restore target, which is not created by default.
|
|
58
|
+
* Set to `true`, or provide a configuration object, to opt in. `restore` is
|
|
59
|
+
* neither cached nor part of the task chain, so running it through Nx behaves
|
|
60
|
+
* the same as running `dotnet restore` directly.
|
|
59
61
|
*/
|
|
60
|
-
restore?: TargetConfigurationWithName |
|
|
62
|
+
restore?: TargetConfigurationWithName | boolean;
|
|
61
63
|
/**
|
|
62
64
|
* Configuration for the publish target.
|
|
63
65
|
* Use `targetName` to rename the target, and provide additional options/configurations to merge with the generated target.
|
|
@@ -79,6 +81,10 @@ export interface DotNetPluginOptions {
|
|
|
79
81
|
*/
|
|
80
82
|
run?: TargetConfigurationWithName | false;
|
|
81
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Merge user-specified target configurations with the generated targets from the analyzer
|
|
86
|
+
*/
|
|
87
|
+
export declare function mergeUserTargetConfigurations(node: ProjectConfiguration, options: DotNetPluginOptions | undefined): ProjectConfiguration;
|
|
82
88
|
export declare const createNodes: CreateNodes<DotNetPluginOptions>;
|
|
83
89
|
/**
|
|
84
90
|
* @deprecated Use {@link createNodes} instead. This will be removed in Nx 24.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-nodes.d.ts","sourceRoot":"","sources":["../../src/plugins/create-nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,
|
|
1
|
+
{"version":3,"file":"create-nodes.d.ts","sourceRoot":"","sources":["../../src/plugins/create-nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAEX,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAQpB,MAAM,MAAM,2BAA2B,GAAG,OAAO,CAAC,mBAAmB,CAAC,GAAG;IACvE;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,KAAK,CAAC,EAAE,2BAA2B,GAAG,KAAK,CAAC;IAC5C;;;OAGG;IACH,IAAI,CAAC,EAAE,2BAA2B,GAAG,KAAK,CAAC;IAC3C;;;OAGG;IACH,KAAK,CAAC,EAAE,2BAA2B,GAAG,KAAK,CAAC;IAC5C;;;;;OAKG;IACH,OAAO,CAAC,EAAE,2BAA2B,GAAG,OAAO,CAAC;IAChD;;;OAGG;IACH,OAAO,CAAC,EAAE,2BAA2B,GAAG,KAAK,CAAC;IAC9C;;;OAGG;IACH,IAAI,CAAC,EAAE,2BAA2B,GAAG,KAAK,CAAC;IAC3C;;;OAGG;IACH,KAAK,CAAC,EAAE,2BAA2B,GAAG,KAAK,CAAC;IAC5C;;;OAGG;IACH,GAAG,CAAC,EAAE,2BAA2B,GAAG,KAAK,CAAC;CAC3C;AAaD;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,oBAAoB,EAC1B,OAAO,EAAE,mBAAmB,GAAG,SAAS,GACvC,oBAAoB,CAuEtB;AA0BD,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,mBAAmB,CAsFxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,kCAAc,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createNodesV2 = exports.createNodes = void 0;
|
|
4
|
+
exports.mergeUserTargetConfigurations = mergeUserTargetConfigurations;
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const analyzer_client_1 = require("../analyzer/analyzer-client");
|
|
6
7
|
const internal_1 = require("@nx/devkit/internal");
|
|
@@ -17,28 +18,33 @@ const dotnetProjectGlob = '**/{*.{csproj,fsproj,vbproj,props,targets},Directory.
|
|
|
17
18
|
* Merge user-specified target configurations with the generated targets from the analyzer
|
|
18
19
|
*/
|
|
19
20
|
function mergeUserTargetConfigurations(node, options) {
|
|
20
|
-
if (!node.targets
|
|
21
|
+
if (!node.targets) {
|
|
21
22
|
return node;
|
|
22
23
|
}
|
|
24
|
+
const pluginOptions = options ?? {};
|
|
23
25
|
const targetMappings = [
|
|
24
|
-
{ targetOption:
|
|
25
|
-
{ targetOption:
|
|
26
|
-
{ targetOption:
|
|
27
|
-
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
{ targetOption: pluginOptions.build, defaultTargetName: 'build' },
|
|
27
|
+
{ targetOption: pluginOptions.test, defaultTargetName: 'test' },
|
|
28
|
+
{ targetOption: pluginOptions.clean, defaultTargetName: 'clean' },
|
|
29
|
+
{
|
|
30
|
+
targetOption: pluginOptions.restore,
|
|
31
|
+
defaultTargetName: 'restore',
|
|
32
|
+
optIn: true,
|
|
33
|
+
},
|
|
34
|
+
{ targetOption: pluginOptions.publish, defaultTargetName: 'publish' },
|
|
35
|
+
{ targetOption: pluginOptions.pack, defaultTargetName: 'pack' },
|
|
36
|
+
{ targetOption: pluginOptions.watch, defaultTargetName: 'watch' },
|
|
37
|
+
{ targetOption: pluginOptions.run, defaultTargetName: 'run' },
|
|
32
38
|
];
|
|
33
39
|
const mergedTargets = { ...node.targets };
|
|
34
|
-
for (const { targetOption, defaultTargetName } of targetMappings) {
|
|
35
|
-
|
|
36
|
-
if (targetOption === false) {
|
|
40
|
+
for (const { targetOption, defaultTargetName, optIn } of targetMappings) {
|
|
41
|
+
if (targetOption === false || (optIn && targetOption === undefined)) {
|
|
37
42
|
delete mergedTargets[defaultTargetName];
|
|
43
|
+
removeFromDependsOn(mergedTargets, defaultTargetName);
|
|
38
44
|
continue;
|
|
39
45
|
}
|
|
40
|
-
//
|
|
41
|
-
const { targetName, ...userSpecifiedConfig } = targetOption ?? {};
|
|
46
|
+
// `true` opts a target in and carries no configuration of its own.
|
|
47
|
+
const { targetName, ...userSpecifiedConfig } = targetOption === true ? {} : (targetOption ?? {});
|
|
42
48
|
const actualTargetName = targetName ?? defaultTargetName;
|
|
43
49
|
// Find the generated target - it might be under the default name or the user-specified name
|
|
44
50
|
const generatedTarget = mergedTargets[actualTargetName] ?? mergedTargets[defaultTargetName];
|
|
@@ -65,6 +71,24 @@ function mergeUserTargetConfigurations(node, options) {
|
|
|
65
71
|
targets: mergedTargets,
|
|
66
72
|
};
|
|
67
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Drops a removed target from the remaining targets' `dependsOn`. `watch`
|
|
76
|
+
* depends on `restore`, and Nx silently skips a dependency naming a target the
|
|
77
|
+
* project does not have, so a leftover entry is inert but still advertises a
|
|
78
|
+
* target that no longer exists.
|
|
79
|
+
*/
|
|
80
|
+
function removeFromDependsOn(targets, removed) {
|
|
81
|
+
for (const [name, target] of Object.entries(targets)) {
|
|
82
|
+
if (!target.dependsOn)
|
|
83
|
+
continue;
|
|
84
|
+
const dependsOn = target.dependsOn.filter((dependency) => typeof dependency === 'string'
|
|
85
|
+
? dependency !== removed && dependency !== `^${removed}`
|
|
86
|
+
: dependency.target !== removed);
|
|
87
|
+
if (dependsOn.length !== target.dependsOn.length) {
|
|
88
|
+
targets[name] = { ...target, dependsOn };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
68
92
|
exports.createNodes = [
|
|
69
93
|
dotnetProjectGlob,
|
|
70
94
|
async (configFilePaths, options, context) => {
|
|
@@ -80,7 +104,8 @@ exports.createNodes = [
|
|
|
80
104
|
'test',
|
|
81
105
|
cleanTargetName: (normalizedOptions.clean && normalizedOptions.clean.targetName) ||
|
|
82
106
|
'clean',
|
|
83
|
-
restoreTargetName: (normalizedOptions.restore
|
|
107
|
+
restoreTargetName: (typeof normalizedOptions.restore === 'object' &&
|
|
108
|
+
normalizedOptions.restore.targetName) ||
|
|
84
109
|
'restore',
|
|
85
110
|
publishTargetName: (normalizedOptions.publish && normalizedOptions.publish.targetName) ||
|
|
86
111
|
'publish',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/dotnet",
|
|
3
|
-
"version": "24.0.0-beta.
|
|
3
|
+
"version": "24.0.0-beta.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for .NET containing graph support for working with .NET projects in an Nx workspace.",
|
|
6
6
|
"keywords": [
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"!dist/tsconfig.lib.tsbuildinfo"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@nx/devkit": "24.0.0-beta.
|
|
50
|
+
"@nx/devkit": "24.0.0-beta.4",
|
|
51
51
|
"tslib": "^2.3.0",
|
|
52
52
|
"ignore": "^7.0.5"
|
|
53
53
|
},
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@types/node": "^24.11.0",
|
|
57
57
|
"jest": "30.3.0",
|
|
58
58
|
"memfs": "^4.9.2",
|
|
59
|
-
"nx": "24.0.0-beta.
|
|
59
|
+
"nx": "24.0.0-beta.4",
|
|
60
60
|
"ts-jest": "^29.4.7",
|
|
61
61
|
"typescript": "~6.0.3"
|
|
62
62
|
},
|