node-install-release 0.2.8 → 0.3.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.
@@ -0,0 +1,5 @@
1
+ var extract = require('fast-extract');
2
+
3
+ module.exports = function callExtract(src, dest, options, callback) {
4
+ extract(src, dest, options, callback);
5
+ };
@@ -6,6 +6,11 @@ var access = require('fs-access-compat');
6
6
 
7
7
  var progress = require('./progress');
8
8
 
9
+ var major = +process.versions.node.split('.')[0];
10
+ var minor = +process.versions.node.split('.')[1];
11
+ var call = require('node-version-call');
12
+ var callExtract = __dirname + '/callExtract.js'; // eslint-disable-line n/no-path-concat
13
+
9
14
  module.exports = function conditionalExtract(src, dest, options, callback) {
10
15
  if (typeof options === 'function') {
11
16
  callback = options;
@@ -17,10 +22,24 @@ module.exports = function conditionalExtract(src, dest, options, callback) {
17
22
  if (!err) return callback(); // already exists
18
23
 
19
24
  mkpath(path.dirname(dest), function () {
20
- extract(src, dest, assign({ strip: 1, progress: progress, time: 1000 }, options), function (err) {
21
- console.log('');
22
- callback(err);
23
- });
25
+ var extractOptions = assign({ strip: 1, progress: progress, time: 1000 }, options);
26
+
27
+ // TODO: yauzl does not read the master record properly on Node 0.8
28
+ if (major === 0 && minor <= 8 && path.extname(src) === '.zip') {
29
+ try {
30
+ delete extractOptions.progress;
31
+ call({ version: 'lts', callbacks: true }, callExtract, src, dest, extractOptions);
32
+ console.log('');
33
+ callback();
34
+ } catch (err) {
35
+ callback(err);
36
+ }
37
+ } else {
38
+ extract(src, dest, extractOptions, function (err) {
39
+ console.log('');
40
+ callback(err);
41
+ });
42
+ }
24
43
  });
25
44
  });
26
45
  };
@@ -15,11 +15,11 @@ module.exports = function installLib(version, dest, options, callback) {
15
15
  var libPath = platform === 'win32' ? dest : path.join(dest, 'lib');
16
16
  var installPath = path.join(libPath, 'node_modules', 'npm');
17
17
 
18
- var npmVersion = maximumVersion ? '@' + maximumVersion : '';
19
-
20
- get('https://cdn.jsdelivr.net/npm/npm' + npmVersion + '/package.json').json(function (err, res) {
18
+ get(DIST_URL).json(function (err, res) {
21
19
  if (err) return callback(err);
22
- var downloadPath = DIST_URL + '/-/npm-' + res.body.version + '.tgz';
20
+
21
+ var installVersion = res.body['dist-tags'][maximumVersion ? 'latest-' + maximumVersion : 'latest'];
22
+ var downloadPath = DIST_URL + '/-/npm-' + installVersion + '.tgz';
23
23
  var cachePath = path.join(options.cacheDirectory, path.basename(downloadPath));
24
24
  conditionalCache(downloadPath, cachePath, function (err) {
25
25
  if (err) return callback(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-install-release",
3
- "version": "0.2.8",
3
+ "version": "0.3.0",
4
4
  "description": "Cross-platform solution for installing releases of Node.js",
5
5
  "keywords": [
6
6
  "node",
@@ -26,17 +26,17 @@
26
26
  "scripts": {
27
27
  "format": "prettier --write .",
28
28
  "lint": "eslint .",
29
- "prepublishOnly": "dtd \"npm run lint\" \"depcheck\"",
29
+ "prepublishOnly": "npm run lint && depcheck",
30
30
  "test": "mocha-compat test/spec/**/*.test.js --no-timeouts"
31
31
  },
32
32
  "dependencies": {
33
33
  "arch": "^2.2.0",
34
- "cross-spawn-cb": "^0.5.12",
34
+ "cross-spawn-cb": "^0.6.3",
35
35
  "end-with": "^1.0.2",
36
36
  "exit": "^0.1.2",
37
37
  "fast-extract": "^0.3.3",
38
38
  "fs-access-compat": "^1.0.2",
39
- "get-remote": "^0.6.3",
39
+ "get-remote": "^0.7.1",
40
40
  "getopts-compat": "^2.2.5",
41
41
  "isarray": "^2.0.5",
42
42
  "just-extend": "^6.0.1",
@@ -44,8 +44,9 @@
44
44
  "lodash.keys": "^4.2.0",
45
45
  "match-semver": "^0.1.0",
46
46
  "mkpath": "^1.0.0",
47
- "node-filename-to-dist-paths": "^0.1.9",
47
+ "node-filename-to-dist-paths": "^0.1.10",
48
48
  "node-resolve-versions": "^0.2.5",
49
+ "node-version-call": "^0.2.3",
49
50
  "osenv": "^0.1.5",
50
51
  "pump": "^3.0.0",
51
52
  "queue-cb": "^1.1.6",
@@ -53,11 +54,10 @@
53
54
  "single-line-log2": "^1.1.3"
54
55
  },
55
56
  "devDependencies": {
56
- "@typescript-eslint/parser": "^5.30.5",
57
+ "@typescript-eslint/parser": "^5.30.7",
57
58
  "cr": "^0.1.0",
58
59
  "depcheck": "^1.4.3",
59
- "dis-dat": "^0.1.7",
60
- "eslint": "^8.19.0",
60
+ "eslint": "^8.20.0",
61
61
  "eslint-config-prettier": "^8.5.0",
62
62
  "eslint-config-standard": "^17.0.0",
63
63
  "eslint-plugin-import": "^2.26.0",
@@ -65,10 +65,10 @@
65
65
  "fs-access-sync-compat": "^1.0.1",
66
66
  "is-version": "^0.2.0",
67
67
  "mocha-compat": "^3.5.5",
68
- "node-version-utils": "^0.4.1",
68
+ "node-version-utils": "^0.4.4",
69
69
  "prettier": "^2.7.1"
70
70
  },
71
71
  "engines": {
72
- "node": ">=0.10"
72
+ "node": ">=0.8"
73
73
  }
74
74
  }