node-install-release 0.4.1 → 0.4.4
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.
|
@@ -1,29 +1,39 @@
|
|
|
1
1
|
var path = require('path');
|
|
2
|
-
var match = require('match-semver');
|
|
3
|
-
var find = require('lodash.find');
|
|
4
2
|
var get = require('get-remote');
|
|
5
3
|
|
|
6
4
|
var conditionalCache = require('../conditionalCache');
|
|
7
5
|
var conditionalExtract = require('../conditionalExtract');
|
|
8
|
-
var npmVersions = require('./npmVersions');
|
|
9
6
|
|
|
10
|
-
var
|
|
7
|
+
var NODE_DIST_URL = 'https://nodejs.org/dist/index.json';
|
|
8
|
+
var NPM_DIST_URL = 'https://registry.npmjs.org/npm';
|
|
9
|
+
var NPM_MIN_VERSION = '1.0.0';
|
|
11
10
|
|
|
12
11
|
module.exports = function installLib(version, dest, options, callback) {
|
|
13
12
|
var platform = options.platform || process.platform;
|
|
14
|
-
var maximumVersion = find(npmVersions, match.bind(null, version.version)).maximum;
|
|
15
13
|
var libPath = platform === 'win32' ? dest : path.join(dest, 'lib');
|
|
16
14
|
var installPath = path.join(libPath, 'node_modules', 'npm');
|
|
17
15
|
|
|
18
|
-
get(
|
|
16
|
+
get(NODE_DIST_URL).json(function (err, res1) {
|
|
19
17
|
if (err) return callback(err);
|
|
18
|
+
var releases = res1.body;
|
|
20
19
|
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
var found = releases.find(function (record) {
|
|
21
|
+
return record.version === version.version;
|
|
22
|
+
});
|
|
23
|
+
var npm = (found ? found.npm : null) || NPM_MIN_VERSION;
|
|
24
|
+
var maximumVersion = +npm.split('.')[0];
|
|
25
|
+
|
|
26
|
+
get(NPM_DIST_URL).json(function (err, res2) {
|
|
25
27
|
if (err) return callback(err);
|
|
26
|
-
|
|
28
|
+
var distTags = res2.body['dist-tags'];
|
|
29
|
+
|
|
30
|
+
var installVersion = distTags['latest-' + maximumVersion] || distTags.latest;
|
|
31
|
+
var downloadPath = NPM_DIST_URL + '/-/npm-' + installVersion + '.tgz';
|
|
32
|
+
var cachePath = path.join(options.cacheDirectory, path.basename(downloadPath));
|
|
33
|
+
conditionalCache(downloadPath, cachePath, function (err) {
|
|
34
|
+
if (err) return callback(err);
|
|
35
|
+
conditionalExtract(cachePath, installPath, callback);
|
|
36
|
+
});
|
|
27
37
|
});
|
|
28
38
|
});
|
|
29
39
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
var path = require('path');
|
|
2
|
+
var access = require('fs-access-compat');
|
|
3
|
+
var rimraf = require('rimraf');
|
|
2
4
|
|
|
3
5
|
var conditionalCache = require('../conditionalCache');
|
|
4
6
|
var conditionalExtract = require('../conditionalExtract');
|
|
@@ -10,9 +12,20 @@ module.exports = function installCompressed(relativePath, dest, record, options,
|
|
|
10
12
|
|
|
11
13
|
conditionalCache(downloadPath, cachePath, function (err) {
|
|
12
14
|
if (err) return callback(err);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
access(dest, function (err) {
|
|
16
|
+
if (!err) return callback(); // already exists
|
|
17
|
+
conditionalExtract(cachePath, dest, Object.assign({ strip: 1, progress: progress, time: 1000 }, options), function (err) {
|
|
18
|
+
console.log('');
|
|
19
|
+
if (err) return callback(err);
|
|
20
|
+
|
|
21
|
+
// some compressed versions of node come with npm pre-installed, but we want to override with a specific version
|
|
22
|
+
var platform = options.platform || process.platform;
|
|
23
|
+
var libPath = platform === 'win32' ? dest : path.join(dest, 'lib');
|
|
24
|
+
var installPath = path.join(libPath, 'node_modules', 'npm');
|
|
25
|
+
rimraf(installPath, function () {
|
|
26
|
+
callback(err);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
16
29
|
});
|
|
17
30
|
});
|
|
18
31
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var path = require('path');
|
|
2
|
+
var access = require('fs-access-compat');
|
|
2
3
|
|
|
3
4
|
var conditionalCache = require('../conditionalCache');
|
|
4
5
|
var copyFile = require('../copyFile');
|
|
5
|
-
var access = require('fs-access-compat');
|
|
6
6
|
|
|
7
7
|
module.exports = function installExe(relativePath, dest, record, options, callback) {
|
|
8
8
|
var downloadPath = options.downloadURL(relativePath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-install-release",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Cross-platform solution for installing releases of Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
"isarray": "^2.0.5",
|
|
45
45
|
"lodash.find": "^4.6.0",
|
|
46
46
|
"lodash.keys": "^4.2.0",
|
|
47
|
-
"match-semver": "^0.1.1",
|
|
48
47
|
"mkpath": "^1.0.0",
|
|
49
48
|
"node-filename-to-dist-paths": "^0.2.1",
|
|
50
49
|
"node-resolve-versions": "^0.3.9",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
module.exports = [
|
|
2
|
-
{ gte: '10.0.0', bundled: '6.14.4' },
|
|
3
|
-
{ gte: '8.0.0', lt: '10.0.0', bundled: '6.13.4' },
|
|
4
|
-
{ gte: '6.0.0', lt: '8.0.0', bundled: '3.10.10' },
|
|
5
|
-
{ gte: '4.0.0', lt: '6.0.0', bundled: '2.15.11', maximum: 5 },
|
|
6
|
-
{ gte: '0.12.0', lt: '4.0.0', bundled: '2.15.11', maximum: 3 },
|
|
7
|
-
{ lt: '0.12.0', bundled: '1.2.30', maximum: 3 },
|
|
8
|
-
];
|