node-version-use 1.5.31 → 1.5.33

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/dist/cjs/cli.cjs CHANGED
@@ -45,11 +45,13 @@ var _default = function(argv, name) {
45
45
  console.log("Missing command. Example usage: ".concat(name, " [version expression] [command]"));
46
46
  return (0, _exit.default)(ERROR_CODE);
47
47
  }
48
- var next = function(err, results) {
49
- if (err) {
48
+ options.stdio = 'inherit'; // pass through stdio
49
+ return (0, _index.default)(args[0], args[1], args.slice(2), options, function(err, results) {
50
+ if (err && !err.results) {
50
51
  console.log(err.message);
51
52
  return (0, _exit.default)(ERROR_CODE);
52
53
  }
54
+ if (err) results = err.results;
53
55
  var errors = results.filter(function(result) {
54
56
  return !!result.error;
55
57
  });
@@ -66,22 +68,6 @@ var _default = function(argv, name) {
66
68
  if (errors.length) console.log("".concat(figures.cross, " ").concat(errors.length, " failed"));
67
69
  }
68
70
  (0, _exit.default)(err || errors.length ? ERROR_CODE : 0);
69
- };
70
- // DEBUG MODE
71
- if (typeof process.env.DEBUG !== 'undefined') {
72
- options.encoding = 'utf8';
73
- return (0, _index.default)(args[0], args[1], args.slice(2), options, function(err, results) {
74
- if (err) console.log(JSON.stringify({
75
- err: err
76
- }));
77
- (results || err.results || []).forEach(function(param) {
78
- var error = param.error, result = param.result;
79
- return console.log((error || result).stdout);
80
- });
81
- next(err, results);
82
- });
83
- }
84
- options.stdio = 'inherit'; // pass through stdio
85
- return (0, _index.default)(args[0], args[1], args.slice(2), options, next);
71
+ });
86
72
  };
