node-install-release 1.9.6 → 1.10.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/README.md +4 -4
- package/dist/cjs/cli.cjs +0 -2
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/constants.cjs +33 -15
- package/dist/cjs/constants.cjs.map +1 -1
- package/dist/cjs/createResult.cjs +5 -3
- package/dist/cjs/createResult.cjs.map +1 -1
- package/dist/cjs/installNPM/installBin.cjs +5 -8
- package/dist/cjs/installNPM/installBin.cjs.map +1 -1
- package/dist/cjs/installNPM/installLib.cjs +1 -1
- package/dist/cjs/installNPM/installLib.cjs.map +1 -1
- package/dist/cjs/installNode/index.cjs +33 -34
- package/dist/cjs/installNode/index.cjs.map +1 -1
- package/dist/cjs/installNode/installCompressed.cjs +5 -33
- package/dist/cjs/installNode/installCompressed.cjs.map +1 -1
- package/dist/cjs/installNode/installExe.cjs +6 -4
- package/dist/cjs/installNode/installExe.cjs.map +1 -1
- package/dist/cjs/installNode/installFilename.cjs +6 -2
- package/dist/cjs/installNode/installFilename.cjs.map +1 -1
- package/dist/cjs/installNode/installSource/buildPosix.cjs +2 -2
- package/dist/cjs/installNode/installSource/buildPosix.cjs.map +1 -1
- package/dist/cjs/installNode/installSource/buildWin32.cjs +4 -4
- package/dist/cjs/installNode/installSource/buildWin32.cjs.map +1 -1
- package/dist/cjs/installNode/installSource/index.cjs +1 -1
- package/dist/cjs/installNode/installSource/index.cjs.map +1 -1
- package/dist/cjs/lib/checkMissing.cjs +21 -46
- package/dist/cjs/lib/checkMissing.cjs.map +1 -1
- package/dist/cjs/lib/conditionalCache.cjs +4 -32
- package/dist/cjs/lib/conditionalCache.cjs.map +1 -1
- package/dist/cjs/lib/conditionalCopy.cjs +3 -3
- package/dist/cjs/lib/conditionalCopy.cjs.map +1 -1
- package/dist/cjs/lib/conditionalExtract.cjs +4 -32
- package/dist/cjs/lib/conditionalExtract.cjs.map +1 -1
- package/dist/cjs/lib/getTarget.cjs +37 -0
- package/dist/cjs/lib/getTarget.cjs.map +1 -0
- package/dist/cjs/workers/install.cjs +3 -2
- package/dist/cjs/workers/install.cjs.map +1 -1
- package/dist/esm/cli.mjs +0 -2
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/constants.mjs +20 -7
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/createResult.mjs +6 -4
- package/dist/esm/createResult.mjs.map +1 -1
- package/dist/esm/installNPM/installBin.mjs +4 -9
- package/dist/esm/installNPM/installBin.mjs.map +1 -1
- package/dist/esm/installNPM/installLib.mjs +1 -1
- package/dist/esm/installNPM/installLib.mjs.map +1 -1
- package/dist/esm/installNode/index.mjs +28 -29
- package/dist/esm/installNode/index.mjs.map +1 -1
- package/dist/esm/installNode/installCompressed.mjs +4 -5
- package/dist/esm/installNode/installCompressed.mjs.map +1 -1
- package/dist/esm/installNode/installExe.mjs +7 -5
- package/dist/esm/installNode/installExe.mjs.map +1 -1
- package/dist/esm/installNode/installFilename.mjs +6 -2
- package/dist/esm/installNode/installFilename.mjs.map +1 -1
- package/dist/esm/installNode/installSource/buildPosix.mjs +2 -2
- package/dist/esm/installNode/installSource/buildPosix.mjs.map +1 -1
- package/dist/esm/installNode/installSource/buildWin32.mjs +4 -4
- package/dist/esm/installNode/installSource/buildWin32.mjs.map +1 -1
- package/dist/esm/installNode/installSource/index.mjs +1 -1
- package/dist/esm/installNode/installSource/index.mjs.map +1 -1
- package/dist/esm/lib/checkMissing.mjs +18 -37
- package/dist/esm/lib/checkMissing.mjs.map +1 -1
- package/dist/esm/lib/conditionalCache.mjs +3 -4
- package/dist/esm/lib/conditionalCache.mjs.map +1 -1
- package/dist/esm/lib/conditionalCopy.mjs +3 -3
- package/dist/esm/lib/conditionalCopy.mjs.map +1 -1
- package/dist/esm/lib/conditionalExtract.mjs +3 -4
- package/dist/esm/lib/conditionalExtract.mjs.map +1 -1
- package/dist/esm/lib/getTarget.mjs +21 -0
- package/dist/esm/lib/getTarget.mjs.map +1 -0
- package/dist/esm/types.mjs.map +1 -1
- package/dist/esm/workers/install.mjs +4 -2
- package/dist/esm/workers/install.mjs.map +1 -1
- package/dist/types/constants.d.ts +14 -5
- package/dist/types/lib/checkMissing.d.ts +0 -10
- package/dist/types/lib/getTarget.d.ts +4 -0
- package/dist/types/types.d.ts +1 -0
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -14,17 +14,17 @@ Code:
|
|
|
14
14
|
|
|
15
15
|
```
|
|
16
16
|
var assert = require('assert')
|
|
17
|
-
var
|
|
17
|
+
var install = require('node-install-release')
|
|
18
18
|
|
|
19
19
|
var installPath = path.join(INSTALLED_DIR, 'v12-darwin-x64');
|
|
20
20
|
|
|
21
21
|
// callback - choose the platform and arch
|
|
22
|
-
|
|
22
|
+
install('v12', installPath, { platform: 'darwin', arch: 'x64' }, function (err, res) {
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
// promise - use the local system for platform and arch
|
|
26
|
-
await
|
|
26
|
+
await install('v12', installPath);
|
|
27
27
|
|
|
28
28
|
// promise - from source (using https://nodejs.org/dist/index.json filename)
|
|
29
|
-
await
|
|
29
|
+
await install('v12', installPath, { filename: 'src' });
|
|
30
30
|
```
|
package/dist/cjs/cli.cjs
CHANGED
|
@@ -35,9 +35,7 @@ var _default = function(argv) {
|
|
|
35
35
|
console.log('Missing command. Example usage: nir version [directory]');
|
|
36
36
|
return (0, _exit.default)(-1);
|
|
37
37
|
}
|
|
38
|
-
console.log('cli', args[0], JSON.stringify(options));
|
|
39
38
|
(0, _index.default)(args[0], options, function(err, result) {
|
|
40
|
-
console.log('cli res', args[0], JSON.stringify(options), err, JSON.stringify(result));
|
|
41
39
|
if (!options.silent) {
|
|
42
40
|
console.log('\n======================');
|
|
43
41
|
if (err) console.log("".concat(args[0], " not installed. Error: ").concat(err.message));
|
package/dist/cjs/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/cli.ts"],"sourcesContent":["import exit from 'exit';\nimport getopts from 'getopts-compat';\nimport install, { type InstallOptions } from './index';\n\nexport default (argv) => {\n const options = getopts(argv.slice(1), {\n alias: { platform: 'p', arch: 'a', filename: 'f', installPath: 'i', storagePath: 'c', silent: 's' },\n boolean: ['silent'],\n });\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
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/cli.ts"],"sourcesContent":["import exit from 'exit';\nimport getopts from 'getopts-compat';\nimport install, { type InstallOptions } from './index';\n\nexport default (argv) => {\n const options = getopts(argv.slice(1), {\n alias: { platform: 'p', arch: 'a', filename: 'f', installPath: 'i', storagePath: 'c', silent: 's' },\n boolean: ['silent'],\n });\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 install(args[0], options as InstallOptions, (err, result) => {\n if (!options.silent) {\n console.log('\\n======================');\n if (err) console.log(`${args[0]} not installed. Error: ${err.message}`);\n else console.log(`${result.version} installed in: ${result.installPath}`);\n console.log('======================');\n }\n exit(err ? -1 : 0);\n });\n};\n"],"names":["argv","options","getopts","slice","alias","platform","arch","filename","installPath","storagePath","silent","boolean","args","concat","_","length","console","log","exit","install","err","result","message","version"],"mappings":";;;;+BAIA;;;eAAA;;;2DAJiB;oEACG;4DACyB;;;;;;IAE7C,WAAe,SAACA;IACd,IAAMC,UAAUC,IAAAA,sBAAO,EAACF,KAAKG,KAAK,CAAC,IAAI;QACrCC,OAAO;YAAEC,UAAU;YAAKC,MAAM;YAAKC,UAAU;YAAKC,aAAa;YAAKC,aAAa;YAAKC,QAAQ;QAAI;QAClGC,SAAS;YAAC;SAAS;IACrB;IAEA,IAAMC,OAAOZ,KAAKG,KAAK,CAAC,GAAG,GAAGU,MAAM,CAACZ,QAAQa,CAAC;IAC9C,IAAIF,KAAKG,MAAM,GAAG,GAAG;QACnBC,QAAQC,GAAG,CAAC;QACZ,OAAOC,IAAAA,aAAI,EAAC,CAAC;IACf;IACAC,IAAAA,cAAO,EAACP,IAAI,CAAC,EAAE,EAAEX,SAA2B,SAACmB,KAAKC;QAChD,IAAI,CAACpB,QAAQS,MAAM,EAAE;YACnBM,QAAQC,GAAG,CAAC;YACZ,IAAIG,KAAKJ,QAAQC,GAAG,CAAC,AAAC,GAAmCG,OAAjCR,IAAI,CAAC,EAAE,EAAC,2BAAqC,OAAZQ,IAAIE,OAAO;iBAC/DN,QAAQC,GAAG,CAAC,AAAC,GAAkCI,OAAhCA,OAAOE,OAAO,EAAC,mBAAoC,OAAnBF,OAAOb,WAAW;YACtEQ,QAAQC,GAAG,CAAC;QACd;QACAC,IAAAA,aAAI,EAACE,MAAM,CAAC,IAAI;IAClB;AACF"}
|
package/dist/cjs/constants.cjs
CHANGED
|
@@ -21,12 +21,18 @@ _export(exports, {
|
|
|
21
21
|
FILES: function() {
|
|
22
22
|
return FILES;
|
|
23
23
|
},
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
FILE_PLATFORMS: function() {
|
|
25
|
+
return FILE_PLATFORMS;
|
|
26
|
+
},
|
|
27
|
+
FILE_PLATFORM_MAP: function() {
|
|
28
|
+
return FILE_PLATFORM_MAP;
|
|
26
29
|
},
|
|
27
30
|
NODE_DIST_BASE_URL: function() {
|
|
28
31
|
return NODE_DIST_BASE_URL;
|
|
29
32
|
},
|
|
33
|
+
NODE_FILE_PATHS: function() {
|
|
34
|
+
return NODE_FILE_PATHS;
|
|
35
|
+
},
|
|
30
36
|
NODE_SCHEDULES_URL: function() {
|
|
31
37
|
return NODE_SCHEDULES_URL;
|
|
32
38
|
},
|
|
@@ -36,18 +42,16 @@ _export(exports, {
|
|
|
36
42
|
NPM_DIST_URL: function() {
|
|
37
43
|
return NPM_DIST_URL;
|
|
38
44
|
},
|
|
45
|
+
NPM_FILE_PATHS: function() {
|
|
46
|
+
return NPM_FILE_PATHS;
|
|
47
|
+
},
|
|
39
48
|
NPM_MIN_VERSION: function() {
|
|
40
49
|
return NPM_MIN_VERSION;
|
|
41
|
-
},
|
|
42
|
-
NPM_PLATFORM_FILES: function() {
|
|
43
|
-
return NPM_PLATFORM_FILES;
|
|
44
|
-
},
|
|
45
|
-
isWindows: function() {
|
|
46
|
-
return isWindows;
|
|
47
50
|
}
|
|
48
51
|
});
|
|
49
52
|
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
50
53
|
var _homedirpolyfill = /*#__PURE__*/ _interop_require_default(require("homedir-polyfill"));
|
|
54
|
+
var _lodashkeys = /*#__PURE__*/ _interop_require_default(require("lodash.keys"));
|
|
51
55
|
var _filescjs = /*#__PURE__*/ _interop_require_default(require("../../assets/files.cjs"));
|
|
52
56
|
var _createStoragePaths = /*#__PURE__*/ _interop_require_default(require("./createStoragePaths.cjs"));
|
|
53
57
|
function _interop_require_default(obj) {
|
|
@@ -56,22 +60,36 @@ function _interop_require_default(obj) {
|
|
|
56
60
|
};
|
|
57
61
|
}
|
|
58
62
|
var FILES = _filescjs.default;
|
|
59
|
-
var isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);
|
|
60
|
-
var NODE = isWindows ? 'node.exe' : 'node';
|
|
61
63
|
var DEFAULT_STORAGE_PATH = _path.default.join((0, _homedirpolyfill.default)(), '.nir');
|
|
62
64
|
var DEFAULT_STORAGE_PATHS = (0, _createStoragePaths.default)(DEFAULT_STORAGE_PATH);
|
|
65
|
+
var FILE_PLATFORMS = (0, _lodashkeys.default)(FILES).filter(function(file) {
|
|
66
|
+
return [
|
|
67
|
+
'src',
|
|
68
|
+
'headers'
|
|
69
|
+
].indexOf(file) < 0;
|
|
70
|
+
});
|
|
71
|
+
var FILE_PLATFORM_MAP = {
|
|
72
|
+
win: 'win32',
|
|
73
|
+
win32: 'win',
|
|
74
|
+
osx: 'darwin',
|
|
75
|
+
darwin: 'osx'
|
|
76
|
+
};
|
|
63
77
|
var EXTENSIONS_COMPRESSED = [
|
|
64
78
|
'.gz',
|
|
65
79
|
'.zip',
|
|
66
80
|
'.xz',
|
|
67
81
|
'.7z'
|
|
68
82
|
];
|
|
83
|
+
var NODE_FILE_PATHS = {
|
|
84
|
+
win32: 'node.exe',
|
|
85
|
+
posix: _path.default.join('bin', 'node')
|
|
86
|
+
};
|
|
69
87
|
var NODE_DIST_BASE_URL = 'https://nodejs.org/dist';
|
|
70
88
|
var NODE_SCHEDULES_URL = 'https://raw.githubusercontent.com/nodejs/Release/master/schedule.json';
|
|
71
89
|
var NPM_DIST_URL = 'https://registry.npmjs.org/npm';
|
|
72
90
|
var NPM_DIST_TAGS_URL = 'https://registry.npmjs.org/-/package/npm/dist-tags';
|
|
73
91
|
var NPM_MIN_VERSION = 3;
|
|
74
|
-
var
|
|
92
|
+
var NPM_FILE_PATHS = {
|
|
75
93
|
win32: [
|
|
76
94
|
{
|
|
77
95
|
src: _path.default.join('node_modules', 'npm', 'bin', 'npm'),
|
|
@@ -94,12 +112,12 @@ var NPM_PLATFORM_FILES = {
|
|
|
94
112
|
],
|
|
95
113
|
posix: [
|
|
96
114
|
{
|
|
97
|
-
src: _path.default.join('node_modules', 'npm', 'bin', 'npm-cli.js'),
|
|
98
|
-
dest: 'npm'
|
|
115
|
+
src: _path.default.join('lib', 'node_modules', 'npm', 'bin', 'npm-cli.js'),
|
|
116
|
+
dest: _path.default.join('bin', 'npm')
|
|
99
117
|
},
|
|
100
118
|
{
|
|
101
|
-
src: _path.default.join('node_modules', 'npm', 'bin', 'npx-cli.js'),
|
|
102
|
-
dest: 'npx',
|
|
119
|
+
src: _path.default.join('lib', 'node_modules', 'npm', 'bin', 'npx-cli.js'),
|
|
120
|
+
dest: _path.default.join('bin', 'npx'),
|
|
103
121
|
optional: true
|
|
104
122
|
}
|
|
105
123
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/constants.ts"],"sourcesContent":["import path from 'path';\nimport home from 'homedir-polyfill';\n// @ts-ignore\nimport files from '../../assets/files.cjs';\nimport createStoragePaths from './createStoragePaths';\n\nexport const FILES = files;\
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/constants.ts"],"sourcesContent":["import path from 'path';\nimport home from 'homedir-polyfill';\nimport keys from 'lodash.keys';\n// @ts-ignore\nimport files from '../../assets/files.cjs';\nimport createStoragePaths from './createStoragePaths';\n\nexport const FILES = files;\nexport const DEFAULT_STORAGE_PATH = path.join(home(), '.nir');\nexport const DEFAULT_STORAGE_PATHS = createStoragePaths(DEFAULT_STORAGE_PATH);\n\nexport const FILE_PLATFORMS = keys(FILES).filter((file) => ['src', 'headers'].indexOf(file) < 0);\n\nexport const FILE_PLATFORM_MAP = {\n win: 'win32',\n win32: 'win',\n osx: 'darwin',\n darwin: 'osx',\n};\n\nexport const EXTENSIONS_COMPRESSED = ['.gz', '.zip', '.xz', '.7z'];\n\nexport const NODE_FILE_PATHS = {\n win32: 'node.exe',\n posix: path.join('bin', 'node'),\n};\nexport const NODE_DIST_BASE_URL = 'https://nodejs.org/dist';\nexport const NODE_SCHEDULES_URL = 'https://raw.githubusercontent.com/nodejs/Release/master/schedule.json';\n\nexport const NPM_DIST_URL = 'https://registry.npmjs.org/npm';\nexport const NPM_DIST_TAGS_URL = 'https://registry.npmjs.org/-/package/npm/dist-tags';\nexport const NPM_MIN_VERSION = 3;\nexport const NPM_FILE_PATHS = {\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('lib', 'node_modules', 'npm', 'bin', 'npm-cli.js'), dest: path.join('bin', 'npm') },\n { src: path.join('lib', 'node_modules', 'npm', 'bin', 'npx-cli.js'), dest: path.join('bin', 'npx'), optional: true },\n ],\n};\n"],"names":["DEFAULT_STORAGE_PATH","DEFAULT_STORAGE_PATHS","EXTENSIONS_COMPRESSED","FILES","FILE_PLATFORMS","FILE_PLATFORM_MAP","NODE_DIST_BASE_URL","NODE_FILE_PATHS","NODE_SCHEDULES_URL","NPM_DIST_TAGS_URL","NPM_DIST_URL","NPM_FILE_PATHS","NPM_MIN_VERSION","files","path","join","home","createStoragePaths","keys","filter","file","indexOf","win","win32","osx","darwin","posix","src","dest","optional"],"mappings":";;;;;;;;;;;IAQaA,oBAAoB;eAApBA;;IACAC,qBAAqB;eAArBA;;IAWAC,qBAAqB;eAArBA;;IAbAC,KAAK;eAALA;;IAIAC,cAAc;eAAdA;;IAEAC,iBAAiB;eAAjBA;;IAaAC,kBAAkB;eAAlBA;;IAJAC,eAAe;eAAfA;;IAKAC,kBAAkB;eAAlBA;;IAGAC,iBAAiB;eAAjBA;;IADAC,YAAY;eAAZA;;IAGAC,cAAc;eAAdA;;IADAC,eAAe;eAAfA;;;2DA/BI;sEACA;iEACA;+DAEC;yEACa;;;;;;AAExB,IAAMT,QAAQU,iBAAK;AACnB,IAAMb,uBAAuBc,aAAI,CAACC,IAAI,CAACC,IAAAA,wBAAI,KAAI;AAC/C,IAAMf,wBAAwBgB,IAAAA,2BAAkB,EAACjB;AAEjD,IAAMI,iBAAiBc,IAAAA,mBAAI,EAACf,OAAOgB,MAAM,CAAC,SAACC;WAAS;QAAC;QAAO;KAAU,CAACC,OAAO,CAACD,QAAQ;;AAEvF,IAAMf,oBAAoB;IAC/BiB,KAAK;IACLC,OAAO;IACPC,KAAK;IACLC,QAAQ;AACV;AAEO,IAAMvB,wBAAwB;IAAC;IAAO;IAAQ;IAAO;CAAM;AAE3D,IAAMK,kBAAkB;IAC7BgB,OAAO;IACPG,OAAOZ,aAAI,CAACC,IAAI,CAAC,OAAO;AAC1B;AACO,IAAMT,qBAAqB;AAC3B,IAAME,qBAAqB;AAE3B,IAAME,eAAe;AACrB,IAAMD,oBAAoB;AAC1B,IAAMG,kBAAkB;AACxB,IAAMD,iBAAiB;IAC5BY,OAAO;QACL;YAAEI,KAAKb,aAAI,CAACC,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAQa,MAAM;QAAM;QACnE;YAAED,KAAKb,aAAI,CAACC,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAYa,MAAM;QAAU;QAC3E;YAAED,KAAKb,aAAI,CAACC,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAQa,MAAM;YAAOC,UAAU;QAAK;QACnF;YAAEF,KAAKb,aAAI,CAACC,IAAI,CAAC,gBAAgB,OAAO,OAAO;YAAYa,MAAM;YAAWC,UAAU;QAAK;KAC5F;IACDH,OAAO;QACL;YAAEC,KAAKb,aAAI,CAACC,IAAI,CAAC,OAAO,gBAAgB,OAAO,OAAO;YAAea,MAAMd,aAAI,CAACC,IAAI,CAAC,OAAO;QAAO;QACnG;YAAEY,KAAKb,aAAI,CAACC,IAAI,CAAC,OAAO,gBAAgB,OAAO,OAAO;YAAea,MAAMd,aAAI,CAACC,IAAI,CAAC,OAAO;YAAQc,UAAU;QAAK;KACpH;AACH"}
|
|
@@ -21,12 +21,14 @@ function createResult(options, version) {
|
|
|
21
21
|
var installPath = options.installPath || storagePaths.installPath;
|
|
22
22
|
if (options.name) installPath = _path.default.join(installPath, options.name);
|
|
23
23
|
else if (!options.installPath) installPath = _path.default.join(installPath, version);
|
|
24
|
-
var
|
|
25
|
-
var
|
|
24
|
+
var platform = options.platform;
|
|
25
|
+
var nodePath = _constants.NODE_FILE_PATHS[platform] || _constants.NODE_FILE_PATHS.posix;
|
|
26
|
+
var execPath = _path.default.join(installPath, nodePath);
|
|
26
27
|
return {
|
|
27
28
|
version: version,
|
|
28
29
|
installPath: installPath,
|
|
29
|
-
execPath: execPath
|
|
30
|
+
execPath: execPath,
|
|
31
|
+
platform: platform
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
34
|
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/createResult.ts"],"sourcesContent":["import path from 'path';\nimport { DEFAULT_STORAGE_PATHS,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/createResult.ts"],"sourcesContent":["import path from 'path';\nimport { DEFAULT_STORAGE_PATHS, NODE_FILE_PATHS } from './constants';\n\nimport createStoragePaths from './createStoragePaths';\nimport type { InstallOptions, InstallResult } from './types';\n\nexport default function createResult(options: InstallOptions, version: string): InstallResult {\n const storagePaths = options.storagePath ? createStoragePaths(options.storagePath) : DEFAULT_STORAGE_PATHS;\n let installPath = options.installPath || storagePaths.installPath;\n\n if (options.name) installPath = path.join(installPath, options.name);\n else if (!options.installPath) installPath = path.join(installPath, version);\n const platform = options.platform;\n const nodePath = NODE_FILE_PATHS[platform] || NODE_FILE_PATHS.posix;\n const execPath = path.join(installPath, nodePath);\n return { version, installPath, execPath, platform };\n}\n"],"names":["createResult","options","version","storagePaths","storagePath","createStoragePaths","DEFAULT_STORAGE_PATHS","installPath","name","path","join","platform","nodePath","NODE_FILE_PATHS","posix","execPath"],"mappings":";;;;+BAMA;;;eAAwBA;;;2DANP;yBACsC;yEAExB;;;;;;AAGhB,SAASA,aAAaC,OAAuB,EAAEC,OAAe;IAC3E,IAAMC,eAAeF,QAAQG,WAAW,GAAGC,IAAAA,2BAAkB,EAACJ,QAAQG,WAAW,IAAIE,gCAAqB;IAC1G,IAAIC,cAAcN,QAAQM,WAAW,IAAIJ,aAAaI,WAAW;IAEjE,IAAIN,QAAQO,IAAI,EAAED,cAAcE,aAAI,CAACC,IAAI,CAACH,aAAaN,QAAQO,IAAI;SAC9D,IAAI,CAACP,QAAQM,WAAW,EAAEA,cAAcE,aAAI,CAACC,IAAI,CAACH,aAAaL;IACpE,IAAMS,WAAWV,QAAQU,QAAQ;IACjC,IAAMC,WAAWC,0BAAe,CAACF,SAAS,IAAIE,0BAAe,CAACC,KAAK;IACnE,IAAMC,WAAWN,aAAI,CAACC,IAAI,CAACH,aAAaK;IACxC,OAAO;QAAEV,SAAAA;QAASK,aAAAA;QAAaQ,UAAAA;QAAUJ,UAAAA;IAAS;AACpD"}
|
|
@@ -18,15 +18,12 @@ function _interop_require_default(obj) {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
function installBin(_version, dest, options, callback) {
|
|
21
|
-
var platform = options.platform
|
|
22
|
-
var
|
|
23
|
-
var binPath = platform === 'win32' ? dest : _path.default.join(dest, 'bin');
|
|
21
|
+
var platform = options.platform;
|
|
22
|
+
var files = _constants.NPM_FILE_PATHS[platform] || _constants.NPM_FILE_PATHS.posix;
|
|
24
23
|
var queue = new _queuecb.default();
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
queue.defer(_conditionalCopy.default.bind(null, _path.default.join(libPath, file.src), _path.default.join(binPath, file.dest), file));
|
|
29
|
-
}
|
|
24
|
+
files.forEach(function(file) {
|
|
25
|
+
return queue.defer(_conditionalCopy.default.bind(null, _path.default.join(dest, file.src), _path.default.join(dest, file.dest), file.optional));
|
|
26
|
+
});
|
|
30
27
|
queue.await(callback);
|
|
31
28
|
}
|
|
32
29
|
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNPM/installBin.ts"],"sourcesContent":["import path from 'path';\nimport Queue from 'queue-cb';\nimport conditionalCopy from '../lib/conditionalCopy';\n\nimport {
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNPM/installBin.ts"],"sourcesContent":["import path from 'path';\nimport Queue from 'queue-cb';\nimport conditionalCopy from '../lib/conditionalCopy';\n\nimport { NPM_FILE_PATHS } from '../constants';\n\nexport default function installBin(_version, dest, options, callback) {\n const platform = options.platform;\n const files = NPM_FILE_PATHS[platform] || NPM_FILE_PATHS.posix;\n\n const queue = new Queue();\n files.forEach((file) => queue.defer(conditionalCopy.bind(null, path.join(dest, file.src), path.join(dest, file.dest), file.optional)));\n queue.await(callback);\n}\n"],"names":["installBin","_version","dest","options","callback","platform","files","NPM_FILE_PATHS","posix","queue","Queue","forEach","file","defer","conditionalCopy","bind","path","join","src","optional","await"],"mappings":";;;;+BAMA;;;eAAwBA;;;2DANP;8DACC;sEACU;yBAEG;;;;;;AAEhB,SAASA,WAAWC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAClE,IAAMC,WAAWF,QAAQE,QAAQ;IACjC,IAAMC,QAAQC,yBAAc,CAACF,SAAS,IAAIE,yBAAc,CAACC,KAAK;IAE9D,IAAMC,QAAQ,IAAIC,gBAAK;IACvBJ,MAAMK,OAAO,CAAC,SAACC;eAASH,MAAMI,KAAK,CAACC,wBAAe,CAACC,IAAI,CAAC,MAAMC,aAAI,CAACC,IAAI,CAACf,MAAMU,KAAKM,GAAG,GAAGF,aAAI,CAACC,IAAI,CAACf,MAAMU,KAAKV,IAAI,GAAGU,KAAKO,QAAQ;;IACnIV,MAAMW,KAAK,CAAChB;AACd"}
|
|
@@ -21,7 +21,7 @@ function _interop_require_default(obj) {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
function installLib(version, dest, options, callback) {
|
|
24
|
-
var platform = options.platform
|
|
24
|
+
var platform = options.platform;
|
|
25
25
|
var libPath = platform === 'win32' ? dest : _path.default.join(dest, 'lib');
|
|
26
26
|
var installPath = _path.default.join(libPath, 'node_modules', 'npm');
|
|
27
27
|
var dist = (0, _nodefilenametodistpaths.getDist)(version);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNPM/installLib.ts"],"sourcesContent":["import path from 'path';\nimport get from 'get-remote';\nimport { getDist } from 'node-filename-to-dist-paths';\nimport Queue from 'queue-cb';\n\nimport conditionalCache from '../lib/conditionalCache';\nimport conditionalExtract from '../lib/conditionalExtract';\n\nimport { NPM_DIST_TAGS_URL, NPM_DIST_URL, NPM_MIN_VERSION } from '../constants';\n\ninterface DistRecord {\n latest: string;\n}\n\nexport default function installLib(version, dest, options, callback) {\n const platform = options.platform
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNPM/installLib.ts"],"sourcesContent":["import path from 'path';\nimport get from 'get-remote';\nimport { getDist } from 'node-filename-to-dist-paths';\nimport Queue from 'queue-cb';\n\nimport conditionalCache from '../lib/conditionalCache';\nimport conditionalExtract from '../lib/conditionalExtract';\n\nimport { NPM_DIST_TAGS_URL, NPM_DIST_URL, NPM_MIN_VERSION } from '../constants';\n\ninterface DistRecord {\n latest: string;\n}\n\nexport default function installLib(version, dest, options, callback) {\n const platform = options.platform;\n const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');\n const installPath = path.join(libPath, 'node_modules', 'npm');\n\n const dist = getDist(version);\n const npmMajorPair = dist && dist.npm ? +dist.npm.split('.')[0] : NPM_MIN_VERSION;\n const npmMajor = Math.max(npmMajorPair, NPM_MIN_VERSION);\n\n get(NPM_DIST_TAGS_URL).json((err, res) => {\n if (err) return callback(err);\n const distTags = res.body as DistRecord;\n const npmVersion = distTags[`latest-${npmMajor}`] || distTags[`next-${npmMajor}`] || distTags.latest;\n const downloadPath = `${NPM_DIST_URL}/-/npm-${npmVersion}.tgz`;\n const cachePath = path.join(options.cachePath, path.basename(downloadPath));\n\n const queue = new Queue(1);\n queue.defer(conditionalCache.bind(null, downloadPath, cachePath));\n queue.defer(conditionalExtract.bind(null, cachePath, installPath));\n queue.await((err) => {\n err ? callback(err) : callback(null, npmVersion);\n });\n });\n}\n"],"names":["installLib","version","dest","options","callback","platform","libPath","path","join","installPath","dist","getDist","npmMajorPair","npm","split","NPM_MIN_VERSION","npmMajor","Math","max","get","NPM_DIST_TAGS_URL","json","err","res","distTags","body","npmVersion","latest","downloadPath","NPM_DIST_URL","cachePath","basename","queue","Queue","defer","conditionalCache","bind","conditionalExtract","await"],"mappings":";;;;+BAcA;;;eAAwBA;;;2DAdP;gEACD;uCACQ;8DACN;uEAEW;yEACE;yBAEkC;;;;;;AAMlD,SAASA,WAAWC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACjE,IAAMC,WAAWF,QAAQE,QAAQ;IACjC,IAAMC,UAAUD,aAAa,UAAUH,OAAOK,aAAI,CAACC,IAAI,CAACN,MAAM;IAC9D,IAAMO,cAAcF,aAAI,CAACC,IAAI,CAACF,SAAS,gBAAgB;IAEvD,IAAMI,OAAOC,IAAAA,gCAAO,EAACV;IACrB,IAAMW,eAAeF,QAAQA,KAAKG,GAAG,GAAG,CAACH,KAAKG,GAAG,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE,GAAGC,0BAAe;IACjF,IAAMC,WAAWC,KAAKC,GAAG,CAACN,cAAcG,0BAAe;IAEvDI,IAAAA,kBAAG,EAACC,4BAAiB,EAAEC,IAAI,CAAC,SAACC,KAAKC;QAChC,IAAID,KAAK,OAAOlB,SAASkB;QACzB,IAAME,WAAWD,IAAIE,IAAI;QACzB,IAAMC,aAAaF,QAAQ,CAAC,AAAC,UAAkB,OAATR,UAAW,IAAIQ,QAAQ,CAAC,AAAC,QAAgB,OAATR,UAAW,IAAIQ,SAASG,MAAM;QACpG,IAAMC,eAAe,AAAC,GAAwBF,OAAtBG,uBAAY,EAAC,WAAoB,OAAXH,YAAW;QACzD,IAAMI,YAAYvB,aAAI,CAACC,IAAI,CAACL,QAAQ2B,SAAS,EAAEvB,aAAI,CAACwB,QAAQ,CAACH;QAE7D,IAAMI,QAAQ,IAAIC,gBAAK,CAAC;QACxBD,MAAME,KAAK,CAACC,yBAAgB,CAACC,IAAI,CAAC,MAAMR,cAAcE;QACtDE,MAAME,KAAK,CAACG,2BAAkB,CAACD,IAAI,CAAC,MAAMN,WAAWrB;QACrDuB,MAAMM,KAAK,CAAC,SAAChB;YACXA,MAAMlB,SAASkB,OAAOlB,SAAS,MAAMsB;QACvC;IACF;AACF"}
|
|
@@ -9,7 +9,6 @@ Object.defineProperty(exports, "default", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
var _singlelinelog2 = /*#__PURE__*/ _interop_require_default(require("single-line-log2"));
|
|
12
|
-
var _archcjs = /*#__PURE__*/ _interop_require_default(require("../machine/arch.cjs"));
|
|
13
12
|
var _installFilename = /*#__PURE__*/ _interop_require_default(require("./installFilename.cjs"));
|
|
14
13
|
var _constants = require("../constants.cjs");
|
|
15
14
|
function _interop_require_default(obj) {
|
|
@@ -17,42 +16,42 @@ function _interop_require_default(obj) {
|
|
|
17
16
|
default: obj
|
|
18
17
|
};
|
|
19
18
|
}
|
|
20
|
-
var PLATFORM_MAP = {
|
|
21
|
-
win32: 'win',
|
|
22
|
-
darwin: 'osx'
|
|
23
|
-
};
|
|
24
|
-
var archMachine;
|
|
25
19
|
function install(version, dest, options, callback) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var parts = [
|
|
31
|
-
platform,
|
|
32
|
-
arch
|
|
20
|
+
var filenames = null;
|
|
21
|
+
// a specific filename
|
|
22
|
+
if (options.filename) filenames = [
|
|
23
|
+
options.filename
|
|
33
24
|
];
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
25
|
+
else {
|
|
26
|
+
var platform = options.platform, arch = options.arch;
|
|
27
|
+
var filePlatform = _constants.FILE_PLATFORM_MAP[platform] || platform;
|
|
28
|
+
var parts = [
|
|
29
|
+
filePlatform,
|
|
30
|
+
arch
|
|
31
|
+
];
|
|
32
|
+
if (options.type) parts.push(options.type);
|
|
33
|
+
if (options.compression) parts.push(options.compression);
|
|
34
|
+
// generate the files in search order
|
|
35
|
+
var archs = [
|
|
36
|
+
arch,
|
|
37
|
+
process.arch
|
|
38
|
+
];
|
|
39
|
+
filenames = archs.map(function(a) {
|
|
40
|
+
return [
|
|
41
|
+
filePlatform,
|
|
42
|
+
a
|
|
43
|
+
].concat(parts.slice(2)).join('-');
|
|
44
|
+
});
|
|
45
|
+
(_constants.FILES[filePlatform] || []).forEach(function(x) {
|
|
46
|
+
return filenames.push(x.filename);
|
|
47
|
+
});
|
|
48
|
+
filenames.push('src');
|
|
49
|
+
filenames = filenames.filter(function(filename, i) {
|
|
50
|
+
return filenames.indexOf(filename) === i;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
54
53
|
var tryNext = function(cb) {
|
|
55
|
-
if (filenames.length === 0) return cb(new Error("Failed to find installable for ".concat(version)));
|
|
54
|
+
if (filenames.length === 0) return cb(new Error("Failed to find installable for ".concat(version).concat(options.filename ? " Filename: ".concat(options.filename) : '')));
|
|
56
55
|
(0, _installFilename.default)(filenames.shift(), version, dest, options, function(err) {
|
|
57
56
|
return err ? tryNext(cb) : cb();
|
|
58
57
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/index.ts"],"sourcesContent":["import sll from 'single-line-log2';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/index.ts"],"sourcesContent":["import sll from 'single-line-log2';\nimport installFilename from './installFilename';\n\nimport { FILES, FILE_PLATFORM_MAP } from '../constants';\n\nexport default function install(version, dest, options, callback) {\n let filenames = null;\n\n // a specific filename\n if (options.filename) filenames = [options.filename];\n // infer with fallbacks\n else {\n const { platform, arch } = options;\n const filePlatform = FILE_PLATFORM_MAP[platform] || platform;\n const parts = [filePlatform, arch];\n if (options.type) parts.push(options.type);\n if (options.compression) parts.push(options.compression);\n\n // generate the files in search order\n const archs = [arch, process.arch];\n filenames = archs.map((a) => [filePlatform, a].concat(parts.slice(2)).join('-'));\n (FILES[filePlatform] || []).forEach((x) => filenames.push(x.filename));\n filenames.push('src');\n filenames = filenames.filter((filename, i) => filenames.indexOf(filename) === i);\n }\n\n const tryNext = (cb) => {\n if (filenames.length === 0) return cb(new Error(`Failed to find installable for ${version}${options.filename ? ` Filename: ${options.filename}` : ''}`));\n installFilename(filenames.shift(), version, dest, options, (err) => (err ? tryNext(cb) : cb()));\n };\n tryNext((err) => {\n sll.stdout('');\n console.log(`node ${version.slice(1)} ${!err ? 'installed' : `install failed. Error: ${err.message}`}`);\n callback(err);\n });\n}\n"],"names":["install","version","dest","options","callback","filenames","filename","platform","arch","filePlatform","FILE_PLATFORM_MAP","parts","type","push","compression","archs","process","map","a","concat","slice","join","FILES","forEach","x","filter","i","indexOf","tryNext","cb","length","Error","installFilename","shift","err","sll","stdout","console","log","message"],"mappings":";;;;+BAKA;;;eAAwBA;;;qEALR;sEACY;yBAEa;;;;;;AAE1B,SAASA,QAAQC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAC9D,IAAIC,YAAY;IAEhB,sBAAsB;IACtB,IAAIF,QAAQG,QAAQ,EAAED,YAAY;QAACF,QAAQG,QAAQ;KAAC;SAE/C;QACH,IAAQC,WAAmBJ,QAAnBI,UAAUC,OAASL,QAATK;QAClB,IAAMC,eAAeC,4BAAiB,CAACH,SAAS,IAAIA;QACpD,IAAMI,QAAQ;YAACF;YAAcD;SAAK;QAClC,IAAIL,QAAQS,IAAI,EAAED,MAAME,IAAI,CAACV,QAAQS,IAAI;QACzC,IAAIT,QAAQW,WAAW,EAAEH,MAAME,IAAI,CAACV,QAAQW,WAAW;QAEvD,qCAAqC;QACrC,IAAMC,QAAQ;YAACP;YAAMQ,QAAQR,IAAI;SAAC;QAClCH,YAAYU,MAAME,GAAG,CAAC,SAACC;mBAAM;gBAACT;gBAAcS;aAAE,CAACC,MAAM,CAACR,MAAMS,KAAK,CAAC,IAAIC,IAAI,CAAC;;QAC1EC,CAAAA,gBAAK,CAACb,aAAa,IAAI,EAAE,AAAD,EAAGc,OAAO,CAAC,SAACC;mBAAMnB,UAAUQ,IAAI,CAACW,EAAElB,QAAQ;;QACpED,UAAUQ,IAAI,CAAC;QACfR,YAAYA,UAAUoB,MAAM,CAAC,SAACnB,UAAUoB;mBAAMrB,UAAUsB,OAAO,CAACrB,cAAcoB;;IAChF;IAEA,IAAME,UAAU,SAACC;QACf,IAAIxB,UAAUyB,MAAM,KAAK,GAAG,OAAOD,GAAG,IAAIE,MAAM,AAAC,kCAA2C5B,OAAVF,SAAmE,OAAzDE,QAAQG,QAAQ,GAAG,AAAC,cAA8B,OAAjBH,QAAQG,QAAQ,IAAK;QAClJ0B,IAAAA,wBAAe,EAAC3B,UAAU4B,KAAK,IAAIhC,SAASC,MAAMC,SAAS,SAAC+B;mBAASA,MAAMN,QAAQC,MAAMA;;IAC3F;IACAD,QAAQ,SAACM;QACPC,uBAAG,CAACC,MAAM,CAAC;QACXC,QAAQC,GAAG,CAAC,AAAC,QAA2B,OAApBrC,QAAQmB,KAAK,CAAC,IAAG,KAAgE,OAA7D,CAACc,MAAM,cAAc,AAAC,0BAAqC,OAAZA,IAAIK,OAAO;QAClGnC,SAAS8B;IACX;AACF"}
|
|
@@ -8,62 +8,34 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return installCompressed;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
11
12
|
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
12
|
-
var _fsaccesscompat = /*#__PURE__*/ _interop_require_default(require("fs-access-compat"));
|
|
13
13
|
var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
|
|
14
14
|
var _rimraf2 = /*#__PURE__*/ _interop_require_default(require("rimraf2"));
|
|
15
15
|
var _constants = require("../constants.cjs");
|
|
16
16
|
var _conditionalCache = /*#__PURE__*/ _interop_require_default(require("../lib/conditionalCache.cjs"));
|
|
17
17
|
var _conditionalExtract = /*#__PURE__*/ _interop_require_default(require("../lib/conditionalExtract.cjs"));
|
|
18
18
|
var _validateDownload = /*#__PURE__*/ _interop_require_default(require("./validateDownload.cjs"));
|
|
19
|
-
function _define_property(obj, key, value) {
|
|
20
|
-
if (key in obj) {
|
|
21
|
-
Object.defineProperty(obj, key, {
|
|
22
|
-
value: value,
|
|
23
|
-
enumerable: true,
|
|
24
|
-
configurable: true,
|
|
25
|
-
writable: true
|
|
26
|
-
});
|
|
27
|
-
} else {
|
|
28
|
-
obj[key] = value;
|
|
29
|
-
}
|
|
30
|
-
return obj;
|
|
31
|
-
}
|
|
32
19
|
function _interop_require_default(obj) {
|
|
33
20
|
return obj && obj.__esModule ? obj : {
|
|
34
21
|
default: obj
|
|
35
22
|
};
|
|
36
23
|
}
|
|
37
|
-
function _object_spread(target) {
|
|
38
|
-
for(var i = 1; i < arguments.length; i++){
|
|
39
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
40
|
-
var ownKeys = Object.keys(source);
|
|
41
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
42
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
43
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
44
|
-
}));
|
|
45
|
-
}
|
|
46
|
-
ownKeys.forEach(function(key) {
|
|
47
|
-
_define_property(target, key, source[key]);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return target;
|
|
51
|
-
}
|
|
52
24
|
function installCompressed(distPath, dest, options, callback) {
|
|
25
|
+
var platform = options.platform;
|
|
53
26
|
var downloadPath = "".concat(_constants.NODE_DIST_BASE_URL, "/").concat(distPath);
|
|
54
27
|
var cachePath = _path.default.join(options.cachePath, _path.default.basename(downloadPath));
|
|
55
|
-
|
|
28
|
+
_fs.default.stat(dest, function(err) {
|
|
56
29
|
if (!err) return callback(); // already exists
|
|
57
30
|
var queue = new _queuecb.default(1);
|
|
58
31
|
queue.defer(_conditionalCache.default.bind(null, downloadPath, cachePath));
|
|
59
32
|
queue.defer(_validateDownload.default.bind(null, distPath, cachePath));
|
|
60
|
-
queue.defer(_conditionalExtract.default.bind(null, cachePath, dest,
|
|
33
|
+
queue.defer(_conditionalExtract.default.bind(null, cachePath, dest, {
|
|
61
34
|
strip: 1,
|
|
62
35
|
time: 1000
|
|
63
|
-
}
|
|
36
|
+
}));
|
|
64
37
|
queue.await(function(err) {
|
|
65
38
|
// some compressed versions of node come with npm pre-installed, but we want to override with a specific version
|
|
66
|
-
var platform = options.platform || process.platform;
|
|
67
39
|
var libPath = platform === 'win32' ? dest : _path.default.join(dest, 'lib');
|
|
68
40
|
var installPath = _path.default.join(libPath, 'node_modules', 'npm');
|
|
69
41
|
(0, _rimraf2.default)(installPath, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installCompressed.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installCompressed.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport rimraf2 from 'rimraf2';\n\nimport { NODE_DIST_BASE_URL } from '../constants';\nimport conditionalCache from '../lib/conditionalCache';\nimport conditionalExtract from '../lib/conditionalExtract';\nimport validateDownload from './validateDownload';\n\nexport default function installCompressed(distPath, dest, options, callback) {\n const platform = options.platform;\n const downloadPath = `${NODE_DIST_BASE_URL}/${distPath}`;\n const cachePath = path.join(options.cachePath, path.basename(downloadPath));\n\n fs.stat(dest, (err) => {\n if (!err) return callback(); // already exists\n\n const queue = new Queue(1);\n queue.defer(conditionalCache.bind(null, downloadPath, cachePath));\n queue.defer(validateDownload.bind(null, distPath, cachePath));\n queue.defer(conditionalExtract.bind(null, cachePath, dest, { strip: 1, time: 1000 }));\n queue.await((err) => {\n // some compressed versions of node come with npm pre-installed, but we want to override with a specific version\n const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');\n const installPath = path.join(libPath, 'node_modules', 'npm');\n rimraf2(installPath, { disableGlob: true }, () => callback(err));\n });\n });\n}\n"],"names":["installCompressed","distPath","dest","options","callback","platform","downloadPath","NODE_DIST_BASE_URL","cachePath","path","join","basename","fs","stat","err","queue","Queue","defer","conditionalCache","bind","validateDownload","conditionalExtract","strip","time","await","libPath","installPath","rimraf2","disableGlob"],"mappings":";;;;+BAUA;;;eAAwBA;;;yDAVT;2DACE;8DACC;8DACE;yBAEe;uEACN;yEACE;uEACF;;;;;;AAEd,SAASA,kBAAkBC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACzE,IAAMC,WAAWF,QAAQE,QAAQ;IACjC,IAAMC,eAAe,AAAC,GAAwBL,OAAtBM,6BAAkB,EAAC,KAAY,OAATN;IAC9C,IAAMO,YAAYC,aAAI,CAACC,IAAI,CAACP,QAAQK,SAAS,EAAEC,aAAI,CAACE,QAAQ,CAACL;IAE7DM,WAAE,CAACC,IAAI,CAACX,MAAM,SAACY;QACb,IAAI,CAACA,KAAK,OAAOV,YAAY,iBAAiB;QAE9C,IAAMW,QAAQ,IAAIC,gBAAK,CAAC;QACxBD,MAAME,KAAK,CAACC,yBAAgB,CAACC,IAAI,CAAC,MAAMb,cAAcE;QACtDO,MAAME,KAAK,CAACG,yBAAgB,CAACD,IAAI,CAAC,MAAMlB,UAAUO;QAClDO,MAAME,KAAK,CAACI,2BAAkB,CAACF,IAAI,CAAC,MAAMX,WAAWN,MAAM;YAAEoB,OAAO;YAAGC,MAAM;QAAK;QAClFR,MAAMS,KAAK,CAAC,SAACV;YACX,gHAAgH;YAChH,IAAMW,UAAUpB,aAAa,UAAUH,OAAOO,aAAI,CAACC,IAAI,CAACR,MAAM;YAC9D,IAAMwB,cAAcjB,aAAI,CAACC,IAAI,CAACe,SAAS,gBAAgB;YACvDE,IAAAA,gBAAO,EAACD,aAAa;gBAAEE,aAAa;YAAK,GAAG;uBAAMxB,SAASU;;QAC7D;IACF;AACF"}
|
|
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return installExe;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
11
12
|
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
12
|
-
var _fsaccesscompat = /*#__PURE__*/ _interop_require_default(require("fs-access-compat"));
|
|
13
13
|
var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
|
|
14
14
|
var _constants = require("../constants.cjs");
|
|
15
15
|
var _conditionalCache = /*#__PURE__*/ _interop_require_default(require("../lib/conditionalCache.cjs"));
|
|
@@ -21,15 +21,17 @@ function _interop_require_default(obj) {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
function installExe(distPath, dest, options, callback) {
|
|
24
|
+
var platform = options.platform;
|
|
24
25
|
var downloadPath = "".concat(_constants.NODE_DIST_BASE_URL, "/").concat(distPath);
|
|
25
26
|
var cachePath = _path.default.join(options.cachePath, "node-".concat(distPath, ".exe"));
|
|
26
|
-
var
|
|
27
|
-
|
|
27
|
+
var nodePath = _constants.NODE_FILE_PATHS[platform] || _constants.NODE_FILE_PATHS.posix;
|
|
28
|
+
var execPath = _path.default.join(dest, nodePath);
|
|
29
|
+
_fs.default.stat(execPath, function(err) {
|
|
28
30
|
if (!err) return callback(); // already exists
|
|
29
31
|
var queue = new _queuecb.default(1);
|
|
30
32
|
queue.defer(_conditionalCache.default.bind(null, downloadPath, cachePath));
|
|
31
33
|
queue.defer(_validateDownload.default.bind(null, distPath, cachePath));
|
|
32
|
-
queue.defer(_copyFile.default.bind(null, cachePath,
|
|
34
|
+
queue.defer(_copyFile.default.bind(null, cachePath, execPath));
|
|
33
35
|
queue.await(callback);
|
|
34
36
|
});
|
|
35
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installExe.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installExe.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport Queue from 'queue-cb';\n\nimport { NODE_DIST_BASE_URL, NODE_FILE_PATHS } from '../constants';\nimport conditionalCache from '../lib/conditionalCache';\nimport copyFile from '../lib/copyFile';\nimport validateDownload from './validateDownload';\n\nexport default function installExe(distPath, dest, options, callback) {\n const platform = options.platform;\n const downloadPath = `${NODE_DIST_BASE_URL}/${distPath}`;\n const cachePath = path.join(options.cachePath, `node-${distPath}.exe`);\n const nodePath = NODE_FILE_PATHS[platform] || NODE_FILE_PATHS.posix;\n const execPath = path.join(dest, nodePath);\n\n fs.stat(execPath, (err) => {\n if (!err) return callback(); // already exists\n\n const queue = new Queue(1);\n queue.defer(conditionalCache.bind(null, downloadPath, cachePath));\n queue.defer(validateDownload.bind(null, distPath, cachePath));\n queue.defer(copyFile.bind(null, cachePath, execPath));\n queue.await(callback);\n });\n}\n"],"names":["installExe","distPath","dest","options","callback","platform","downloadPath","NODE_DIST_BASE_URL","cachePath","path","join","nodePath","NODE_FILE_PATHS","posix","execPath","fs","stat","err","queue","Queue","defer","conditionalCache","bind","validateDownload","copyFile","await"],"mappings":";;;;+BASA;;;eAAwBA;;;yDATT;2DACE;8DACC;yBAEkC;uEACvB;+DACR;uEACQ;;;;;;AAEd,SAASA,WAAWC,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAClE,IAAMC,WAAWF,QAAQE,QAAQ;IACjC,IAAMC,eAAe,AAAC,GAAwBL,OAAtBM,6BAAkB,EAAC,KAAY,OAATN;IAC9C,IAAMO,YAAYC,aAAI,CAACC,IAAI,CAACP,QAAQK,SAAS,EAAE,AAAC,QAAgB,OAATP,UAAS;IAChE,IAAMU,WAAWC,0BAAe,CAACP,SAAS,IAAIO,0BAAe,CAACC,KAAK;IACnE,IAAMC,WAAWL,aAAI,CAACC,IAAI,CAACR,MAAMS;IAEjCI,WAAE,CAACC,IAAI,CAACF,UAAU,SAACG;QACjB,IAAI,CAACA,KAAK,OAAOb,YAAY,iBAAiB;QAE9C,IAAMc,QAAQ,IAAIC,gBAAK,CAAC;QACxBD,MAAME,KAAK,CAACC,yBAAgB,CAACC,IAAI,CAAC,MAAMhB,cAAcE;QACtDU,MAAME,KAAK,CAACG,yBAAgB,CAACD,IAAI,CAAC,MAAMrB,UAAUO;QAClDU,MAAME,KAAK,CAACI,iBAAQ,CAACF,IAAI,CAAC,MAAMd,WAAWM;QAC3CI,MAAMO,KAAK,CAACrB;IACd;AACF"}
|
|
@@ -23,9 +23,13 @@ function installFilename(filename, version, dest, options, callback) {
|
|
|
23
23
|
var distPath = (0, _nodefilenametodistpaths.default)(filename, version);
|
|
24
24
|
if (!distPath) return callback(new Error('Not found'));
|
|
25
25
|
var ext = _path.default.extname(distPath);
|
|
26
|
-
if (ext === '.exe') return (0, _installExe.default)(distPath, dest, options, callback);
|
|
27
|
-
if (_constants.EXTENSIONS_COMPRESSED.indexOf(ext) >= 0) return (0, _installCompressed.default)(distPath, dest, options, callback);
|
|
28
26
|
if (filename === 'src') return (0, _index.default)(distPath, dest, options, callback);
|
|
27
|
+
if (ext === '.exe') return (0, _installExe.default)(distPath, dest, options, callback);
|
|
28
|
+
if (_constants.EXTENSIONS_COMPRESSED.indexOf(ext) >= 0) {
|
|
29
|
+
// 7z is not supported by fast extract
|
|
30
|
+
if (ext === '.7z') return callback(new Error('7z not supported. Make a request feature request: https://github.com/kmalakoff/node-install-release/pulls'));
|
|
31
|
+
return (0, _installCompressed.default)(distPath, dest, options, callback);
|
|
32
|
+
}
|
|
29
33
|
callback(new Error("Unable to install ".concat(version, " distPath: ").concat(distPath)));
|
|
30
34
|
}
|
|
31
35
|
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installFilename.ts"],"sourcesContent":["import path from 'path';\nimport fromFilename from 'node-filename-to-dist-paths';\nimport { EXTENSIONS_COMPRESSED } from '../constants';\n\nimport installCompressed from './installCompressed';\nimport installExe from './installExe';\nimport installSource from './installSource/index';\n\nexport default function installFilename(filename, version, dest, options, callback) {\n const distPath = fromFilename(filename, version);\n if (!distPath) return callback(new Error('Not found'));\n const ext = path.extname(distPath);\n\n if (
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installFilename.ts"],"sourcesContent":["import path from 'path';\nimport fromFilename from 'node-filename-to-dist-paths';\nimport { EXTENSIONS_COMPRESSED, FILE_PLATFORM_MAP } from '../constants';\n\nimport installCompressed from './installCompressed';\nimport installExe from './installExe';\nimport installSource from './installSource/index';\n\nexport default function installFilename(filename, version, dest, options, callback) {\n const distPath = fromFilename(filename, version);\n if (!distPath) return callback(new Error('Not found'));\n const ext = path.extname(distPath);\n\n if (filename === 'src') return installSource(distPath, dest, options, callback);\n if (ext === '.exe') return installExe(distPath, dest, options, callback);\n if (EXTENSIONS_COMPRESSED.indexOf(ext) >= 0) {\n // 7z is not supported by fast extract\n if (ext === '.7z') return callback(new Error('7z not supported. Make a request feature request: https://github.com/kmalakoff/node-install-release/pulls'));\n return installCompressed(distPath, dest, options, callback);\n }\n callback(new Error(`Unable to install ${version} distPath: ${distPath}`));\n}\n"],"names":["installFilename","filename","version","dest","options","callback","distPath","fromFilename","Error","ext","path","extname","installSource","installExe","EXTENSIONS_COMPRESSED","indexOf","installCompressed"],"mappings":";;;;+BAQA;;;eAAwBA;;;2DARP;8EACQ;yBACgC;wEAE3B;iEACP;4DACG;;;;;;AAEX,SAASA,gBAAgBC,QAAQ,EAAEC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IAChF,IAAMC,WAAWC,IAAAA,gCAAY,EAACN,UAAUC;IACxC,IAAI,CAACI,UAAU,OAAOD,SAAS,IAAIG,MAAM;IACzC,IAAMC,MAAMC,aAAI,CAACC,OAAO,CAACL;IAEzB,IAAIL,aAAa,OAAO,OAAOW,IAAAA,cAAa,EAACN,UAAUH,MAAMC,SAASC;IACtE,IAAII,QAAQ,QAAQ,OAAOI,IAAAA,mBAAU,EAACP,UAAUH,MAAMC,SAASC;IAC/D,IAAIS,gCAAqB,CAACC,OAAO,CAACN,QAAQ,GAAG;QAC3C,sCAAsC;QACtC,IAAIA,QAAQ,OAAO,OAAOJ,SAAS,IAAIG,MAAM;QAC7C,OAAOQ,IAAAA,0BAAiB,EAACV,UAAUH,MAAMC,SAASC;IACpD;IACAA,SAAS,IAAIG,MAAM,AAAC,qBAAyCF,OAArBJ,SAAQ,eAAsB,OAATI;AAC/D"}
|
|
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return installPosix;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
11
12
|
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
12
13
|
var _crossspawncb = /*#__PURE__*/ _interop_require_default(require("cross-spawn-cb"));
|
|
13
|
-
var _fsaccesscompat = /*#__PURE__*/ _interop_require_default(require("fs-access-compat"));
|
|
14
14
|
var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
|
|
15
15
|
function _interop_require_default(obj) {
|
|
16
16
|
return obj && obj.__esModule ? obj : {
|
|
@@ -19,7 +19,7 @@ function _interop_require_default(obj) {
|
|
|
19
19
|
}
|
|
20
20
|
function installPosix(buildPath, dest, _options, callback) {
|
|
21
21
|
var buildTarget = _path.default.join(dest, 'node');
|
|
22
|
-
|
|
22
|
+
_fs.default.stat(buildTarget, function(err) {
|
|
23
23
|
if (!err) return callback(); // already exists
|
|
24
24
|
var queue = new _queuecb.default(1);
|
|
25
25
|
queue.defer(_crossspawncb.default.bind(null, './configure', [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installSource/buildPosix.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installSource/buildPosix.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport spawn from 'cross-spawn-cb';\nimport Queue from 'queue-cb';\n\nexport default function installPosix(buildPath, dest, _options, callback) {\n const buildTarget = path.join(dest, 'node');\n\n fs.stat(buildTarget, (err) => {\n if (!err) return callback(); // already exists\n\n const queue = new Queue(1);\n queue.defer(spawn.bind(null, './configure', [`--prefix=${dest}`], { stdio: 'inherit', cwd: buildPath }));\n queue.defer(spawn.bind(null, 'make', ['install'], { stdio: 'inherit', cwd: buildPath }, callback));\n queue.await(callback);\n });\n}\n"],"names":["installPosix","buildPath","dest","_options","callback","buildTarget","path","join","fs","stat","err","queue","Queue","defer","spawn","bind","stdio","cwd","await"],"mappings":";;;;+BAKA;;;eAAwBA;;;yDALT;2DACE;mEACC;8DACA;;;;;;AAEH,SAASA,aAAaC,SAAS,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ;IACtE,IAAMC,cAAcC,aAAI,CAACC,IAAI,CAACL,MAAM;IAEpCM,WAAE,CAACC,IAAI,CAACJ,aAAa,SAACK;QACpB,IAAI,CAACA,KAAK,OAAON,YAAY,iBAAiB;QAE9C,IAAMO,QAAQ,IAAIC,gBAAK,CAAC;QACxBD,MAAME,KAAK,CAACC,qBAAK,CAACC,IAAI,CAAC,MAAM,eAAe;YAAE,YAAgB,OAALb;SAAO,EAAE;YAAEc,OAAO;YAAWC,KAAKhB;QAAU;QACrGU,MAAME,KAAK,CAACC,qBAAK,CAACC,IAAI,CAAC,MAAM,QAAQ;YAAC;SAAU,EAAE;YAAEC,OAAO;YAAWC,KAAKhB;QAAU,GAAGG;QACxFO,MAAMO,KAAK,CAACd;IACd;AACF"}
|