node-version-use 0.2.3 → 0.2.6

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,7 @@
1
+ var path = require('path');
2
+ var home = require('osenv').home();
3
+
4
+ module.exports = {
5
+ cacheDirectory: path.join(home, '.nvu', 'cache'),
6
+ installDirectory: path.join(home, '.nvu', 'installed'),
7
+ };
@@ -1,4 +1,5 @@
1
- var use = require('./lib/use');
1
+ var use = require('./use');
2
+ var constants = require('./constants')
2
3
 
3
4
  module.exports = function nodeVersionUse(versionExpression, command, args, options, callback) {
4
5
  if (typeof options === 'function') {
@@ -12,3 +13,11 @@ module.exports = function nodeVersionUse(versionExpression, command, args, optio
12
13
  });
13
14
  });
14
15
  };
16
+
17
+ module.exports.installDirectory = function installDirectory() {
18
+ return constants.installDirectory;
19
+ }
20
+
21
+ module.exports.cacheDirectory = function cacheDirectory(options) {
22
+ return constants.cacheDirectory;
23
+ }
package/lib/use.js CHANGED
@@ -5,11 +5,7 @@ var installRelease = require('node-install-release');
5
5
  var versionUtils = require('node-version-utils');
6
6
  var resolveVersions = require('node-resolve-versions');
7
7
 
8
- var HOME = require('osenv').home();
9
- var DEFAULT_OPTIONS = {
10
- cacheDirectory: path.join(HOME, '.nvu', 'cache'),
11
- installedDirectory: path.join(HOME, '.nvu', 'installed'),
12
- };
8
+ var constants = require('./constants')
13
9
 
14
10
  module.exports = function use(versionExpression, command, args, options, callback) {
15
11
  resolveVersions(versionExpression, assign({}, options, { path: 'raw' }), function (err, versions) {
@@ -26,9 +22,9 @@ module.exports = function use(versionExpression, command, args, options, callbac
26
22
  queue.defer(function (callback) {
27
23
  !options.header || options.header(version.version, command, args);
28
24
 
29
- var installedDirectory = options.installedDirectory || DEFAULT_OPTIONS.installedDirectory;
30
- var cacheDirectory = options.cacheDirectory || DEFAULT_OPTIONS.cacheDirectory;
31
- var installPath = path.join(installedDirectory, version.version);
25
+ var installDirectory = options.installDirectory || constants.installDirectory;
26
+ var cacheDirectory = options.cacheDirectory || constants.cacheDirectory;
27
+ var installPath = path.join(installDirectory, version.version);
32
28
 
33
29
  installRelease(version, installPath, { cacheDirectory: cacheDirectory }, function (err) {
34
30
  if (err) return callback(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-version-use",
3
- "version": "0.2.3",
3
+ "version": "0.2.6",
4
4
  "description": "Cross-platform solution for using multiple versions of node. Useful for compatibility testing",
5
5
  "keywords": [
6
6
  "node",
@@ -17,7 +17,10 @@
17
17
  "url": "git@github.com:kmalakoff/node-version-use.git"
18
18
  },
19
19
  "license": "MIT",
20
- "main": "index.js",
20
+ "main": "lib/index.js",
21
+ "files": [
22
+ "lib"
23
+ ],
21
24
  "bin": {
22
25
  "nvu": "./bin/node-version-use.js"
23
26
  },
@@ -29,28 +32,26 @@
29
32
  "test": "mocha-compat test/spec/**/*.test.js --no-timeouts"
30
33
  },
31
34
  "dependencies": {
32
- "cross-spawn-cb": "^0.5.2",
35
+ "cross-spawn-cb": "^0.5.12",
33
36
  "exit": "^0.1.2",
34
37
  "getopts-compat": "^2.2.5",
35
- "node-install-release": "^0.2.4",
36
- "node-resolve-versions": "^0.2.2",
37
- "node-version-utils": "^0.3.1",
38
38
  "just-extend": "^6.0.1",
39
+ "node-install-release": "^0.2.8",
40
+ "node-resolve-versions": "^0.2.5",
41
+ "node-version-utils": "^0.4.2",
39
42
  "osenv": "^0.1.5",
40
43
  "queue-cb": "^1.1.6"
41
44
  },
42
45
  "devDependencies": {
43
- "@typescript-eslint/parser": "^5.30.0",
46
+ "@typescript-eslint/parser": "^5.30.5",
44
47
  "cr": "^0.1.0",
45
48
  "depcheck": "^1.4.3",
46
- "dis-dat": "^0.1.5",
47
- "eslint": "^6.8.0",
48
- "eslint-config-prettier": "^6.11.0",
49
- "eslint-config-standard": "^14.1.1",
50
- "eslint-plugin-import": "^2.22.0",
51
- "eslint-plugin-node": "^11.1.0",
52
- "eslint-plugin-promise": "^4.2.1",
53
- "eslint-plugin-standard": "^4.0.1",
49
+ "dis-dat": "^0.1.7",
50
+ "eslint": "^8.19.0",
51
+ "eslint-config-prettier": "^8.5.0",
52
+ "eslint-config-standard": "^17.0.0",
53
+ "eslint-plugin-import": "^2.26.0",
54
+ "eslint-plugin-promise": "^6.0.0",
54
55
  "is-version": "^0.2.0",
55
56
  "mocha-compat": "^3.5.5",
56
57
  "prettier": "^2.7.1",