dotnet-2.0.0
Version:
Platform agnostic installation of .NET Core runtime 2.0.0
41 lines • 1.63 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const common_1 = require("./common");
// don't go for global installed stuff.
process.env["DOTNET_MULTILEVEL_LOOKUP"] = "0";
const verbose = process.env.DEBUG;
const debug = verbose ? console.error : (message, ...optionalParams) => { };
const skipSDK = process.env.NO_NET_SDK || common_1.basename !== 'dotnet';
// if this is the .net runtime, try the SDK command first (if it's local).
skipSDK ? tryDotNet() : tryDotNetSDK();
function tryDotNetSDK() {
debug("Trying local dotnet sdk.");
try {
require("dotnet-sdk-2.0.0/dist/call.js");
}
catch (_a) {
tryDotNet();
}
}
function tryDotNet() {
// try local node_modules
debug(`Trying local dotnet package: ${common_1.dotnetPackageName}`);
try {
require(common_1.dotnetPackageName);
}
catch (_a) {
// run the dotnet package
debug(`Trying user dotnet package: ${common_1.installationPath}`);
try {
require(common_1.installationPath);
}
catch (_b) {
// inline install and try again
debug(`Installing dotnet package: ${common_1.installationPath}`);
require("child_process").spawn(process.execPath, [`${__dirname}/app.js`, "--force"], { stdio: verbose ? [process.stdin, process.stderr, process.stderr] : 'ignore' }).
on("exit", (code, signal) => code == 0 ? require(common_1.installationPath) : process.exit(console.error("Unable to install/use dotnet framework.") || code));
}
}
}
//# sourceMappingURL=call.js.map
;