87
73
  /* 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-version-use/src/cli.js"],"sourcesContent":["import exit from 'exit';\nimport getopts from 'getopts-compat';\nimport run from './index.mjs';\n\nconst figures = {\n tick: '✔',\n cross: '✘',\n};\nconst ERROR_CODE = 13;\n\nexport default (argv, name) => {\n const options = getopts(argv.slice(1), {\n alias: { range: 'r', desc: 'd', silent: 's' },\n default: { range: 'major,even' },\n boolean: ['silent', 'desc'],\n stopEarly: true,\n });\n\n // define.option('-r, --range [range]', 'range type of major, minor, or patch with filters of lts, even, odd for version string expressions', 'major,even');\n // define.option('-s, --silent', 'suppress logging', false);\n options.sort = options.desc ? -1 : 1;\n\n const args = argv.slice(0, 1).concat(options._);\n if (args.length < 1) {\n console.log(`Missing command. Example usage: ${name} [version expression] [command]`);\n return exit(ERROR_CODE);\n }\n\n const next = (err, results) => {\n if (err) {\n console.log(err.message);\n return exit(ERROR_CODE);\n }\n const errors = results.filter((result) => !!result.error);\n\n if (!options.silent) {\n console.log('\\n======================');\n results.forEach((res) => console.log(`${res.error ? figures.cross : figures.tick} ${res.version}${res.error ? ` Error: ${res.error.message}` : ''}`));\n console.log('\\n----------------------');\n console.log(`${name} ${args.map((x) => (x.indexOf(' ') >= 0 ? `\"${x}\"` : x)).join(' ')}`);\n console.log(`${figures.tick} ${results.length - errors.length} succeeded`);\n if (errors.length) console.log(`${figures.cross} ${errors.length} failed`);\n }\n exit(err || errors.length ? ERROR_CODE : 0);\n };\n\n // DEBUG MODE\n if (typeof process.env.DEBUG !== 'undefined') {\n options.encoding = 'utf8';\n return run(args[0], args[1], args.slice(2), options, (err, results) => {\n if (err) console.log(JSON.stringify({ err }));\n (results || err.results || []).forEach(({ error, result }) => console.log((error || result).stdout));\n next(err, results);\n });\n }\n\n options.stdio = 'inherit'; // pass through stdio\n return run(args[0], args[1], args.slice(2), options, next);\n};\n"],"names":["figures","tick","cross","ERROR_CODE","argv","name","options","getopts","slice","alias","range","desc","silent","default","boolean","stopEarly","sort","args","concat","_","length","console","log","exit","next","err","results","message","errors","filter","result","error","forEach","res","version","map","x","indexOf","join","process","env","DEBUG","encoding","run","JSON","stringify","stdout","stdio"],"mappings":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in/Dev/OpenSource/node-version/node-version-use/src/cli.js"],"sourcesContent":["import exit from 'exit';\nimport getopts from 'getopts-compat';\nimport run from './index.mjs';\n\nconst figures = {\n tick: '✔',\n cross: '✘',\n};\nconst ERROR_CODE = 13;\n\nexport default (argv, name) => {\n const options = getopts(argv.slice(1), {\n alias: { range: 'r', desc: 'd', silent: 's' },\n default: { range: 'major,even' },\n boolean: ['silent', 'desc'],\n stopEarly: true,\n });\n\n // define.option('-r, --range [range]', 'range type of major, minor, or patch with filters of lts, even, odd for version string expressions', 'major,even');\n // define.option('-s, --silent', 'suppress logging', false);\n options.sort = options.desc ? -1 : 1;\n\n const args = argv.slice(0, 1).concat(options._);\n if (args.length < 1) {\n console.log(`Missing command. Example usage: ${name} [version expression] [command]`);\n return exit(ERROR_CODE);\n }\n\n options.stdio = 'inherit'; // pass through stdio\n return run(args[0], args[1], args.slice(2), options, (err, results) => {\n if (err && !err.results) {\n console.log(err.message);\n return exit(ERROR_CODE);\n }\n if (err) results = err.results;\n const errors = results.filter((result) => !!result.error);\n\n if (!options.silent) {\n console.log('\\n======================');\n results.forEach((res) => console.log(`${res.error ? figures.cross : figures.tick} ${res.version}${res.error ? ` Error: ${res.error.message}` : ''}`));\n console.log('\\n----------------------');\n console.log(`${name} ${args.map((x) => (x.indexOf(' ') >= 0 ? `\"${x}\"` : x)).join(' ')}`);\n console.log(`${figures.tick} ${results.length - errors.length} succeeded`);\n if (errors.length) console.log(`${figures.cross} ${errors.length} failed`);\n }\n exit(err || errors.length ? ERROR_CODE : 0);\n });\n};\n"],"names":["figures","tick","cross","ERROR_CODE","argv","name","options","getopts","slice","alias","range","desc","silent","default","boolean","stopEarly","sort","args","concat","_","length","console","log","exit","stdio","run","err","results","message","errors","filter","result","error","forEach","res","version","map","x","indexOf","join"],"mappings":";;;;+BAUA;;;eAAA;;;2DAViB;oEACG;4DACJ;;;;;;AAEhB,IAAMA,UAAU;IACdC,MAAM;IACNC,OAAO;AACT;AACA,IAAMC,aAAa;I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C,WAA4B,OAAlBE,IAAIF,KAAK,CAACJ,OAAO,IAAK;;YAC/IP,QAAQC,GAAG,CAAC;YACZD,QAAQC,GAAG,CAAC,AAAC,GAAUL,OAARZ,MAAK,KAAmE,OAAhEY,KAAKmB,GAAG,CAAC,SAACC;uBAAOA,EAAEC,OAAO,CAAC,QAAQ,IAAI,AAAC,IAAK,OAAFD,GAAE,OAAKA;eAAIE,IAAI,CAAC;YAClFlB,QAAQC,GAAG,CAAC,AAAC,GAAkBK,OAAhB3B,QAAQC,IAAI,EAAC,KAAkC,OAA/B0B,QAAQP,MAAM,GAAGS,OAAOT,MAAM,EAAC;YAC9D,IAAIS,OAAOT,MAAM,EAAEC,QAAQC,GAAG,CAAC,AAAC,GAAmBO,OAAjB7B,QAAQE,KAAK,EAAC,KAAiB,OAAd2B,OAAOT,MAAM,EAAC;QACnE;QACAG,IAAAA,aAAI,EAACG,OAAOG,OAAOT,MAAM,GAAGjB,aAAa;IAC3C;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-version-use",
3
- "version": "1.5.31",
3
+ "version": "1.5.33",
4
4
  "description": "Cross-platform solution for using multiple versions of node. Useful for compatibility testing",
5
5
  "keywords": [
6
6
  "node",