@nx/dotnet 0.0.0-pr-32869-39cffae
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/LICENSE +22 -0
- package/README.md +7 -0
- package/README.md__tmpl__ +7 -0
- package/dist/generators/init/init.d.ts +6 -0
- package/dist/generators/init/init.d.ts.map +1 -0
- package/dist/generators/init/init.js +59 -0
- package/dist/generators/init/schema.json +34 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +6 -0
- package/dist/plugins/plugin.d.ts +12 -0
- package/dist/plugins/plugin.d.ts.map +1 -0
- package/dist/plugins/plugin.js +130 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/dist/utils/cache.d.ts +5 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +14 -0
- package/dist/utils/dependency-detection.d.ts +5 -0
- package/dist/utils/dependency-detection.d.ts.map +1 -0
- package/dist/utils/dependency-detection.js +58 -0
- package/dist/utils/dotnet-cli.d.ts +9 -0
- package/dist/utils/dotnet-cli.d.ts.map +1 -0
- package/dist/utils/dotnet-cli.js +39 -0
- package/dist/utils/dotnet-project-parser.d.ts +13 -0
- package/dist/utils/dotnet-project-parser.d.ts.map +1 -0
- package/dist/utils/dotnet-project-parser.js +83 -0
- package/dist/utils/has-dotnet-plugin.d.ts +3 -0
- package/dist/utils/has-dotnet-plugin.d.ts.map +1 -0
- package/dist/utils/has-dotnet-plugin.js +8 -0
- package/dist/utils/logger.d.ts +3 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +24 -0
- package/dist/utils/target-builder.d.ts +12 -0
- package/dist/utils/target-builder.d.ts.map +1 -0
- package/dist/utils/target-builder.js +525 -0
- package/dist/utils/versions.d.ts +2 -0
- package/dist/utils/versions.d.ts.map +1 -0
- package/dist/utils/versions.js +5 -0
- package/generators.json +10 -0
- package/package.json +71 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface DotNetClient {
|
|
2
|
+
getProjectReferencesAsync(projectFile: string): Promise<string[]>;
|
|
3
|
+
}
|
|
4
|
+
export declare class NativeDotNetClient implements DotNetClient {
|
|
5
|
+
private workspaceRoot;
|
|
6
|
+
constructor(workspaceRoot: string);
|
|
7
|
+
getProjectReferencesAsync(projectFile: string): Promise<string[]>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=dotnet-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dotnet-cli.d.ts","sourceRoot":"","sources":["../../src/utils/dotnet-cli.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CACnE;AAED,qBAAa,kBAAmB,YAAW,YAAY;IACzC,OAAO,CAAC,aAAa;gBAAb,aAAa,EAAE,MAAM;IAEnC,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAyCxE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NativeDotNetClient = void 0;
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
const logger_1 = require("./logger");
|
|
6
|
+
class NativeDotNetClient {
|
|
7
|
+
constructor(workspaceRoot) {
|
|
8
|
+
this.workspaceRoot = workspaceRoot;
|
|
9
|
+
}
|
|
10
|
+
async getProjectReferencesAsync(projectFile) {
|
|
11
|
+
try {
|
|
12
|
+
(0, logger_1.verboseLog)(`[dotnet-cli] Getting references for: ${projectFile}`);
|
|
13
|
+
(0, logger_1.verboseLog)(`[dotnet-cli] Working directory: ${this.workspaceRoot}`);
|
|
14
|
+
const command = `dotnet list "${projectFile}" reference`;
|
|
15
|
+
(0, logger_1.verboseLog)(`[dotnet-cli] Command: ${command}`);
|
|
16
|
+
const output = (0, node_child_process_1.execSync)(command, {
|
|
17
|
+
cwd: this.workspaceRoot,
|
|
18
|
+
encoding: 'utf8',
|
|
19
|
+
windowsHide: true,
|
|
20
|
+
stdio: ['pipe', 'pipe', 'ignore'], // Suppress stderr
|
|
21
|
+
});
|
|
22
|
+
(0, logger_1.verboseLog)(`[dotnet-cli] Raw output (${output.length} chars):`);
|
|
23
|
+
(0, logger_1.verboseLog)(`[dotnet-cli] ${output.split('\n').join('\n[dotnet-cli] ')}`);
|
|
24
|
+
const references = output
|
|
25
|
+
.split('\n')
|
|
26
|
+
.slice(2) // Skip header lines
|
|
27
|
+
.map((line) => line.trim())
|
|
28
|
+
.filter((line) => line.length > 0);
|
|
29
|
+
(0, logger_1.verboseLog)(`[dotnet-cli] Parsed references (${references.length}): ${JSON.stringify(references)}`);
|
|
30
|
+
return references;
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
(0, logger_1.verboseError)(`[dotnet-cli] Failed to get project references for ${projectFile}: ${error.message}`);
|
|
34
|
+
(0, logger_1.verboseError)(`[dotnet-cli] Error details: ${JSON.stringify(error, null, 2)}`);
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.NativeDotNetClient = NativeDotNetClient;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ProjectInfo {
|
|
2
|
+
targetFramework?: string;
|
|
3
|
+
outputType?: string;
|
|
4
|
+
packageReferences: string[];
|
|
5
|
+
projectReferences: string[];
|
|
6
|
+
isTestProject: boolean;
|
|
7
|
+
isExecutable: boolean;
|
|
8
|
+
projectType: 'csharp' | 'fsharp' | 'vb';
|
|
9
|
+
}
|
|
10
|
+
export declare function parseProjectFile(projectFilePath: string): ProjectInfo;
|
|
11
|
+
export declare function inferProjectName(configFilePath: string): string;
|
|
12
|
+
export declare function extractProjectNameFromFile(projectFileName: string): string;
|
|
13
|
+
//# sourceMappingURL=dotnet-project-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dotnet-project-parser.d.ts","sourceRoot":"","sources":["../../src/utils/dotnet-project-parser.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,QAAQ,GAAG,QAAQ,GAAG,IAAI,CAAC;CACzC;AAED,wBAAgB,gBAAgB,CAAC,eAAe,EAAE,MAAM,GAAG,WAAW,CAmErE;AAED,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAU/D;AAED,wBAAgB,0BAA0B,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAU1E"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseProjectFile = parseProjectFile;
|
|
4
|
+
exports.inferProjectName = inferProjectName;
|
|
5
|
+
exports.extractProjectNameFromFile = extractProjectNameFromFile;
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
function parseProjectFile(projectFilePath) {
|
|
9
|
+
const content = (0, node_fs_1.readFileSync)(projectFilePath, 'utf-8');
|
|
10
|
+
const packageReferences = [];
|
|
11
|
+
const projectReferences = [];
|
|
12
|
+
// Simple regex parsing for MSBuild project files
|
|
13
|
+
const packageReferenceRegex = /<PackageReference\s+Include="([^"]+)"/g;
|
|
14
|
+
const projectReferenceRegex = /<ProjectReference\s+Include="([^"]+)"/g;
|
|
15
|
+
const targetFrameworkRegex = /<TargetFramework>([^<]+)<\/TargetFramework>/;
|
|
16
|
+
const outputTypeRegex = /<OutputType>([^<]+)<\/OutputType>/;
|
|
17
|
+
let match;
|
|
18
|
+
while ((match = packageReferenceRegex.exec(content)) !== null) {
|
|
19
|
+
packageReferences.push(match[1]);
|
|
20
|
+
}
|
|
21
|
+
while ((match = projectReferenceRegex.exec(content)) !== null) {
|
|
22
|
+
projectReferences.push(match[1]);
|
|
23
|
+
}
|
|
24
|
+
const targetFrameworkMatch = content.match(targetFrameworkRegex);
|
|
25
|
+
const outputTypeMatch = content.match(outputTypeRegex);
|
|
26
|
+
const targetFramework = targetFrameworkMatch?.[1];
|
|
27
|
+
const outputType = outputTypeMatch?.[1];
|
|
28
|
+
// Detect test projects by common test package references
|
|
29
|
+
const testPackages = [
|
|
30
|
+
'Microsoft.NET.Test.Sdk',
|
|
31
|
+
'xunit',
|
|
32
|
+
'xunit.runner.visualstudio',
|
|
33
|
+
'MSTest.TestAdapter',
|
|
34
|
+
'MSTest.TestFramework',
|
|
35
|
+
'NUnit',
|
|
36
|
+
'NUnit3TestAdapter',
|
|
37
|
+
];
|
|
38
|
+
const isTestProject = packageReferences.some((pkg) => testPackages.some((testPkg) => pkg.includes(testPkg)));
|
|
39
|
+
const isExecutable = outputType?.toLowerCase() === 'exe' ||
|
|
40
|
+
content.includes('<OutputType>Exe</OutputType>');
|
|
41
|
+
// Determine project type from file extension
|
|
42
|
+
const { ext } = (0, node_path_1.parse)(projectFilePath);
|
|
43
|
+
let projectType;
|
|
44
|
+
switch (ext) {
|
|
45
|
+
case '.fsproj':
|
|
46
|
+
projectType = 'fsharp';
|
|
47
|
+
break;
|
|
48
|
+
case '.vbproj':
|
|
49
|
+
projectType = 'vb';
|
|
50
|
+
break;
|
|
51
|
+
default:
|
|
52
|
+
projectType = 'csharp';
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
targetFramework,
|
|
56
|
+
outputType,
|
|
57
|
+
packageReferences,
|
|
58
|
+
projectReferences,
|
|
59
|
+
isTestProject,
|
|
60
|
+
isExecutable,
|
|
61
|
+
projectType,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function inferProjectName(configFilePath) {
|
|
65
|
+
const { name } = (0, node_path_1.parse)(configFilePath);
|
|
66
|
+
// Convert PascalCase to kebab-case for regular project names
|
|
67
|
+
return name
|
|
68
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
|
69
|
+
.toLowerCase()
|
|
70
|
+
.replace(/[^a-z0-9\-]/g, '-')
|
|
71
|
+
.replace(/-+/g, '-')
|
|
72
|
+
.replace(/^-|-$/g, '');
|
|
73
|
+
}
|
|
74
|
+
function extractProjectNameFromFile(projectFileName) {
|
|
75
|
+
const { name } = (0, node_path_1.parse)(projectFileName);
|
|
76
|
+
// Convert PascalCase to kebab-case for target names
|
|
77
|
+
return name
|
|
78
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
|
79
|
+
.toLowerCase()
|
|
80
|
+
.replace(/[^a-z0-9\-]/g, '-')
|
|
81
|
+
.replace(/-+/g, '-')
|
|
82
|
+
.replace(/^-|-$/g, '');
|
|
83
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-dotnet-plugin.d.ts","sourceRoot":"","sources":["../../src/utils/has-dotnet-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,IAAI,EAAE,MAAM,YAAY,CAAC;AAE9C,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAKnD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasDotNetPlugin = hasDotNetPlugin;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function hasDotNetPlugin(tree) {
|
|
6
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
7
|
+
return !!nxJson.plugins?.some((p) => typeof p === 'string' ? p === '@nx/dotnet' : p.plugin === '@nx/dotnet');
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAaA,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIhD;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIlD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verboseLog = verboseLog;
|
|
4
|
+
exports.verboseError = verboseError;
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
let verboseLoggingEnabled;
|
|
7
|
+
function isVerboseLoggingEnabled() {
|
|
8
|
+
if (verboseLoggingEnabled === undefined) {
|
|
9
|
+
verboseLoggingEnabled =
|
|
10
|
+
process.env.NX_DOTNET_VERBOSE_LOGGING === 'true' ||
|
|
11
|
+
process.env.NX_VERBOSE_LOGGING === 'true';
|
|
12
|
+
}
|
|
13
|
+
return verboseLoggingEnabled;
|
|
14
|
+
}
|
|
15
|
+
function verboseLog(message) {
|
|
16
|
+
if (isVerboseLoggingEnabled()) {
|
|
17
|
+
devkit_1.logger.log(message);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function verboseError(message) {
|
|
21
|
+
if (isVerboseLoggingEnabled()) {
|
|
22
|
+
devkit_1.logger.error(message);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CreateNodesContextV2 } from '@nx/devkit';
|
|
2
|
+
import { DotNetTargets } from './cache';
|
|
3
|
+
export interface NormalizedOptions {
|
|
4
|
+
buildTargetName: string;
|
|
5
|
+
testTargetName: string;
|
|
6
|
+
cleanTargetName: string;
|
|
7
|
+
restoreTargetName: string;
|
|
8
|
+
publishTargetName: string;
|
|
9
|
+
packTargetName: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function buildDotNetTargets(projectRoot: string, projectFiles: string[], options: NormalizedOptions, context: CreateNodesContextV2): Promise<DotNetTargets>;
|
|
12
|
+
//# sourceMappingURL=target-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target-builder.d.ts","sourceRoot":"","sources":["../../src/utils/target-builder.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EAGrB,MAAM,YAAY,CAAC;AAOpB,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;CACxB;AASD,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EAAE,EACtB,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,aAAa,CAAC,CAyHxB"}
|