node-install-release 0.4.7 → 1.0.0
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/bin/cli.js +3 -0
- package/dist/cjs/arch.js +67 -0
- package/dist/cjs/arch.js.map +1 -0
- package/dist/cjs/checkMissing.js +48 -0
- package/dist/cjs/checkMissing.js.map +1 -0
- package/dist/cjs/cli.js +69 -0
- package/dist/cjs/cli.js.map +1 -0
- package/dist/cjs/conditionalCache.js +34 -0
- package/dist/cjs/conditionalCache.js.map +1 -0
- package/dist/cjs/conditionalCopy.js +27 -0
- package/dist/cjs/conditionalCopy.js.map +1 -0
- package/dist/cjs/conditionalExtract.js +33 -0
- package/dist/cjs/conditionalExtract.js.map +1 -0
- package/dist/cjs/copyFile.js +30 -0
- package/dist/cjs/copyFile.js.map +1 -0
- package/dist/cjs/endsWithFn.js +20 -0
- package/dist/cjs/endsWithFn.js.map +1 -0
- package/dist/cjs/ensureDestinationParent.js +16 -0
- package/dist/cjs/ensureDestinationParent.js.map +1 -0
- package/dist/cjs/index.js +35 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/install.js +54 -0
- package/dist/cjs/install.js.map +1 -0
- package/dist/cjs/installNPM/index.js +15 -0
- package/dist/cjs/installNPM/index.js.map +1 -0
- package/dist/cjs/installNPM/installBin.js +55 -0
- package/dist/cjs/installNPM/installBin.js.map +1 -0
- package/dist/cjs/installNPM/installLib.js +40 -0
- package/dist/cjs/installNPM/installLib.js.map +1 -0
- package/dist/cjs/installNode/filenames.js +41 -0
- package/dist/cjs/installNode/filenames.js.map +1 -0
- package/dist/cjs/installNode/findDistPaths.js +25 -0
- package/dist/cjs/installNode/findDistPaths.js.map +1 -0
- package/dist/cjs/installNode/index.js +31 -0
- package/dist/cjs/installNode/index.js.map +1 -0
- package/dist/cjs/installNode/installCompressed.js +38 -0
- package/dist/cjs/installNode/installCompressed.js.map +1 -0
- package/dist/cjs/installNode/installExe.js +23 -0
- package/dist/cjs/installNode/installExe.js.map +1 -0
- package/dist/cjs/installNode/installSource/buildPosix.js +35 -0
- package/dist/cjs/installNode/installSource/buildPosix.js.map +1 -0
- package/dist/cjs/installNode/installSource/buildWin32.js +31 -0
- package/dist/cjs/installNode/installSource/buildWin32.js.map +1 -0
- package/dist/cjs/installNode/installSource/index.js +27 -0
- package/dist/cjs/installNode/installSource/index.js.map +1 -0
- package/dist/cjs/installVersion.js +27 -0
- package/dist/cjs/installVersion.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/polyfills/execCallback.js +11 -0
- package/dist/cjs/polyfills/execCallback.js.map +1 -0
- package/dist/cjs/polyfills/index.js +21 -0
- package/dist/cjs/polyfills/index.js.map +1 -0
- package/dist/cjs/progress.js +13 -0
- package/dist/cjs/progress.js.map +1 -0
- package/dist/types/arch.d.ts +2 -0
- package/dist/types/checkMissing.d.ts +2 -0
- package/dist/types/cli.d.ts +2 -0
- package/dist/types/conditionalCache.d.ts +2 -0
- package/dist/types/conditionalCopy.d.ts +2 -0
- package/dist/types/conditionalExtract.d.ts +2 -0
- package/dist/types/copyFile.d.ts +2 -0
- package/dist/types/endsWithFn.d.ts +2 -0
- package/dist/types/ensureDestinationParent.d.ts +2 -0
- package/dist/types/index.d.mts +1 -0
- package/dist/types/install.d.ts +2 -0
- package/dist/types/installNPM/index.d.ts +2 -0
- package/dist/types/installNPM/installBin.d.ts +2 -0
- package/dist/types/installNPM/installLib.d.ts +2 -0
- package/dist/types/installNode/filenames.d.ts +2 -0
- package/dist/types/installNode/findDistPaths.d.ts +6 -0
- package/dist/types/installNode/index.d.ts +2 -0
- package/dist/types/installNode/installCompressed.d.ts +2 -0
- package/dist/types/installNode/installExe.d.ts +2 -0
- package/dist/types/installNode/installSource/buildPosix.d.ts +2 -0
- package/dist/types/installNode/installSource/buildWin32.d.ts +2 -0
- package/dist/types/installNode/installSource/index.d.ts +2 -0
- package/dist/types/installVersion.d.ts +2 -0
- package/dist/types/polyfills/execCallback.d.ts +4 -0
- package/dist/types/polyfills/index.d.ts +1 -0
- package/dist/types/progress.d.ts +2 -0
- package/package.json +28 -25
- package/bin/node-install-release.js +0 -46
- package/lib/arch.js +0 -72
- package/lib/checkMissing.js +0 -36
- package/lib/conditionalCache.js +0 -28
- package/lib/conditionalCopy.js +0 -25
- package/lib/conditionalExtract.js +0 -27
- package/lib/copyFile.js +0 -28
- package/lib/endsWithFn.js +0 -12
- package/lib/ensureDestinationParent.js +0 -10
- package/lib/index.js +0 -19
- package/lib/install.js +0 -45
- package/lib/installNPM/index.js +0 -9
- package/lib/installNPM/installBin.js +0 -31
- package/lib/installNPM/installLib.js +0 -39
- package/lib/installNode/filenames.js +0 -31
- package/lib/installNode/findDistPaths.js +0 -13
- package/lib/installNode/index.js +0 -25
- package/lib/installNode/installCompressed.js +0 -31
- package/lib/installNode/installExe.js +0 -19
- package/lib/installNode/installSource/buildPosix.js +0 -21
- package/lib/installNode/installSource/buildWin32.js +0 -25
- package/lib/installNode/installSource/index.js +0 -21
- package/lib/installVersion.js +0 -24
- package/lib/polyfills/execCallback.js +0 -5
- package/lib/polyfills/index.js +0 -15
- package/lib/progress.js +0 -7
package/bin/cli.js
ADDED
package/dist/cjs/arch.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Inline until merged: https://github.com/jakejarvis/arch/blob/detect-arm/index.js
|
|
2
|
+
/*! arch. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ "use strict";
|
|
3
|
+
var cp = require("child_process");
|
|
4
|
+
var fs = require("fs");
|
|
5
|
+
var path = require("path");
|
|
6
|
+
/**
|
|
7
|
+
* Returns the operating system's CPU architecture. This is different than
|
|
8
|
+
* `process.arch` or `os.arch()` which returns the architecture the Node.js (or
|
|
9
|
+
* Electron) binary was compiled for.
|
|
10
|
+
*/ module.exports = function arch() {
|
|
11
|
+
/**
|
|
12
|
+
* On macOS, we need to detect if x64 Node is running because the CPU is truly
|
|
13
|
+
* an Intel chip, or if it's running on Apple Silicon via Rosetta 2:
|
|
14
|
+
* https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment
|
|
15
|
+
*/ if (process.platform === "darwin") {
|
|
16
|
+
var nativeArm = process.arch === "arm64";
|
|
17
|
+
var rosettaArm = cp.execSync("sysctl -in sysctl.proc_translated", {
|
|
18
|
+
encoding: "utf8"
|
|
19
|
+
}) === "1\n";
|
|
20
|
+
return nativeArm || rosettaArm ? "arm64" : "x64";
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* On Windows, the most reliable way to detect a 64-bit OS from within a 32-bit
|
|
24
|
+
* app is based on the presence of a WOW64 file: %SystemRoot%\SysNative.
|
|
25
|
+
* See: https://twitter.com/feross/status/776949077208510464
|
|
26
|
+
*/ if (process.platform === "win32") {
|
|
27
|
+
var useEnv = false;
|
|
28
|
+
try {
|
|
29
|
+
useEnv = !!(process.env.SYSTEMROOT && fs.statSync(process.env.SYSTEMROOT));
|
|
30
|
+
} catch (_err) {}
|
|
31
|
+
var sysRoot = useEnv ? process.env.SYSTEMROOT : "C:\\Windows";
|
|
32
|
+
// If %SystemRoot%\SysNative exists, we are in a WOW64 FS Redirected application.
|
|
33
|
+
var isWOW64 = false;
|
|
34
|
+
try {
|
|
35
|
+
isWOW64 = !!fs.statSync(path.join(sysRoot, "sysnative"));
|
|
36
|
+
} catch (_err) {}
|
|
37
|
+
return isWOW64 ? "x64" : "x86";
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* On Linux, use the `getconf` command to get the architecture.
|
|
41
|
+
*/ if (process.platform === "linux") {
|
|
42
|
+
try {
|
|
43
|
+
var output1 = cp.execSync("uname -a", {
|
|
44
|
+
encoding: "utf8"
|
|
45
|
+
});
|
|
46
|
+
if (~output1.indexOf("raspberrypi")) return "arm-pi";
|
|
47
|
+
} catch (_err) {}
|
|
48
|
+
var output = cp.execSync("getconf LONG_BIT", {
|
|
49
|
+
encoding: "utf8"
|
|
50
|
+
});
|
|
51
|
+
return output === "64\n" ? "x64" : "x86";
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The running binary is 64-bit, so the OS is clearly 64-bit.
|
|
55
|
+
*/ if (process.arch === "x64") {
|
|
56
|
+
return "x64";
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* If none of the above, assume the architecture is 32-bit.
|
|
60
|
+
*/ return "x86";
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
64
|
+
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
65
|
+
for (var key in exports) exports.default[key] = exports[key];
|
|
66
|
+
module.exports = exports.default;
|
|
67
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["arch.js"],"sourcesContent":["// Inline until merged: https://github.com/jakejarvis/arch/blob/detect-arm/index.js\n\n/*! arch. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */\nconst cp = require('child_process');\nconst fs = require('fs');\nconst path = require('path');\n\n/**\n * Returns the operating system's CPU architecture. This is different than\n * `process.arch` or `os.arch()` which returns the architecture the Node.js (or\n * Electron) binary was compiled for.\n */\nmodule.exports = function arch() {\n /**\n * On macOS, we need to detect if x64 Node is running because the CPU is truly\n * an Intel chip, or if it's running on Apple Silicon via Rosetta 2:\n * https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment\n */\n if (process.platform === 'darwin') {\n const nativeArm = process.arch === 'arm64';\n const rosettaArm = cp.execSync('sysctl -in sysctl.proc_translated', { encoding: 'utf8' }) === '1\\n';\n\n return nativeArm || rosettaArm ? 'arm64' : 'x64';\n }\n\n /**\n * On Windows, the most reliable way to detect a 64-bit OS from within a 32-bit\n * app is based on the presence of a WOW64 file: %SystemRoot%\\SysNative.\n * See: https://twitter.com/feross/status/776949077208510464\n */\n if (process.platform === 'win32') {\n let useEnv = false;\n try {\n useEnv = !!(process.env.SYSTEMROOT && fs.statSync(process.env.SYSTEMROOT));\n } catch (_err) {}\n\n const sysRoot = useEnv ? process.env.SYSTEMROOT : 'C:\\\\Windows';\n\n // If %SystemRoot%\\SysNative exists, we are in a WOW64 FS Redirected application.\n let isWOW64 = false;\n try {\n isWOW64 = !!fs.statSync(path.join(sysRoot, 'sysnative'));\n } catch (_err) {}\n\n return isWOW64 ? 'x64' : 'x86';\n }\n\n /**\n * On Linux, use the `getconf` command to get the architecture.\n */\n if (process.platform === 'linux') {\n try {\n const output1 = cp.execSync('uname -a', { encoding: 'utf8' });\n if (~output1.indexOf('raspberrypi')) return 'arm-pi';\n } catch (_err) {}\n\n const output = cp.execSync('getconf LONG_BIT', { encoding: 'utf8' });\n return output === '64\\n' ? 'x64' : 'x86';\n }\n\n /**\n * The running binary is 64-bit, so the OS is clearly 64-bit.\n */\n if (process.arch === 'x64') {\n return 'x64';\n }\n\n /**\n * If none of the above, assume the architecture is 32-bit.\n */\n return 'x86';\n};\n"],"names":["cp","require","fs","path","module","exports","arch","process","platform","nativeArm","rosettaArm","execSync","encoding","useEnv","env","SYSTEMROOT","statSync","_err","sysRoot","isWOW64","join","output1","indexOf","output"],"mappings":"AAAA,mFAAmF;AAEnF,2EAA2E;AAC3E,IAAMA,KAAKC,QAAQ;AACnB,IAAMC,KAAKD,QAAQ;AACnB,IAAME,OAAOF,QAAQ;AAErB;;;;CAIC,GACDG,OAAOC,OAAO,GAAG,SAASC;IACxB;;;;GAIC,GACD,IAAIC,QAAQC,QAAQ,KAAK,UAAU;QACjC,IAAMC,YAAYF,QAAQD,IAAI,KAAK;QACnC,IAAMI,aAAaV,GAAGW,QAAQ,CAAC,qCAAqC;YAAEC,UAAU;QAAO,OAAO;QAE9F,OAAOH,aAAaC,aAAa,UAAU;IAC7C;IAEA;;;;GAIC,GACD,IAAIH,QAAQC,QAAQ,KAAK,SAAS;QAChC,IAAIK,SAAS;QACb,IAAI;YACFA,SAAS,CAAC,CAAEN,CAAAA,QAAQO,GAAG,CAACC,UAAU,IAAIb,GAAGc,QAAQ,CAACT,QAAQO,GAAG,CAACC,UAAU,CAAA;QAC1E,EAAE,OAAOE,MAAM,CAAC;QAEhB,IAAMC,UAAUL,SAASN,QAAQO,GAAG,CAACC,UAAU,GAAG;QAElD,iFAAiF;QACjF,IAAII,UAAU;QACd,IAAI;YACFA,UAAU,CAAC,CAACjB,GAAGc,QAAQ,CAACb,KAAKiB,IAAI,CAACF,SAAS;QAC7C,EAAE,OAAOD,MAAM,CAAC;QAEhB,OAAOE,UAAU,QAAQ;IAC3B;IAEA;;GAEC,GACD,IAAIZ,QAAQC,QAAQ,KAAK,SAAS;QAChC,IAAI;YACF,IAAMa,UAAUrB,GAAGW,QAAQ,CAAC,YAAY;gBAAEC,UAAU;YAAO;YAC3D,IAAI,CAACS,QAAQC,OAAO,CAAC,gBAAgB,OAAO;QAC9C,EAAE,OAAOL,MAAM,CAAC;QAEhB,IAAMM,SAASvB,GAAGW,QAAQ,CAAC,oBAAoB;YAAEC,UAAU;QAAO;QAClE,OAAOW,WAAW,SAAS,QAAQ;IACrC;IAEA;;GAEC,GACD,IAAIhB,QAAQD,IAAI,KAAK,OAAO;QAC1B,OAAO;IACT;IAEA;;GAEC,GACD,OAAO;AACT"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var path = require("path");
|
|
3
|
+
var fs = require("fs");
|
|
4
|
+
var keys = require("lodash.keys");
|
|
5
|
+
var PLATFORM_FILES = {
|
|
6
|
+
win32: {
|
|
7
|
+
node: [
|
|
8
|
+
"node.exe"
|
|
9
|
+
],
|
|
10
|
+
npm: [
|
|
11
|
+
"npm",
|
|
12
|
+
"npm.cmd"
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
posix: {
|
|
16
|
+
node: [
|
|
17
|
+
"node"
|
|
18
|
+
],
|
|
19
|
+
npm: [
|
|
20
|
+
"npm"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
module.exports = function checkMissing(dest, options, callback) {
|
|
25
|
+
var platform = options.platform || process.platform;
|
|
26
|
+
var files = PLATFORM_FILES[platform] || PLATFORM_FILES.posix;
|
|
27
|
+
var binPath = platform === "win32" ? dest : path.join(dest, "bin");
|
|
28
|
+
fs.readdir(binPath, function(err, names) {
|
|
29
|
+
if (err || !names.length) return callback(null, keys(files));
|
|
30
|
+
var missing = [];
|
|
31
|
+
for(var key in files){
|
|
32
|
+
var needed = files[key];
|
|
33
|
+
for(var index = 0; index < needed.length; index++){
|
|
34
|
+
if (!~names.indexOf(needed[index])) {
|
|
35
|
+
missing.push(key);
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return callback(null, missing);
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
45
|
+
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
46
|
+
for (var key in exports) exports.default[key] = exports[key];
|
|
47
|
+
module.exports = exports.default;
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["checkMissing.js"],"sourcesContent":["const path = require('path');\nconst fs = require('fs');\nconst keys = require('lodash.keys');\n\nconst PLATFORM_FILES = {\n win32: {\n node: ['node.exe'],\n npm: ['npm', 'npm.cmd'],\n },\n posix: {\n node: ['node'],\n npm: ['npm'],\n },\n};\n\nmodule.exports = function checkMissing(dest, options, callback) {\n const platform = options.platform || process.platform;\n const files = PLATFORM_FILES[platform] || PLATFORM_FILES.posix;\n const binPath = platform === 'win32' ? dest : path.join(dest, 'bin');\n\n fs.readdir(binPath, (err, names) => {\n if (err || !names.length) return callback(null, keys(files));\n\n const missing = [];\n for (const key in files) {\n const needed = files[key];\n for (let index = 0; index < needed.length; index++) {\n if (!~names.indexOf(needed[index])) {\n missing.push(key);\n break;\n }\n }\n }\n return callback(null, missing);\n });\n};\n"],"names":["path","require","fs","keys","PLATFORM_FILES","win32","node","npm","posix","module","exports","checkMissing","dest","options","callback","platform","process","files","binPath","join","readdir","err","names","length","missing","key","needed","index","indexOf","push"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AACrB,IAAMC,KAAKD,QAAQ;AACnB,IAAME,OAAOF,QAAQ;AAErB,IAAMG,iBAAiB;IACrBC,OAAO;QACLC,MAAM;YAAC;SAAW;QAClBC,KAAK;YAAC;YAAO;SAAU;IACzB;IACAC,OAAO;QACLF,MAAM;YAAC;SAAO;QACdC,KAAK;YAAC;SAAM;IACd;AACF;AAEAE,OAAOC,OAAO,GAAG,SAASC,aAAaC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC5D,IAAMC,WAAWF,QAAQE,QAAQ,IAAIC,QAAQD,QAAQ;IACrD,IAAME,QAAQb,cAAc,CAACW,SAAS,IAAIX,eAAeI,KAAK;IAC9D,IAAMU,UAAUH,aAAa,UAAUH,OAAOZ,KAAKmB,IAAI,CAACP,MAAM;IAE9DV,GAAGkB,OAAO,CAACF,SAAS,SAACG,KAAKC;QACxB,IAAID,OAAO,CAACC,MAAMC,MAAM,EAAE,OAAOT,SAAS,MAAMX,KAAKc;QAErD,IAAMO,UAAU,EAAE;QAClB,IAAK,IAAMC,OAAOR,MAAO;YACvB,IAAMS,SAAST,KAAK,CAACQ,IAAI;YACzB,IAAK,IAAIE,QAAQ,GAAGA,QAAQD,OAAOH,MAAM,EAAEI,QAAS;gBAClD,IAAI,CAAC,CAACL,MAAMM,OAAO,CAACF,MAAM,CAACC,MAAM,GAAG;oBAClCH,QAAQK,IAAI,CAACJ;oBACb;gBACF;YACF;QACF;QACA,OAAOX,SAAS,MAAMU;IACxB;AACF"}
|
package/dist/cjs/cli.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _exit = /*#__PURE__*/ _interop_require_default(require("exit"));
|
|
12
|
+
var _getoptscompat = /*#__PURE__*/ _interop_require_default(require("getopts-compat"));
|
|
13
|
+
var _index = /*#__PURE__*/ _interop_require_default(require("./index.js"));
|
|
14
|
+
function _interop_require_default(obj) {
|
|
15
|
+
return obj && obj.__esModule ? obj : {
|
|
16
|
+
default: obj
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
var _default = function(argv) {
|
|
20
|
+
var options = (0, _getoptscompat.default)(argv.slice(1), {
|
|
21
|
+
alias: {
|
|
22
|
+
platform: "p",
|
|
23
|
+
arch: "a",
|
|
24
|
+
filename: "f",
|
|
25
|
+
cacheDirectory: "c",
|
|
26
|
+
silent: "s"
|
|
27
|
+
},
|
|
28
|
+
boolean: [
|
|
29
|
+
"silent"
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
// define.option('-p, --platform [platform]', 'Platform like darwin');
|
|
33
|
+
// define.option('-a, --arch [arch]', 'Architecure x64, x86, arm-pi');
|
|
34
|
+
// define.option('-f, --filename [filename]', 'Distribution filename from https://nodejs.org/dist/index.json');
|
|
35
|
+
// define.option('-c, --cacheDirectory [cacheDirectory]', 'Cache directory');
|
|
36
|
+
var args = argv.slice(0, 1).concat(options._);
|
|
37
|
+
if (args.length < 1) {
|
|
38
|
+
console.log("Missing command. Example usage: nir version [directory]");
|
|
39
|
+
return (0, _exit.default)(-1);
|
|
40
|
+
}
|
|
41
|
+
var installPath = args.length > 1 ? args[1] : null;
|
|
42
|
+
(0, _index.default)(args[0], installPath, Object.assign({
|
|
43
|
+
stdio: "inherit"
|
|
44
|
+
}, options), function(err, results) {
|
|
45
|
+
if (err) {
|
|
46
|
+
console.log(err.message);
|
|
47
|
+
return (0, _exit.default)(err.code || -1);
|
|
48
|
+
}
|
|
49
|
+
var errors = results.filter(function(result) {
|
|
50
|
+
return !!result.error;
|
|
51
|
+
});
|
|
52
|
+
if (!options.silent) {
|
|
53
|
+
console.log("\n======================");
|
|
54
|
+
for(var index = 0; index < results.length; index++){
|
|
55
|
+
var result = results[index];
|
|
56
|
+
if (result.error) console.log("".concat(result.version, " not installed. Error: ").concat(result.error.message));
|
|
57
|
+
else console.log("".concat(result.version, " installed in: ").concat(result.fullPath));
|
|
58
|
+
}
|
|
59
|
+
console.log("======================");
|
|
60
|
+
}
|
|
61
|
+
(0, _exit.default)(errors.length ? -1 : 0);
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
66
|
+
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
67
|
+
for (var key in exports) exports.default[key] = exports[key];
|
|
68
|
+
module.exports = exports.default;
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["cli.js"],"sourcesContent":["import exit from 'exit';\nimport getopts from 'getopts-compat';\nimport nir from './index.js';\n\nexport default (argv) => {\n const options = getopts(argv.slice(1), {\n alias: { platform: 'p', arch: 'a', filename: 'f', cacheDirectory: 'c', silent: 's' },\n boolean: ['silent'],\n });\n\n // define.option('-p, --platform [platform]', 'Platform like darwin');\n // define.option('-a, --arch [arch]', 'Architecure x64, x86, arm-pi');\n // define.option('-f, --filename [filename]', 'Distribution filename from https://nodejs.org/dist/index.json');\n // define.option('-c, --cacheDirectory [cacheDirectory]', 'Cache directory');\n\n const args = argv.slice(0, 1).concat(options._);\n if (args.length < 1) {\n console.log('Missing command. Example usage: nir version [directory]');\n return exit(-1);\n }\n\n const installPath = args.length > 1 ? args[1] : null;\n nir(args[0], installPath, Object.assign({ stdio: 'inherit' }, options), (err, results) => {\n if (err) {\n console.log(err.message);\n return exit(err.code || -1);\n }\n const errors = results.filter((result) => !!result.error);\n\n if (!options.silent) {\n console.log('\\n======================');\n for (let index = 0; index < results.length; index++) {\n const result = results[index];\n if (result.error) console.log(`${result.version} not installed. Error: ${result.error.message}`);\n else console.log(`${result.version} installed in: ${result.fullPath}`);\n }\n console.log('======================');\n }\n\n exit(errors.length ? -1 : 0);\n });\n};\n"],"names":["argv","options","getopts","slice","alias","platform","arch","filename","cacheDirectory","silent","boolean","args","concat","_","length","console","log","exit","installPath","nir","Object","assign","stdio","err","results","message","code","errors","filter","result","error","index","version","fullPath"],"mappings":";;;;+BAIA;;;eAAA;;;2DAJiB;oEACG;4DACJ;;;;;;IAEhB,WAAe,SAACA;IACd,IAAMC,UAAUC,IAAAA,sBAAO,EAACF,KAAKG,KAAK,CAAC,IAAI;QACrCC,OAAO;YAAEC,UAAU;YAAKC,MAAM;YAAKC,UAAU;YAAKC,gBAAgB;YAAKC,QAAQ;QAAI;QACnFC,SAAS;YAAC;SAAS;IACrB;IAEA,sEAAsE;IACtE,sEAAsE;IACtE,+GAA+G;IAC/G,6EAA6E;IAE7E,IAAMC,OAAOX,KAAKG,KAAK,CAAC,GAAG,GAAGS,MAAM,CAACX,QAAQY,CAAC;IAC9C,IAAIF,KAAKG,MAAM,GAAG,GAAG;QACnBC,QAAQC,GAAG,CAAC;QACZ,OAAOC,IAAAA,aAAI,EAAC,CAAC;IACf;IAEA,IAAMC,cAAcP,KAAKG,MAAM,GAAG,IAAIH,IAAI,CAAC,EAAE,GAAG;IAChDQ,IAAAA,cAAG,EAACR,IAAI,CAAC,EAAE,EAAEO,aAAaE,OAAOC,MAAM,CAAC;QAAEC,OAAO;IAAU,GAAGrB,UAAU,SAACsB,KAAKC;QAC5E,IAAID,KAAK;YACPR,QAAQC,GAAG,CAACO,IAAIE,OAAO;YACvB,OAAOR,IAAAA,aAAI,EAACM,IAAIG,IAAI,IAAI,CAAC;QAC3B;QACA,IAAMC,SAASH,QAAQI,MAAM,CAAC,SAACC;mBAAW,CAAC,CAACA,OAAOC,KAAK;;QAExD,IAAI,CAAC7B,QAAQQ,MAAM,EAAE;YACnBM,QAAQC,GAAG,CAAC;YACZ,IAAK,IAAIe,QAAQ,GAAGA,QAAQP,QAAQV,MAAM,EAAEiB,QAAS;gBACnD,IAAMF,SAASL,OAAO,CAACO,MAAM;gBAC7B,IAAIF,OAAOC,KAAK,EAAEf,QAAQC,GAAG,CAAC,AAAC,GAA0Ca,OAAxCA,OAAOG,OAAO,EAAC,2BAA8C,OAArBH,OAAOC,KAAK,CAACL,OAAO;qBACxFV,QAAQC,GAAG,CAAC,AAAC,GAAkCa,OAAhCA,OAAOG,OAAO,EAAC,mBAAiC,OAAhBH,OAAOI,QAAQ;YACrE;YACAlB,QAAQC,GAAG,CAAC;QACd;QAEAC,IAAAA,aAAI,EAACU,OAAOb,MAAM,GAAG,CAAC,IAAI;IAC5B;AACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var path = require("path");
|
|
3
|
+
var get = require("get-remote");
|
|
4
|
+
var access = require("fs-access-compat");
|
|
5
|
+
var progress = require("./progress");
|
|
6
|
+
var ensureDestinationParent = require("./ensureDestinationParent");
|
|
7
|
+
module.exports = function conditionalCache(endpoint, dest, options, callback) {
|
|
8
|
+
if (typeof options === "function") {
|
|
9
|
+
callback = options;
|
|
10
|
+
options = null;
|
|
11
|
+
}
|
|
12
|
+
options = options || {};
|
|
13
|
+
access(dest, function(err) {
|
|
14
|
+
if (!err) return callback(); // already exists
|
|
15
|
+
ensureDestinationParent(dest, function(err) {
|
|
16
|
+
if (err) return callback(err);
|
|
17
|
+
// TODO: do I need assign?
|
|
18
|
+
get(endpoint, Object.assign({
|
|
19
|
+
filename: path.basename(dest),
|
|
20
|
+
progress: progress,
|
|
21
|
+
time: 1000
|
|
22
|
+
}, options)).file(path.dirname(dest), function(err) {
|
|
23
|
+
console.log("");
|
|
24
|
+
callback(err);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
31
|
+
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
32
|
+
for (var key in exports) exports.default[key] = exports[key];
|
|
33
|
+
module.exports = exports.default;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["conditionalCache.js"],"sourcesContent":["const path = require('path');\nconst get = require('get-remote');\nconst access = require('fs-access-compat');\n\nconst progress = require('./progress');\nconst ensureDestinationParent = require('./ensureDestinationParent');\n\nmodule.exports = function conditionalCache(endpoint, dest, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n\n access(dest, (err) => {\n if (!err) return callback(); // already exists\n\n ensureDestinationParent(dest, (err) => {\n if (err) return callback(err);\n\n // TODO: do I need assign?\n get(endpoint, Object.assign({ filename: path.basename(dest), progress: progress, time: 1000 }, options)).file(path.dirname(dest), (err) => {\n console.log('');\n callback(err);\n });\n });\n });\n};\n"],"names":["path","require","get","access","progress","ensureDestinationParent","module","exports","conditionalCache","endpoint","dest","options","callback","err","Object","assign","filename","basename","time","file","dirname","console","log"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AACrB,IAAMC,MAAMD,QAAQ;AACpB,IAAME,SAASF,QAAQ;AAEvB,IAAMG,WAAWH,QAAQ;AACzB,IAAMI,0BAA0BJ,QAAQ;AAExCK,OAAOC,OAAO,GAAG,SAASC,iBAAiBC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC1E,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IAEtBR,OAAOO,MAAM,SAACG;QACZ,IAAI,CAACA,KAAK,OAAOD,YAAY,iBAAiB;QAE9CP,wBAAwBK,MAAM,SAACG;YAC7B,IAAIA,KAAK,OAAOD,SAASC;YAEzB,0BAA0B;YAC1BX,IAAIO,UAAUK,OAAOC,MAAM,CAAC;gBAAEC,UAAUhB,KAAKiB,QAAQ,CAACP;gBAAON,UAAUA;gBAAUc,MAAM;YAAK,GAAGP,UAAUQ,IAAI,CAACnB,KAAKoB,OAAO,CAACV,OAAO,SAACG;gBACjIQ,QAAQC,GAAG,CAAC;gBACZV,SAASC;YACX;QACF;IACF;AACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var access = require("fs-access-compat");
|
|
3
|
+
var copyFile = require("./copyFile");
|
|
4
|
+
var ensureDestinationParent = require("./ensureDestinationParent");
|
|
5
|
+
module.exports = function conditionalCopy(src, dest, optional, callback) {
|
|
6
|
+
if (typeof optional === "function") {
|
|
7
|
+
callback = optional;
|
|
8
|
+
optional = false;
|
|
9
|
+
}
|
|
10
|
+
access(dest, function(err) {
|
|
11
|
+
if (!err) return callback(); // already exists
|
|
12
|
+
ensureDestinationParent(dest, function(err) {
|
|
13
|
+
if (err) return callback(err);
|
|
14
|
+
if (!optional) return copyFile(src, dest, callback);
|
|
15
|
+
access(src, function(err) {
|
|
16
|
+
if (err) return callback(); // optional file missing
|
|
17
|
+
copyFile(src, dest, callback);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
24
|
+
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
25
|
+
for (var key in exports) exports.default[key] = exports[key];
|
|
26
|
+
module.exports = exports.default;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["conditionalCopy.js"],"sourcesContent":["const access = require('fs-access-compat');\n\nconst copyFile = require('./copyFile');\nconst ensureDestinationParent = require('./ensureDestinationParent');\n\nmodule.exports = function conditionalCopy(src, dest, optional, callback) {\n if (typeof optional === 'function') {\n callback = optional;\n optional = false;\n }\n\n access(dest, (err) => {\n if (!err) return callback(); // already exists\n\n ensureDestinationParent(dest, (err) => {\n if (err) return callback(err);\n if (!optional) return copyFile(src, dest, callback);\n\n access(src, (err) => {\n if (err) return callback(); // optional file missing\n copyFile(src, dest, callback);\n });\n });\n });\n};\n"],"names":["access","require","copyFile","ensureDestinationParent","module","exports","conditionalCopy","src","dest","optional","callback","err"],"mappings":";AAAA,IAAMA,SAASC,QAAQ;AAEvB,IAAMC,WAAWD,QAAQ;AACzB,IAAME,0BAA0BF,QAAQ;AAExCG,OAAOC,OAAO,GAAG,SAASC,gBAAgBC,GAAG,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ;IACrE,IAAI,OAAOD,aAAa,YAAY;QAClCC,WAAWD;QACXA,WAAW;IACb;IAEAT,OAAOQ,MAAM,SAACG;QACZ,IAAI,CAACA,KAAK,OAAOD,YAAY,iBAAiB;QAE9CP,wBAAwBK,MAAM,SAACG;YAC7B,IAAIA,KAAK,OAAOD,SAASC;YACzB,IAAI,CAACF,UAAU,OAAOP,SAASK,KAAKC,MAAME;YAE1CV,OAAOO,KAAK,SAACI;gBACX,IAAIA,KAAK,OAAOD,YAAY,wBAAwB;gBACpDR,SAASK,KAAKC,MAAME;YACtB;QACF;IACF;AACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var path = require("path");
|
|
3
|
+
var extract = require("fast-extract").default;
|
|
4
|
+
var mkpath = require("mkpath");
|
|
5
|
+
var access = require("fs-access-compat");
|
|
6
|
+
var progress = require("./progress");
|
|
7
|
+
module.exports = function conditionalExtract(src, dest, options, callback) {
|
|
8
|
+
if (typeof options === "function") {
|
|
9
|
+
callback = options;
|
|
10
|
+
options = null;
|
|
11
|
+
}
|
|
12
|
+
options = options || {};
|
|
13
|
+
access(dest, function(err) {
|
|
14
|
+
if (!err) return callback(); // already exists
|
|
15
|
+
mkpath(path.dirname(dest), function() {
|
|
16
|
+
var extractOptions = Object.assign({
|
|
17
|
+
strip: 1,
|
|
18
|
+
progress: progress,
|
|
19
|
+
time: 1000
|
|
20
|
+
}, options);
|
|
21
|
+
extract(src, dest, extractOptions, function(err) {
|
|
22
|
+
console.log("");
|
|
23
|
+
callback(err);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
30
|
+
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
31
|
+
for (var key in exports) exports.default[key] = exports[key];
|
|
32
|
+
module.exports = exports.default;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["conditionalExtract.js"],"sourcesContent":["const path = require('path');\nconst extract = require('fast-extract').default;\nconst mkpath = require('mkpath');\nconst access = require('fs-access-compat');\n\nconst progress = require('./progress');\n\nmodule.exports = function conditionalExtract(src, dest, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n\n access(dest, (err) => {\n if (!err) return callback(); // already exists\n\n mkpath(path.dirname(dest), () => {\n const extractOptions = Object.assign({ strip: 1, progress: progress, time: 1000 }, options);\n\n extract(src, dest, extractOptions, (err) => {\n console.log('');\n callback(err);\n });\n });\n });\n};\n"],"names":["path","require","extract","default","mkpath","access","progress","module","exports","conditionalExtract","src","dest","options","callback","err","dirname","extractOptions","Object","assign","strip","time","console","log"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AACrB,IAAMC,UAAUD,QAAQ,gBAAgBE,OAAO;AAC/C,IAAMC,SAASH,QAAQ;AACvB,IAAMI,SAASJ,QAAQ;AAEvB,IAAMK,WAAWL,QAAQ;AAEzBM,OAAOC,OAAO,GAAG,SAASC,mBAAmBC,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACvE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IAEtBP,OAAOM,MAAM,SAACG;QACZ,IAAI,CAACA,KAAK,OAAOD,YAAY,iBAAiB;QAE9CT,OAAOJ,KAAKe,OAAO,CAACJ,OAAO;YACzB,IAAMK,iBAAiBC,OAAOC,MAAM,CAAC;gBAAEC,OAAO;gBAAGb,UAAUA;gBAAUc,MAAM;YAAK,GAAGR;YAEnFV,QAAQQ,KAAKC,MAAMK,gBAAgB,SAACF;gBAClCO,QAAQC,GAAG,CAAC;gBACZT,SAASC;YACX;QACF;IACF;AACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var fs = require("fs");
|
|
3
|
+
var rimraf = require("rimraf");
|
|
4
|
+
var pump = require("pump");
|
|
5
|
+
var Queue = require("queue-cb");
|
|
6
|
+
var ensureDestinationParent = require("./ensureDestinationParent");
|
|
7
|
+
function streamCopyFile(src, dest, callback) {
|
|
8
|
+
fs.stat(src, function(err) {
|
|
9
|
+
if (err) return callback(err);
|
|
10
|
+
pump(fs.createReadStream(src), fs.createWriteStream(dest), callback);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
var copyFile = fs.copyFile || streamCopyFile;
|
|
14
|
+
module.exports = function safeCopyFile(src, dest, callback) {
|
|
15
|
+
var queue = new Queue(1);
|
|
16
|
+
queue.defer(ensureDestinationParent.bind(null, dest));
|
|
17
|
+
queue.defer(function(callback) {
|
|
18
|
+
rimraf(dest, function(err) {
|
|
19
|
+
err && err.code !== "EEXIST" ? callback(err) : callback();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
queue.defer(copyFile.bind(null, src, dest));
|
|
23
|
+
queue.await(callback);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
27
|
+
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
28
|
+
for (var key in exports) exports.default[key] = exports[key];
|
|
29
|
+
module.exports = exports.default;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["copyFile.js"],"sourcesContent":["const fs = require('fs');\nconst rimraf = require('rimraf');\nconst pump = require('pump');\nconst Queue = require('queue-cb');\n\nconst ensureDestinationParent = require('./ensureDestinationParent');\n\nfunction streamCopyFile(src, dest, callback) {\n fs.stat(src, (err) => {\n if (err) return callback(err);\n pump(fs.createReadStream(src), fs.createWriteStream(dest), callback);\n });\n}\n\nconst copyFile = fs.copyFile || streamCopyFile;\n\nmodule.exports = function safeCopyFile(src, dest, callback) {\n const queue = new Queue(1);\n\n queue.defer(ensureDestinationParent.bind(null, dest));\n queue.defer((callback) => {\n rimraf(dest, (err) => {\n err && err.code !== 'EEXIST' ? callback(err) : callback();\n });\n });\n queue.defer(copyFile.bind(null, src, dest));\n queue.await(callback);\n};\n"],"names":["fs","require","rimraf","pump","Queue","ensureDestinationParent","streamCopyFile","src","dest","callback","stat","err","createReadStream","createWriteStream","copyFile","module","exports","safeCopyFile","queue","defer","bind","code","await"],"mappings":";AAAA,IAAMA,KAAKC,QAAQ;AACnB,IAAMC,SAASD,QAAQ;AACvB,IAAME,OAAOF,QAAQ;AACrB,IAAMG,QAAQH,QAAQ;AAEtB,IAAMI,0BAA0BJ,QAAQ;AAExC,SAASK,eAAeC,GAAG,EAAEC,IAAI,EAAEC,QAAQ;IACzCT,GAAGU,IAAI,CAACH,KAAK,SAACI;QACZ,IAAIA,KAAK,OAAOF,SAASE;QACzBR,KAAKH,GAAGY,gBAAgB,CAACL,MAAMP,GAAGa,iBAAiB,CAACL,OAAOC;IAC7D;AACF;AAEA,IAAMK,WAAWd,GAAGc,QAAQ,IAAIR;AAEhCS,OAAOC,OAAO,GAAG,SAASC,aAAaV,GAAG,EAAEC,IAAI,EAAEC,QAAQ;IACxD,IAAMS,QAAQ,IAAId,MAAM;IAExBc,MAAMC,KAAK,CAACd,wBAAwBe,IAAI,CAAC,MAAMZ;IAC/CU,MAAMC,KAAK,CAAC,SAACV;QACXP,OAAOM,MAAM,SAACG;YACZA,OAAOA,IAAIU,IAAI,KAAK,WAAWZ,SAASE,OAAOF;QACjD;IACF;IACAS,MAAMC,KAAK,CAACL,SAASM,IAAI,CAAC,MAAMb,KAAKC;IACrCU,MAAMI,KAAK,CAACb;AACd"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var isArray = require("isarray");
|
|
3
|
+
var endsWith = require("end-with");
|
|
4
|
+
module.exports = function endsWithFn(endings) {
|
|
5
|
+
if (!isArray(endings)) endings = [
|
|
6
|
+
endings
|
|
7
|
+
];
|
|
8
|
+
return function(string) {
|
|
9
|
+
for(var index = 0; index < endings.length; index++){
|
|
10
|
+
if (endsWith(string, endings[index])) return true;
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
17
|
+
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
18
|
+
for (var key in exports) exports.default[key] = exports[key];
|
|
19
|
+
module.exports = exports.default;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["endsWithFn.js"],"sourcesContent":["const isArray = require('isarray');\nconst endsWith = require('end-with');\n\nmodule.exports = function endsWithFn(endings) {\n if (!isArray(endings)) endings = [endings];\n return (string) => {\n for (let index = 0; index < endings.length; index++) {\n if (endsWith(string, endings[index])) return true;\n }\n return false;\n };\n};\n"],"names":["isArray","require","endsWith","module","exports","endsWithFn","endings","string","index","length"],"mappings":";AAAA,IAAMA,UAAUC,QAAQ;AACxB,IAAMC,WAAWD,QAAQ;AAEzBE,OAAOC,OAAO,GAAG,SAASC,WAAWC,OAAO;IAC1C,IAAI,CAACN,QAAQM,UAAUA,UAAU;QAACA;KAAQ;IAC1C,OAAO,SAACC;QACN,IAAK,IAAIC,QAAQ,GAAGA,QAAQF,QAAQG,MAAM,EAAED,QAAS;YACnD,IAAIN,SAASK,QAAQD,OAAO,CAACE,MAAM,GAAG,OAAO;QAC/C;QACA,OAAO;IACT;AACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var path = require("path");
|
|
3
|
+
var mkpath = require("mkpath");
|
|
4
|
+
module.exports = function ensureDestinationParent(dest, callback) {
|
|
5
|
+
var parent = path.dirname(dest);
|
|
6
|
+
if (parent === "." || parent === "/") return callback();
|
|
7
|
+
mkpath(parent, function(err) {
|
|
8
|
+
callback(err);
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
13
|
+
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
14
|
+
for (var key in exports) exports.default[key] = exports[key];
|
|
15
|
+
module.exports = exports.default;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ensureDestinationParent.js"],"sourcesContent":["const path = require('path');\nconst mkpath = require('mkpath');\n\nmodule.exports = function ensureDestinationParent(dest, callback) {\n const parent = path.dirname(dest);\n if (parent === '.' || parent === '/') return callback();\n mkpath(parent, (err) => {\n callback(err);\n });\n};\n"],"names":["path","require","mkpath","module","exports","ensureDestinationParent","dest","callback","parent","dirname","err"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AACrB,IAAMC,SAASD,QAAQ;AAEvBE,OAAOC,OAAO,GAAG,SAASC,wBAAwBC,IAAI,EAAEC,QAAQ;IAC9D,IAAMC,SAASR,KAAKS,OAAO,CAACH;IAC5B,IAAIE,WAAW,OAAOA,WAAW,KAAK,OAAOD;IAC7CL,OAAOM,QAAQ,SAACE;QACdH,SAASG;IACX;AACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return installRelease;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _install = /*#__PURE__*/ _interop_require_default(require("./install"));
|
|
12
|
+
function _interop_require_default(obj) {
|
|
13
|
+
return obj && obj.__esModule ? obj : {
|
|
14
|
+
default: obj
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function installRelease(versionDetails, dest, options, callback) {
|
|
18
|
+
if (typeof options === "function") {
|
|
19
|
+
callback = options;
|
|
20
|
+
options = null;
|
|
21
|
+
}
|
|
22
|
+
options = options || {};
|
|
23
|
+
if (typeof callback === "function") return (0, _install.default)(versionDetails, dest, options, callback);
|
|
24
|
+
return new Promise(function(resolve, reject) {
|
|
25
|
+
installRelease(versionDetails, dest, options, function installCallback(err, result) {
|
|
26
|
+
err ? reject(err) : resolve(result);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
32
|
+
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
33
|
+
for (var key in exports) exports.default[key] = exports[key];
|
|
34
|
+
module.exports = exports.default;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.mjs"],"sourcesContent":["import install from './install';\n\nexport default function installRelease(versionDetails, dest, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n options = options || {};\n\n if (typeof callback === 'function') return install(versionDetails, dest, options, callback);\n return new Promise((resolve, reject) => {\n installRelease(versionDetails, dest, options, function installCallback(err, result) {\n err ? reject(err) : resolve(result);\n });\n });\n}\n"],"names":["installRelease","versionDetails","dest","options","callback","install","Promise","resolve","reject","installCallback","err","result"],"mappings":";;;;+BAEA;;;eAAwBA;;;8DAFJ;;;;;;AAEL,SAASA,eAAeC,cAAc,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC5E,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU;IACZ;IACAA,UAAUA,WAAW,CAAC;IAEtB,IAAI,OAAOC,aAAa,YAAY,OAAOC,IAAAA,gBAAO,EAACJ,gBAAgBC,MAAMC,SAASC;IAClF,OAAO,IAAIE,QAAQ,SAACC,SAASC;QAC3BR,eAAeC,gBAAgBC,MAAMC,SAAS,SAASM,gBAAgBC,GAAG,EAAEC,MAAM;YAChFD,MAAMF,OAAOE,OAAOH,QAAQI;QAC9B;IACF;AACF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
require("./polyfills");
|
|
3
|
+
var path = require("path");
|
|
4
|
+
var Queue = require("queue-cb");
|
|
5
|
+
var mkpath = require("mkpath");
|
|
6
|
+
var resolveVersions = require("node-resolve-versions");
|
|
7
|
+
var installVersion = require("./installVersion");
|
|
8
|
+
var NIR_DIR = path.join(require("osenv").home(), ".nir");
|
|
9
|
+
var DEFAULT_OPTIONS = {
|
|
10
|
+
cacheDirectory: path.join(NIR_DIR, "cache"),
|
|
11
|
+
buildDirectory: path.join(NIR_DIR, "build"),
|
|
12
|
+
downloadURL: function downloadURL(relativePath) {
|
|
13
|
+
return "https://nodejs.org/dist/".concat(relativePath);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
module.exports = function install(versionDetails, dest, options, callback) {
|
|
17
|
+
options = Object.assign({}, DEFAULT_OPTIONS, options, {
|
|
18
|
+
path: "raw"
|
|
19
|
+
});
|
|
20
|
+
resolveVersions(versionDetails, options, function(err, versions) {
|
|
21
|
+
if (err) return callback(err);
|
|
22
|
+
if (!versions.length) return callback(new Error("Could not resolve versions for: ".concat(JSON.stringify(versionDetails))));
|
|
23
|
+
var results = [];
|
|
24
|
+
var queue = new Queue(1);
|
|
25
|
+
queue.defer(function(callback) {
|
|
26
|
+
mkpath(options.cacheDirectory, callback.bind(null, null));
|
|
27
|
+
});
|
|
28
|
+
for(var index = 0; index < versions.length; index++){
|
|
29
|
+
(function(version) {
|
|
30
|
+
queue.defer(function(callback) {
|
|
31
|
+
var installDirectory = dest && versions.length > 1 ? path.join(dest, version.version) : dest;
|
|
32
|
+
installVersion(version, installDirectory, options, function(err, fullPath) {
|
|
33
|
+
if (err) return callback(err);
|
|
34
|
+
results.push({
|
|
35
|
+
version: version.version,
|
|
36
|
+
error: err,
|
|
37
|
+
fullPath: fullPath
|
|
38
|
+
});
|
|
39
|
+
callback();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
})(versions[index]);
|
|
43
|
+
}
|
|
44
|
+
queue.await(function(err) {
|
|
45
|
+
err ? callback(err) : callback(null, results);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
51
|
+
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
52
|
+
for (var key in exports) exports.default[key] = exports[key];
|
|
53
|
+
module.exports = exports.default;
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["install.js"],"sourcesContent":["require('./polyfills');\nconst path = require('path');\nconst Queue = require('queue-cb');\nconst mkpath = require('mkpath');\n\nconst resolveVersions = require('node-resolve-versions');\n\nconst installVersion = require('./installVersion');\n\nconst NIR_DIR = path.join(require('osenv').home(), '.nir');\nconst DEFAULT_OPTIONS = {\n cacheDirectory: path.join(NIR_DIR, 'cache'),\n buildDirectory: path.join(NIR_DIR, 'build'),\n downloadURL: function downloadURL(relativePath) {\n return `https://nodejs.org/dist/${relativePath}`;\n },\n};\n\nmodule.exports = function install(versionDetails, dest, options, callback) {\n options = Object.assign({}, DEFAULT_OPTIONS, options, { path: 'raw' });\n resolveVersions(versionDetails, options, (err, versions) => {\n if (err) return callback(err);\n if (!versions.length) return callback(new Error(`Could not resolve versions for: ${JSON.stringify(versionDetails)}`));\n\n const results = [];\n const queue = new Queue(1);\n queue.defer((callback) => {\n mkpath(options.cacheDirectory, callback.bind(null, null));\n });\n for (let index = 0; index < versions.length; index++) {\n ((version) => {\n queue.defer((callback) => {\n const installDirectory = dest && versions.length > 1 ? path.join(dest, version.version) : dest;\n installVersion(version, installDirectory, options, (err, fullPath) => {\n if (err) return callback(err);\n results.push({ version: version.version, error: err, fullPath: fullPath });\n callback();\n });\n });\n })(versions[index]);\n }\n queue.await((err) => {\n err ? callback(err) : callback(null, results);\n });\n });\n};\n"],"names":["require","path","Queue","mkpath","resolveVersions","installVersion","NIR_DIR","join","home","DEFAULT_OPTIONS","cacheDirectory","buildDirectory","downloadURL","relativePath","module","exports","install","versionDetails","dest","options","callback","Object","assign","err","versions","length","Error","JSON","stringify","results","queue","defer","bind","index","version","installDirectory","fullPath","push","error","await"],"mappings":";AAAAA,QAAQ;AACR,IAAMC,OAAOD,QAAQ;AACrB,IAAME,QAAQF,QAAQ;AACtB,IAAMG,SAASH,QAAQ;AAEvB,IAAMI,kBAAkBJ,QAAQ;AAEhC,IAAMK,iBAAiBL,QAAQ;AAE/B,IAAMM,UAAUL,KAAKM,IAAI,CAACP,QAAQ,SAASQ,IAAI,IAAI;AACnD,IAAMC,kBAAkB;IACtBC,gBAAgBT,KAAKM,IAAI,CAACD,SAAS;IACnCK,gBAAgBV,KAAKM,IAAI,CAACD,SAAS;IACnCM,aAAa,SAASA,YAAYC,YAAY;QAC5C,OAAO,AAAC,2BAAuC,OAAbA;IACpC;AACF;AAEAC,OAAOC,OAAO,GAAG,SAASC,QAAQC,cAAc,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACvED,UAAUE,OAAOC,MAAM,CAAC,CAAC,GAAGb,iBAAiBU,SAAS;QAAElB,MAAM;IAAM;IACpEG,gBAAgBa,gBAAgBE,SAAS,SAACI,KAAKC;QAC7C,IAAID,KAAK,OAAOH,SAASG;QACzB,IAAI,CAACC,SAASC,MAAM,EAAE,OAAOL,SAAS,IAAIM,MAAM,AAAC,mCAAiE,OAA/BC,KAAKC,SAAS,CAACX;QAElG,IAAMY,UAAU,EAAE;QAClB,IAAMC,QAAQ,IAAI5B,MAAM;QACxB4B,MAAMC,KAAK,CAAC,SAACX;YACXjB,OAAOgB,QAAQT,cAAc,EAAEU,SAASY,IAAI,CAAC,MAAM;QACrD;QACA,IAAK,IAAIC,QAAQ,GAAGA,QAAQT,SAASC,MAAM,EAAEQ,QAAS;YACnD,CAAA,SAACC;gBACAJ,MAAMC,KAAK,CAAC,SAACX;oBACX,IAAMe,mBAAmBjB,QAAQM,SAASC,MAAM,GAAG,IAAIxB,KAAKM,IAAI,CAACW,MAAMgB,QAAQA,OAAO,IAAIhB;oBAC1Fb,eAAe6B,SAASC,kBAAkBhB,SAAS,SAACI,KAAKa;wBACvD,IAAIb,KAAK,OAAOH,SAASG;wBACzBM,QAAQQ,IAAI,CAAC;4BAAEH,SAASA,QAAQA,OAAO;4BAAEI,OAAOf;4BAAKa,UAAUA;wBAAS;wBACxEhB;oBACF;gBACF;YACF,CAAA,EAAGI,QAAQ,CAACS,MAAM;QACpB;QACAH,MAAMS,KAAK,CAAC,SAAChB;YACXA,MAAMH,SAASG,OAAOH,SAAS,MAAMS;QACvC;IACF;AACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var installBin = require("./installBin");
|
|
3
|
+
var installLib = require("./installLib");
|
|
4
|
+
module.exports = function install(version, dest, options, callback) {
|
|
5
|
+
installLib(version, dest, options, function(err) {
|
|
6
|
+
if (err) return callback(err);
|
|
7
|
+
installBin(version, dest, options, callback);
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
12
|
+
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
13
|
+
for (var key in exports) exports.default[key] = exports[key];
|
|
14
|
+
module.exports = exports.default;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["const installBin = require('./installBin');\nconst installLib = require('./installLib');\n\nmodule.exports = function install(version, dest, options, callback) {\n installLib(version, dest, options, (err) => {\n if (err) return callback(err);\n installBin(version, dest, options, callback);\n });\n};\n"],"names":["installBin","require","installLib","module","exports","install","version","dest","options","callback","err"],"mappings":";AAAA,IAAMA,aAAaC,QAAQ;AAC3B,IAAMC,aAAaD,QAAQ;AAE3BE,OAAOC,OAAO,GAAG,SAASC,QAAQC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAChEP,WAAWI,SAASC,MAAMC,SAAS,SAACE;QAClC,IAAIA,KAAK,OAAOD,SAASC;QACzBV,WAAWM,SAASC,MAAMC,SAASC;IACrC;AACF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var path = require("path");
|
|
3
|
+
var Queue = require("queue-cb");
|
|
4
|
+
var conditionalCopy = require("../conditionalCopy");
|
|
5
|
+
var PLATFORM_FILES = {
|
|
6
|
+
win32: [
|
|
7
|
+
{
|
|
8
|
+
src: path.join("node_modules", "npm", "bin", "npm"),
|
|
9
|
+
dest: "npm"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
src: path.join("node_modules", "npm", "bin", "npm.cmd"),
|
|
13
|
+
dest: "npm.cmd"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
src: path.join("node_modules", "npm", "bin", "npx"),
|
|
17
|
+
dest: "npx",
|
|
18
|
+
optional: true
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
src: path.join("node_modules", "npm", "bin", "npx.cmd"),
|
|
22
|
+
dest: "npx.cmd",
|
|
23
|
+
optional: true
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
posix: [
|
|
27
|
+
{
|
|
28
|
+
src: path.join("node_modules", "npm", "bin", "npm-cli.js"),
|
|
29
|
+
dest: "npm"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
src: path.join("node_modules", "npm", "bin", "npx-cli.js"),
|
|
33
|
+
dest: "npx",
|
|
34
|
+
optional: true
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
};
|
|
38
|
+
module.exports = function installBin(_version, dest, options, callback) {
|
|
39
|
+
var platform = options.platform || process.platform;
|
|
40
|
+
var libPath = platform === "win32" ? dest : path.join(dest, "lib");
|
|
41
|
+
var binPath = platform === "win32" ? dest : path.join(dest, "bin");
|
|
42
|
+
var queue = new Queue();
|
|
43
|
+
var files = PLATFORM_FILES[platform] || PLATFORM_FILES.posix;
|
|
44
|
+
for(var index = 0; index < files.length; index++){
|
|
45
|
+
var file = files[index];
|
|
46
|
+
queue.defer(conditionalCopy.bind(null, path.join(libPath, file.src), path.join(binPath, file.dest), file.optional));
|
|
47
|
+
}
|
|
48
|
+
queue.await(callback);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
52
|
+
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
53
|
+
for (var key in exports) exports.default[key] = exports[key];
|
|
54
|
+
module.exports = exports.default;
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["installBin.js"],"sourcesContent":["const path = require('path');\nconst Queue = require('queue-cb');\nconst conditionalCopy = require('../conditionalCopy');\n\nconst PLATFORM_FILES = {\n win32: [\n { src: path.join('node_modules', 'npm', 'bin', 'npm'), dest: 'npm' },\n { src: path.join('node_modules', 'npm', 'bin', 'npm.cmd'), dest: 'npm.cmd' },\n { src: path.join('node_modules', 'npm', 'bin', 'npx'), dest: 'npx', optional: true },\n { src: path.join('node_modules', 'npm', 'bin', 'npx.cmd'), dest: 'npx.cmd', optional: true },\n ],\n posix: [\n { src: path.join('node_modules', 'npm', 'bin', 'npm-cli.js'), dest: 'npm' },\n { src: path.join('node_modules', 'npm', 'bin', 'npx-cli.js'), dest: 'npx', optional: true },\n ],\n};\n\nmodule.exports = function installBin(_version, dest, options, callback) {\n const platform = options.platform || process.platform;\n const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');\n const binPath = platform === 'win32' ? dest : path.join(dest, 'bin');\n\n const queue = new Queue();\n const files = PLATFORM_FILES[platform] || PLATFORM_FILES.posix;\n for (let index = 0; index < files.length; index++) {\n const file = files[index];\n queue.defer(conditionalCopy.bind(null, path.join(libPath, file.src), path.join(binPath, file.dest), file.optional));\n }\n\n queue.await(callback);\n};\n"],"names":["path","require","Queue","conditionalCopy","PLATFORM_FILES","win32","src","join","dest","optional","posix","module","exports","installBin","_version","options","callback","platform","process","libPath","binPath","queue","files","index","length","file","defer","bind","await"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AACrB,IAAMC,QAAQD,QAAQ;AACtB,IAAME,kBAAkBF,QAAQ;AAEhC,IAAMG,iBAAiB;IACrBC,OAAO;QACL;YAAEC,KAAKN,KAAKO,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAQC,MAAM;QAAM;QACnE;YAAEF,KAAKN,KAAKO,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAYC,MAAM;QAAU;QAC3E;YAAEF,KAAKN,KAAKO,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAQC,MAAM;YAAOC,UAAU;QAAK;QACnF;YAAEH,KAAKN,KAAKO,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAYC,MAAM;YAAWC,UAAU;QAAK;KAC5F;IACDC,OAAO;QACL;YAAEJ,KAAKN,KAAKO,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAeC,MAAM;QAAM;QAC1E;YAAEF,KAAKN,KAAKO,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAeC,MAAM;YAAOC,UAAU;QAAK;KAC3F;AACH;AAEAE,OAAOC,OAAO,GAAG,SAASC,WAAWC,QAAQ,EAAEN,IAAI,EAAEO,OAAO,EAAEC,QAAQ;IACpE,IAAMC,WAAWF,QAAQE,QAAQ,IAAIC,QAAQD,QAAQ;IACrD,IAAME,UAAUF,aAAa,UAAUT,OAAOR,KAAKO,IAAI,CAACC,MAAM;IAC9D,IAAMY,UAAUH,aAAa,UAAUT,OAAOR,KAAKO,IAAI,CAACC,MAAM;IAE9D,IAAMa,QAAQ,IAAInB;IAClB,IAAMoB,QAAQlB,cAAc,CAACa,SAAS,IAAIb,eAAeM,KAAK;IAC9D,IAAK,IAAIa,QAAQ,GAAGA,QAAQD,MAAME,MAAM,EAAED,QAAS;QACjD,IAAME,OAAOH,KAAK,CAACC,MAAM;QACzBF,MAAMK,KAAK,CAACvB,gBAAgBwB,IAAI,CAAC,MAAM3B,KAAKO,IAAI,CAACY,SAASM,KAAKnB,GAAG,GAAGN,KAAKO,IAAI,CAACa,SAASK,KAAKjB,IAAI,GAAGiB,KAAKhB,QAAQ;IACnH;IAEAY,MAAMO,KAAK,CAACZ;AACd"}
|