node-install-release 0.3.8 → 0.3.11
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/node-install-release.js +1 -2
- package/lib/arch.js +65 -7
- package/lib/conditionalCache.js +1 -2
- package/lib/conditionalExtract.js +1 -2
- package/lib/index.js +1 -0
- package/lib/install.js +2 -2
- package/lib/installNode/filenames.js +11 -6
- package/lib/installNode/installCompressed.js +1 -2
- package/lib/polyfills/execCallback.js +5 -0
- package/lib/polyfills/index.js +14 -0
- package/package.json +10 -10
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var getopts = require('getopts-compat');
|
|
4
4
|
var exit = require('exit');
|
|
5
|
-
var assign = require('just-extend');
|
|
6
5
|
var nir = require('..');
|
|
7
6
|
|
|
8
7
|
(function () {
|
|
@@ -23,7 +22,7 @@ var nir = require('..');
|
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
var installPath = args.length > 1 ? args[1] : null;
|
|
26
|
-
nir(args[0], installPath, assign({ stdio: 'inherit' }, options), function (err, results) {
|
|
25
|
+
nir(args[0], installPath, Object.assign({ stdio: 'inherit' }, options), function (err, results) {
|
|
27
26
|
if (err) {
|
|
28
27
|
console.log(err.message);
|
|
29
28
|
return exit(err.code || -1);
|
package/lib/arch.js
CHANGED
|
@@ -1,14 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
var execSync = require('child_process').execSync;
|
|
1
|
+
// Inline until merged: https://github.com/jakejarvis/arch/blob/detect-arm/index.js
|
|
3
2
|
|
|
3
|
+
/*! arch. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
4
|
+
var cp = require('child_process');
|
|
5
|
+
var fs = require('fs');
|
|
6
|
+
var path = require('path');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Returns the operating system's CPU architecture. This is different than
|
|
10
|
+
* `process.arch` or `os.arch()` which returns the architecture the Node.js (or
|
|
11
|
+
* Electron) binary was compiled for.
|
|
12
|
+
*/
|
|
13
|
+
module.exports = function arch() {
|
|
14
|
+
/**
|
|
15
|
+
* On macOS, we need to detect if x64 Node is running because the CPU is truly
|
|
16
|
+
* an Intel chip, or if it's running on Apple Silicon via Rosetta 2:
|
|
17
|
+
* https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment
|
|
18
|
+
*/
|
|
19
|
+
if (process.platform === 'darwin') {
|
|
20
|
+
var nativeArm = process.arch === 'arm64';
|
|
21
|
+
var rosettaArm = cp.execSync('sysctl -in sysctl.proc_translated', { encoding: 'utf8' }) === '1\n';
|
|
22
|
+
|
|
23
|
+
return nativeArm || rosettaArm ? 'arm64' : 'x64';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* On Windows, the most reliable way to detect a 64-bit OS from within a 32-bit
|
|
28
|
+
* app is based on the presence of a WOW64 file: %SystemRoot%\SysNative.
|
|
29
|
+
* See: https://twitter.com/feross/status/776949077208510464
|
|
30
|
+
*/
|
|
31
|
+
if (process.platform === 'win32') {
|
|
32
|
+
var useEnv = false;
|
|
33
|
+
try {
|
|
34
|
+
useEnv = !!(process.env.SYSTEMROOT && fs.statSync(process.env.SYSTEMROOT));
|
|
35
|
+
} catch (err) {}
|
|
36
|
+
|
|
37
|
+
var sysRoot = useEnv ? process.env.SYSTEMROOT : 'C:\\Windows';
|
|
38
|
+
|
|
39
|
+
// If %SystemRoot%\SysNative exists, we are in a WOW64 FS Redirected application.
|
|
40
|
+
var isWOW64 = false;
|
|
41
|
+
try {
|
|
42
|
+
isWOW64 = !!fs.statSync(path.join(sysRoot, 'sysnative'));
|
|
43
|
+
} catch (err) {}
|
|
44
|
+
|
|
45
|
+
return isWOW64 ? 'x64' : 'x86';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* On Linux, use the `getconf` command to get the architecture.
|
|
50
|
+
*/
|
|
4
51
|
if (process.platform === 'linux') {
|
|
5
52
|
try {
|
|
6
|
-
var
|
|
7
|
-
if (~
|
|
53
|
+
var output1 = cp.execSync('uname -a', { encoding: 'utf8' });
|
|
54
|
+
if (~output1.indexOf('raspberrypi')) return 'arm-pi';
|
|
8
55
|
} catch (err) {}
|
|
56
|
+
|
|
57
|
+
var output = cp.execSync('getconf LONG_BIT', { encoding: 'utf8' });
|
|
58
|
+
return output === '64\n' ? 'x64' : 'x86';
|
|
9
59
|
}
|
|
10
60
|
|
|
11
|
-
|
|
12
|
-
|
|
61
|
+
/**
|
|
62
|
+
* The running binary is 64-bit, so the OS is clearly 64-bit.
|
|
63
|
+
*/
|
|
64
|
+
if (process.arch === 'x64') {
|
|
65
|
+
return 'x64';
|
|
66
|
+
}
|
|
13
67
|
|
|
14
|
-
|
|
68
|
+
/**
|
|
69
|
+
* If none of the above, assume the architecture is 32-bit.
|
|
70
|
+
*/
|
|
71
|
+
return 'x86';
|
|
72
|
+
};
|
package/lib/conditionalCache.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
var path = require('path');
|
|
2
2
|
var get = require('get-remote');
|
|
3
|
-
var assign = require('just-extend');
|
|
4
3
|
var access = require('fs-access-compat');
|
|
5
4
|
|
|
6
5
|
var progress = require('./progress');
|
|
@@ -20,7 +19,7 @@ module.exports = function conditionalCache(endpoint, dest, options, callback) {
|
|
|
20
19
|
if (err) return callback(err);
|
|
21
20
|
|
|
22
21
|
// TODO: do I need assign?
|
|
23
|
-
get(endpoint, assign({ filename: path.basename(dest), progress: progress, time: 1000 }, options)).file(path.dirname(dest), function (err) {
|
|
22
|
+
get(endpoint, Object.assign({ filename: path.basename(dest), progress: progress, time: 1000 }, options)).file(path.dirname(dest), function (err) {
|
|
24
23
|
console.log('');
|
|
25
24
|
callback(err);
|
|
26
25
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
var path = require('path');
|
|
2
2
|
var extract = require('fast-extract');
|
|
3
3
|
var mkpath = require('mkpath');
|
|
4
|
-
var assign = require('just-extend');
|
|
5
4
|
var access = require('fs-access-compat');
|
|
6
5
|
|
|
7
6
|
var progress = require('./progress');
|
|
@@ -24,7 +23,7 @@ module.exports = function conditionalExtract(src, dest, options, callback) {
|
|
|
24
23
|
if (!err) return callback(); // already exists
|
|
25
24
|
|
|
26
25
|
mkpath(path.dirname(dest), function () {
|
|
27
|
-
var extractOptions = assign({ strip: 1, progress: progress, time: 1000 }, options);
|
|
26
|
+
var extractOptions = Object.assign({ strip: 1, progress: progress, time: 1000 }, options);
|
|
28
27
|
|
|
29
28
|
// TODO: yauzl does not read the master record properly on Node 0.8
|
|
30
29
|
if (major === 0 && minor <= 8 && path.extname(src) === '.zip') {
|
package/lib/index.js
CHANGED
package/lib/install.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var path = require('path');
|
|
2
2
|
var Queue = require('queue-cb');
|
|
3
3
|
var mkpath = require('mkpath');
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
var resolveVersions = require('node-resolve-versions');
|
|
6
6
|
|
|
7
7
|
var installVersion = require('./installVersion');
|
|
@@ -16,7 +16,7 @@ var DEFAULT_OPTIONS = {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
module.exports = function install(versionDetails, dest, options, callback) {
|
|
19
|
-
options = assign({}, DEFAULT_OPTIONS, options, { path: 'raw' });
|
|
19
|
+
options = Object.assign({}, DEFAULT_OPTIONS, options, { path: 'raw' });
|
|
20
20
|
resolveVersions(versionDetails, options, function (err, versions) {
|
|
21
21
|
if (err) return callback(err);
|
|
22
22
|
if (!versions.length) return callback(new Error('Could not resolve versions for: ' + JSON.stringify(versionDetails)));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var osArch = require('os').arch || require('../arch');
|
|
2
2
|
|
|
3
3
|
var PLATFORM_OS = {
|
|
4
4
|
win32: 'win',
|
|
@@ -13,14 +13,19 @@ var PLATFORM_FILES = {
|
|
|
13
13
|
module.exports = function prebuiltFilenames(options) {
|
|
14
14
|
var platform = options.platform || process.platform;
|
|
15
15
|
var os = PLATFORM_OS[platform] || platform;
|
|
16
|
-
var
|
|
16
|
+
var archs = [options.arch || osArch()];
|
|
17
|
+
if (platform === 'darwin' && archs[0] === 'arm64') archs.push('x64'); // fallback
|
|
17
18
|
|
|
18
19
|
var files = PLATFORM_FILES[platform];
|
|
19
|
-
if (typeof files === 'undefined') return [os + '-' + arch];
|
|
20
|
-
|
|
21
20
|
var results = [];
|
|
22
|
-
for (var
|
|
23
|
-
|
|
21
|
+
for (var i = 0; i < archs.length; i++) {
|
|
22
|
+
if (typeof files === 'undefined') {
|
|
23
|
+
results.push(os + '-' + archs[i]);
|
|
24
|
+
} else {
|
|
25
|
+
for (var j = 0; j < files.length; j++) {
|
|
26
|
+
results.push(os + '-' + archs[i] + '-' + files[j]);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
24
29
|
}
|
|
25
30
|
return results;
|
|
26
31
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var path = require('path');
|
|
2
|
-
var assign = require('just-extend');
|
|
3
2
|
|
|
4
3
|
var conditionalCache = require('../conditionalCache');
|
|
5
4
|
var conditionalExtract = require('../conditionalExtract');
|
|
@@ -11,7 +10,7 @@ module.exports = function installCompressed(relativePath, dest, record, options,
|
|
|
11
10
|
|
|
12
11
|
conditionalCache(downloadPath, cachePath, function (err) {
|
|
13
12
|
if (err) return callback(err);
|
|
14
|
-
conditionalExtract(cachePath, dest, assign({ strip: 1, progress: progress, time: 1000 }, options), function (err) {
|
|
13
|
+
conditionalExtract(cachePath, dest, Object.assign({ strip: 1, progress: progress, time: 1000 }, options), function (err) {
|
|
15
14
|
console.log('');
|
|
16
15
|
callback(err);
|
|
17
16
|
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require('core-js/actual/object/assign');
|
|
2
|
+
require('core-js/actual/promise');
|
|
3
|
+
|
|
4
|
+
var cp = require('child_process');
|
|
5
|
+
if (!cp.execSync) {
|
|
6
|
+
var execCallback = __dirname + '/execCallback.js'; // eslint-disable-line n/no-path-concat
|
|
7
|
+
|
|
8
|
+
var functionExec = null; // break dependencies
|
|
9
|
+
cp.execSync = function execSyncPolyfill(cmd, options) {
|
|
10
|
+
if (!functionExec) functionExec = require('function-exec-sync');
|
|
11
|
+
|
|
12
|
+
return functionExec({ callbacks: true }, execCallback, cmd, options || {});
|
|
13
|
+
};
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-install-release",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"description": "Cross-platform solution for installing releases of Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -32,23 +32,23 @@
|
|
|
32
32
|
"test:engines": "nvu engines npm test"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"
|
|
36
|
-
"cross-spawn-cb": "^0.6.
|
|
35
|
+
"core-js": "^3.24.1",
|
|
36
|
+
"cross-spawn-cb": "^0.6.9",
|
|
37
37
|
"end-with": "^1.0.2",
|
|
38
38
|
"exit": "^0.1.2",
|
|
39
39
|
"fast-extract": "^0.3.4",
|
|
40
40
|
"fs-access-compat": "^1.0.3",
|
|
41
|
-
"
|
|
41
|
+
"function-exec-sync": "^0.2.5",
|
|
42
|
+
"get-remote": "^0.7.6",
|
|
42
43
|
"getopts-compat": "^2.2.5",
|
|
43
44
|
"isarray": "^2.0.5",
|
|
44
|
-
"just-extend": "^6.0.1",
|
|
45
45
|
"lodash.find": "^4.6.0",
|
|
46
46
|
"lodash.keys": "^4.2.0",
|
|
47
47
|
"match-semver": "^0.1.1",
|
|
48
48
|
"mkpath": "^1.0.0",
|
|
49
|
-
"node-filename-to-dist-paths": "^0.1.
|
|
50
|
-
"node-resolve-versions": "^0.3.
|
|
51
|
-
"node-version-call": "^0.3.
|
|
49
|
+
"node-filename-to-dist-paths": "^0.1.14",
|
|
50
|
+
"node-resolve-versions": "^0.3.3",
|
|
51
|
+
"node-version-call": "^0.3.5",
|
|
52
52
|
"osenv": "^0.1.5",
|
|
53
53
|
"pump": "^3.0.0",
|
|
54
54
|
"queue-cb": "^1.1.7",
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"single-line-log2": "^1.1.3"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@typescript-eslint/parser": "^5.
|
|
59
|
+
"@typescript-eslint/parser": "^5.32.0",
|
|
60
60
|
"cr": "^0.1.0",
|
|
61
61
|
"depcheck": "^1.4.3",
|
|
62
|
-
"eslint": "^8.
|
|
62
|
+
"eslint": "^8.21.0",
|
|
63
63
|
"eslint-config-prettier": "^8.5.0",
|
|
64
64
|
"eslint-config-standard": "^17.0.0",
|
|
65
65
|
"eslint-plugin-import": "^2.26.0",
|