UNPKG

dotnet-sdk-3.1

Version:

Platform agnostic installation of .NET Core runtime 3.1

31 lines 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const path_1 = require("path"); const os_1 = require("os"); const fs_1 = require("fs"); const pkg = require("../package.json"); exports.basename = pkg.basename; const dotnetVersion = pkg['dotnet-version']; exports.basePath = process.env.DOTNET_SHARED_HOME || path_1.normalize(`${os_1.homedir()}/.net/${dotnetVersion}`); const architecture = process.env.DOTNET_SHARED_ARCH || detectArchitecture(); exports.dotnetPackageName = `${exports.basename}-${dotnetVersion}-${architecture}`; exports.installationPath = path_1.join(exports.basePath, `node_modules/${exports.dotnetPackageName}/`); exports.packageJsonPath = path_1.join(exports.installationPath, "package.json"); exports.fileExists = (path) => { try { return fs_1.statSync(path).isFile(); } catch (_a) { return false; } }; function detectArchitecture() { switch (os_1.platform()) { case 'darwin': return `osx-${os_1.arch()}`; case 'linux': return `linux-${os_1.arch()}`; case 'win32': return `win-${os_1.arch()}`; } throw new Error(`Unsupported Platform: ${os_1.platform()}`); } //# sourceMappingURL=common.js.map