@react-native-windows/find-dotnet-tools 0.0.0-canary.2 → 0.0.0-canary.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.
|
@@ -10,7 +10,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.findPowerShell = exports.getNugetGlobalPackagesFolder = void 0;
|
|
12
12
|
const child_process_1 = require("child_process");
|
|
13
|
-
const
|
|
13
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
14
14
|
const os_1 = __importDefault(require("os"));
|
|
15
15
|
const path_1 = __importDefault(require("path"));
|
|
16
16
|
/**
|
|
@@ -48,7 +48,7 @@ function findPowerShell() {
|
|
|
48
48
|
if (!process.env.TF_BUILD) {
|
|
49
49
|
const nugetPackages = getNugetGlobalPackagesFolder();
|
|
50
50
|
const nugetPwsh = path_1.default.join(nugetPackages, 'PowerShell', '7.6.1', 'tools', 'net10.0', 'any', 'win', 'pwsh.exe');
|
|
51
|
-
if (
|
|
51
|
+
if (node_fs_1.default.existsSync(nugetPwsh)) {
|
|
52
52
|
return nugetPwsh;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findDotnetTools.js","sourceRoot":"","sources":["../src/findDotnetTools.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,iDAAuC;AACvC,
|
|
1
|
+
{"version":3,"file":"findDotnetTools.js","sourceRoot":"","sources":["../src/findDotnetTools.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,iDAAuC;AACvC,sDAAyB;AACzB,4CAAoB;AACpB,gDAAwB;AAExB;;;;;GAKG;AACH,SAAgB,4BAA4B;IAC1C,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE;QAC9B,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;KACnC;IACD,IAAI;QACF,MAAM,MAAM,GAAG,IAAA,wBAAQ,EAAC,gDAAgD,EAAE;YACxE,QAAQ,EAAE,MAAM;SACjB,CAAC,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;QACvD,IAAI,KAAK,EAAE;YACT,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACxB;KACF;IAAC,MAAM,GAAE;IACV,OAAO,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AACvD,CAAC;AAdD,oEAcC;AAED;;;;;;GAMG;AACH,SAAgB,cAAc;IAC5B,wDAAwD;IACxD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE;QACzB,MAAM,aAAa,GAAG,4BAA4B,EAAE,CAAC;QACrD,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CACzB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,OAAO,EACP,SAAS,EACT,KAAK,EACL,KAAK,EACL,UAAU,CACX,CAAC;QACF,IAAI,iBAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;YAC5B,OAAO,SAAS,CAAC;SAClB;KACF;IAED,IAAI;QACF,MAAM,KAAK,GAAG,IAAA,wBAAQ,EAAC,gBAAgB,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACpE,IAAI,KAAK,EAAE;YACT,OAAO,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;SAChC;KACF;IAAC,MAAM,GAAE;IAEV,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;AACJ,CAAC;AA7BD,wCA6BC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\nimport {execSync} from 'child_process';\nimport fs from 'node:fs';\nimport os from 'os';\nimport path from 'path';\n\n/**\n * Returns the path to the global NuGet packages folder, checking (in order):\n * 1. The NUGET_PACKAGES environment variable\n * 2. The `dotnet nuget locals` command output\n * 3. The default ~/.nuget/packages location\n */\nexport function getNugetGlobalPackagesFolder(): string {\n if (process.env.NUGET_PACKAGES) {\n return process.env.NUGET_PACKAGES;\n }\n try {\n const output = execSync('dotnet.exe nuget locals global-packages --list', {\n encoding: 'utf8',\n }).trim();\n const match = output.match(/global-packages:\\s*(.+)/i);\n if (match) {\n return match[1].trim();\n }\n } catch {}\n return path.join(os.homedir(), '.nuget', 'packages');\n}\n\n/**\n * Locates a PowerShell executable, checking (in order):\n * 1. A NuGet-restored copy of pwsh (skipped in CI builds)\n * 2. pwsh.exe on the system PATH\n *\n * Throws if no pwsh.exe can be located.\n */\nexport function findPowerShell(): string {\n // Build agents already have PowerShell (pwsh) installed\n if (!process.env.TF_BUILD) {\n const nugetPackages = getNugetGlobalPackagesFolder();\n const nugetPwsh = path.join(\n nugetPackages,\n 'PowerShell',\n '7.6.1',\n 'tools',\n 'net10.0',\n 'any',\n 'win',\n 'pwsh.exe',\n );\n if (fs.existsSync(nugetPwsh)) {\n return nugetPwsh;\n }\n }\n\n try {\n const found = execSync('where pwsh.exe', {encoding: 'utf8'}).trim();\n if (found) {\n return found.split(/\\r?\\n/)[0];\n }\n } catch {}\n\n throw new Error(\n 'Unable to find pwsh.exe. It should have been made available by `yarn install`.',\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-windows/find-dotnet-tools",
|
|
3
3
|
"description": "Helpers to locate .NET-based tools (e.g. pwsh) restored via NuGet or available on PATH.",
|
|
4
|
-
"version": "0.0.0-canary.
|
|
4
|
+
"version": "0.0.0-canary.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "rnw-scripts build",
|
|
@@ -16,9 +16,6 @@
|
|
|
16
16
|
"url": "https://github.com/microsoft/react-native-windows",
|
|
17
17
|
"directory": "packages/@react-native-windows/find-dotnet-tools"
|
|
18
18
|
},
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"@react-native-windows/fs": "^0.0.0-canary.72"
|
|
21
|
-
},
|
|
22
19
|
"devDependencies": {
|
|
23
20
|
"@rnw-scripts/eslint-config": "1.2.38",
|
|
24
21
|
"@rnw-scripts/just-task": "2.3.58",
|