node-version-install 0.1.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.
- package/LICENSE +21 -0
- package/README.md +28 -0
- package/dist/cjs/constants.js +21 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/index.js +71 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/installPaths.js +24 -0
- package/dist/cjs/installPaths.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/types.js +5 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/worker.js +96 -0
- package/dist/cjs/worker.js.map +1 -0
- package/dist/esm/constants.mjs +2 -0
- package/dist/esm/constants.mjs.map +1 -0
- package/dist/esm/index.mjs +32 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/installPaths.mjs +8 -0
- package/dist/esm/installPaths.mjs.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/types.mjs +1 -0
- package/dist/esm/types.mjs.map +1 -0
- package/dist/esm/worker.mjs +52 -0
- package/dist/esm/worker.mjs.map +1 -0
- package/dist/types/constants.d.ts +2 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/installPaths.d.ts +2 -0
- package/dist/types/types.d.ts +15 -0
- package/dist/types/worker.d.ts +2 -0
- package/package.json +75 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Kevin Malakoff
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
## node-version-install
|
|
2
|
+
|
|
3
|
+
Install NodeJs by version string asynchronously or synchronously.
|
|
4
|
+
|
|
5
|
+
### Example 1: Asynchronous Install
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import install from "node-version-install";
|
|
9
|
+
|
|
10
|
+
const result = await install("12", "/path/for/install");
|
|
11
|
+
console.log(result); // { version: "12.3.4", execPath, installPath }
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Example 2: Synchronous Install
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
|
|
18
|
+
import install from "node-version-install";
|
|
19
|
+
|
|
20
|
+
const call = require("node-version-install");
|
|
21
|
+
|
|
22
|
+
const result = install("14,stable", "/path/for/install");
|
|
23
|
+
console.log(result); // [{ version: "14.4.5", execPath, installPath }, { version: "22.2.1", execPath, installPath }]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Documentation
|
|
27
|
+
|
|
28
|
+
[API Docs](https://kmalakoff.github.io/node-version-install/)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
NODE: function() {
|
|
13
|
+
return NODE;
|
|
14
|
+
},
|
|
15
|
+
isWindows: function() {
|
|
16
|
+
return isWindows;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);
|
|
20
|
+
var NODE = isWindows ? 'node.exe' : 'node';
|
|
21
|
+
/* 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; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/constants.ts"],"sourcesContent":["export const isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nexport const NODE = isWindows ? 'node.exe' : 'node';\n"],"names":["NODE","isWindows","process","platform","test","env","OSTYPE"],"mappings":";;;;;;;;;;;IACaA,IAAI;eAAJA;;IADAC,SAAS;eAATA;;;AAAN,IAAMA,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAC3F,IAAMN,OAAOC,YAAY,aAAa"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
default: function() {
|
|
13
|
+
return install;
|
|
14
|
+
},
|
|
15
|
+
sync: function() {
|
|
16
|
+
return sync;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
20
|
+
var _url = /*#__PURE__*/ _interop_require_default(require("url"));
|
|
21
|
+
var _modulerootsync = /*#__PURE__*/ _interop_require_default(require("module-root-sync"));
|
|
22
|
+
var _worker = /*#__PURE__*/ _interop_require_default(require("./worker.js"));
|
|
23
|
+
_export_star(require("./types.js"), exports);
|
|
24
|
+
var _module = /*#__PURE__*/ _interop_require_default(require("module"));
|
|
25
|
+
var _lazycache = /*#__PURE__*/ _interop_require_default(require("lazy-cache"));
|
|
26
|
+
function _export_star(from, to) {
|
|
27
|
+
Object.keys(from).forEach(function(k) {
|
|
28
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
29
|
+
Object.defineProperty(to, k, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function() {
|
|
32
|
+
return from[k];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return from;
|
|
38
|
+
}
|
|
39
|
+
function _interop_require_default(obj) {
|
|
40
|
+
return obj && obj.__esModule ? obj : {
|
|
41
|
+
default: obj
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function install(versionExpression, options, callback) {
|
|
45
|
+
if (typeof options === 'function') {
|
|
46
|
+
callback = options;
|
|
47
|
+
options = {};
|
|
48
|
+
}
|
|
49
|
+
options = options || {};
|
|
50
|
+
if (typeof callback === 'function') return (0, _worker.default)(versionExpression, options, callback);
|
|
51
|
+
return new Promise(function(resolve, reject) {
|
|
52
|
+
return (0, _worker.default)(versionExpression, options, function(err, result) {
|
|
53
|
+
err ? reject(err) : resolve(result);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
|
|
58
|
+
var execFunction = (0, _lazycache.default)(_require)('function-exec-sync');
|
|
59
|
+
var SLEEP_MS = 200;
|
|
60
|
+
var __dirname = _path.default.dirname(typeof __filename === 'undefined' ? _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()) : __filename);
|
|
61
|
+
var root = (0, _modulerootsync.default)(__dirname);
|
|
62
|
+
var workerPath = _path.default.join(root, 'dist', 'cjs', 'worker.js');
|
|
63
|
+
function sync(versionExpression, options) {
|
|
64
|
+
options = options || {};
|
|
65
|
+
return execFunction().default({
|
|
66
|
+
cwd: process.cwd(),
|
|
67
|
+
sleep: SLEEP_MS,
|
|
68
|
+
callbacks: true
|
|
69
|
+
}, workerPath, versionExpression, options);
|
|
70
|
+
}
|
|
71
|
+
/* 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; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/index.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport moduleRoot from 'module-root-sync';\nimport worker from './worker.js';\n\nimport type { InstallCallback, InstallOptions, InstallResult } from './types.js';\n\nexport * from './types.js';\nexport default function install(versionExpression: string, options?: InstallOptions, callback?: InstallCallback): undefined | Promise<InstallResult | InstallResult[]> {\n if (typeof options === 'function') {\n callback = options as InstallCallback;\n options = {};\n }\n options = options || {};\n\n if (typeof callback === 'function') return worker(versionExpression, options, callback) as undefined;\n return new Promise((resolve, reject) =>\n worker(versionExpression, options, (err, result) => {\n err ? reject(err) : resolve(result);\n })\n );\n}\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst execFunction = lazy(_require)('function-exec-sync');\n\nconst SLEEP_MS = 200;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst root = moduleRoot(__dirname);\nconst workerPath = path.join(root, 'dist', 'cjs', 'worker.js');\n\nexport function sync(versionExpression: string, options?: InstallOptions): InstallResult | InstallResult[] {\n options = options || {};\n return execFunction().default({ cwd: process.cwd(), sleep: SLEEP_MS, callbacks: true }, workerPath, versionExpression, options);\n}\n"],"names":["install","sync","versionExpression","options","callback","worker","Promise","resolve","reject","err","result","_require","require","Module","createRequire","execFunction","lazy","SLEEP_MS","__dirname","path","dirname","__filename","url","fileURLToPath","root","moduleRoot","workerPath","join","default","cwd","process","sleep","callbacks"],"mappings":";;;;;;;;;;;IAQA,OAaC;eAbuBA;;IAyBRC,IAAI;eAAJA;;;2DAjCC;0DACD;qEACO;6DACJ;qBAIL;6DAgBK;gEACF;;;;;;;;;;;;;;;;;;;AAhBF,SAASD,QAAQE,iBAAyB,EAAEC,OAAwB,EAAEC,QAA0B;IAC7G,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IAEtB,IAAI,OAAOC,aAAa,YAAY,OAAOC,IAAAA,eAAM,EAACH,mBAAmBC,SAASC;IAC9E,OAAO,IAAIE,QAAQ,SAACC,SAASC;eAC3BH,IAAAA,eAAM,EAACH,mBAAmBC,SAAS,SAACM,KAAKC;YACvCD,MAAMD,OAAOC,OAAOF,QAAQG;QAC9B;;AAEJ;AAIA,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,eAAeC,IAAAA,kBAAI,EAACL,UAAU;AAEpC,IAAMM,WAAW;AACjB,IAAMC,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACxG,IAAMG,OAAOC,IAAAA,uBAAU,EAACP;AACxB,IAAMQ,aAAaP,aAAI,CAACQ,IAAI,CAACH,MAAM,QAAQ,OAAO;AAE3C,SAASvB,KAAKC,iBAAyB,EAAEC,OAAwB;IACtEA,UAAUA,WAAW,CAAC;IACtB,OAAOY,eAAea,OAAO,CAAC;QAAEC,KAAKC,QAAQD,GAAG;QAAIE,OAAOd;QAAUe,WAAW;IAAK,GAAGN,YAAYxB,mBAAmBC;AACzH"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return installPaths;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
12
|
+
function _interop_require_default(obj) {
|
|
13
|
+
return obj && obj.__esModule ? obj : {
|
|
14
|
+
default: obj
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function installPaths(installPath) {
|
|
18
|
+
return {
|
|
19
|
+
cachePath: _path.default.join(installPath, 'cache'),
|
|
20
|
+
buildPath: _path.default.join(installPath, 'build'),
|
|
21
|
+
installPath: _path.default.join(installPath, 'installed')
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/* 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; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/installPaths.ts"],"sourcesContent":["import path from 'path';\n\nimport type { InstallPaths } from './types.js';\n\nexport default function installPaths(installPath: string): InstallPaths {\n return {\n cachePath: path.join(installPath, 'cache'),\n buildPath: path.join(installPath, 'build'),\n installPath: path.join(installPath, 'installed'),\n };\n}\n"],"names":["installPaths","installPath","cachePath","path","join","buildPath"],"mappings":";;;;+BAIA;;;eAAwBA;;;2DAJP;;;;;;AAIF,SAASA,aAAaC,WAAmB;IACtD,OAAO;QACLC,WAAWC,aAAI,CAACC,IAAI,CAACH,aAAa;QAClCI,WAAWF,aAAI,CAACC,IAAI,CAACH,aAAa;QAClCA,aAAaE,aAAI,CAACC,IAAI,CAACH,aAAa;IACtC;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
/* 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; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return worker;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
|
+
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
|
+
var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
|
|
14
|
+
var _constants = require("./constants.js");
|
|
15
|
+
var _homedirpolyfill = /*#__PURE__*/ _interop_require_default(require("homedir-polyfill"));
|
|
16
|
+
var _installPaths = /*#__PURE__*/ _interop_require_default(require("./installPaths.js"));
|
|
17
|
+
var _module = /*#__PURE__*/ _interop_require_default(require("module"));
|
|
18
|
+
var _lazycache = /*#__PURE__*/ _interop_require_default(require("lazy-cache"));
|
|
19
|
+
function _define_property(obj, key, value) {
|
|
20
|
+
if (key in obj) {
|
|
21
|
+
Object.defineProperty(obj, key, {
|
|
22
|
+
value: value,
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true
|
|
26
|
+
});
|
|
27
|
+
} else {
|
|
28
|
+
obj[key] = value;
|
|
29
|
+
}
|
|
30
|
+
return obj;
|
|
31
|
+
}
|
|
32
|
+
function _interop_require_default(obj) {
|
|
33
|
+
return obj && obj.__esModule ? obj : {
|
|
34
|
+
default: obj
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function _object_spread(target) {
|
|
38
|
+
for(var i = 1; i < arguments.length; i++){
|
|
39
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
40
|
+
var ownKeys = Object.keys(source);
|
|
41
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
42
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
43
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
ownKeys.forEach(function(key) {
|
|
47
|
+
_define_property(target, key, source[key]);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return target;
|
|
51
|
+
}
|
|
52
|
+
var DEFAULT_INSTALL_DIRECTORY = _path.default.join((0, _homedirpolyfill.default)(), '.nvu');
|
|
53
|
+
var DEFAULT_INSTALL_DIRECTORIES = (0, _installPaths.default)(DEFAULT_INSTALL_DIRECTORY);
|
|
54
|
+
var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
|
|
55
|
+
var resolveVersions = (0, _lazycache.default)(_require)('node-resolve-versions');
|
|
56
|
+
var installRelease = (0, _lazycache.default)(_require)('node-install-release');
|
|
57
|
+
function worker(versionExpression, options, callback) {
|
|
58
|
+
var _ref = options.installPath ? (0, _installPaths.default)(options.installPath) : DEFAULT_INSTALL_DIRECTORIES, buildPath = _ref.buildPath, cachePath = _ref.cachePath, rootInstallPath = _ref.installPath;
|
|
59
|
+
resolveVersions()(versionExpression, _object_spread({}, options), function(err, versions) {
|
|
60
|
+
if (err) return callback(err);
|
|
61
|
+
if (!versions.length) return callback(new Error("No versions found from expression: ".concat(versionExpression)));
|
|
62
|
+
var results = [];
|
|
63
|
+
var queue = new _queuecb.default(options.concurrency || 1);
|
|
64
|
+
versions.forEach(function(version) {
|
|
65
|
+
return queue.defer(function(callback) {
|
|
66
|
+
var done = function done(err) {
|
|
67
|
+
if (err) return callback(err);
|
|
68
|
+
results.push({
|
|
69
|
+
version: version,
|
|
70
|
+
installPath: installPath,
|
|
71
|
+
execPath: execPath
|
|
72
|
+
});
|
|
73
|
+
callback();
|
|
74
|
+
};
|
|
75
|
+
var installPath = _path.default.join(rootInstallPath, version);
|
|
76
|
+
var binRoot = _constants.isWindows ? installPath : _path.default.join(installPath, 'bin');
|
|
77
|
+
var execPath = _path.default.join(binRoot, _constants.NODE);
|
|
78
|
+
_fs.default.stat(execPath, function(err) {
|
|
79
|
+
// TODO remove redundant options
|
|
80
|
+
err ? installRelease()(version, installPath, {
|
|
81
|
+
cachePath: cachePath,
|
|
82
|
+
buildPath: buildPath,
|
|
83
|
+
cacheDirectory: cachePath,
|
|
84
|
+
buildDirectory: buildPath
|
|
85
|
+
}, done) : done();
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
queue.await(function(err) {
|
|
90
|
+
if (err) return callback(err);
|
|
91
|
+
var result = versions.length === 1 ? results[0] : results;
|
|
92
|
+
callback(null, result);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/* 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; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/worker.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport { NODE, isWindows } from './constants.js';\n\nimport home from 'homedir-polyfill';\nimport installPaths from './installPaths.js';\nconst DEFAULT_INSTALL_DIRECTORY = path.join(home(), '.nvu');\nconst DEFAULT_INSTALL_DIRECTORIES = installPaths(DEFAULT_INSTALL_DIRECTORY);\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst resolveVersions = lazy(_require)('node-resolve-versions');\nconst installRelease = lazy(_require)('node-install-release');\n\nimport type { InstallOptions, InstallResult } from './types.js';\n\nexport default function worker(versionExpression: string, options: InstallOptions, callback) {\n const { buildPath, cachePath, installPath: rootInstallPath } = options.installPath ? installPaths(options.installPath) : DEFAULT_INSTALL_DIRECTORIES;\n\n resolveVersions()(versionExpression, { ...options }, (err, versions) => {\n if (err) return callback(err);\n if (!versions.length) return callback(new Error(`No versions found from expression: ${versionExpression}`));\n\n const results: InstallResult[] = [];\n const queue = new Queue(options.concurrency || 1);\n versions.forEach((version) =>\n queue.defer((callback) => {\n const installPath = path.join(rootInstallPath, version);\n const binRoot = isWindows ? installPath : path.join(installPath, 'bin');\n const execPath = path.join(binRoot, NODE);\n\n function done(err?) {\n if (err) return callback(err);\n results.push({ version, installPath, execPath });\n callback();\n }\n\n fs.stat(execPath, (err) => {\n // TODO remove redundant options\n err ? installRelease()(version, installPath, { cachePath, buildPath, cacheDirectory: cachePath, buildDirectory: buildPath }, done) : done();\n });\n })\n );\n queue.await((err) => {\n if (err) return callback(err);\n const result = versions.length === 1 ? results[0] : results;\n callback(null, result);\n });\n });\n}\n"],"names":["worker","DEFAULT_INSTALL_DIRECTORY","path","join","home","DEFAULT_INSTALL_DIRECTORIES","installPaths","_require","require","Module","createRequire","resolveVersions","lazy","installRelease","versionExpression","options","callback","installPath","buildPath","cachePath","rootInstallPath","err","versions","length","Error","results","queue","Queue","concurrency","forEach","version","defer","done","push","execPath","binRoot","isWindows","NODE","fs","stat","cacheDirectory","buildDirectory","await","result"],"mappings":";;;;+BAkBA;;;eAAwBA;;;yDAlBT;2DACE;8DACC;yBACc;sEAEf;mEACQ;6DAIN;gEACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAJjB,IAAMC,4BAA4BC,aAAI,CAACC,IAAI,CAACC,IAAAA,wBAAI,KAAI;AACpD,IAAMC,8BAA8BC,IAAAA,qBAAY,EAACL;AAIjD,IAAMM,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,kBAAkBC,IAAAA,kBAAI,EAACL,UAAU;AACvC,IAAMM,iBAAiBD,IAAAA,kBAAI,EAACL,UAAU;AAIvB,SAASP,OAAOc,iBAAyB,EAAEC,OAAuB,EAAEC,QAAQ;IACzF,IAA+DD,OAAAA,QAAQE,WAAW,GAAGX,IAAAA,qBAAY,EAACS,QAAQE,WAAW,IAAIZ,6BAAjHa,YAAuDH,KAAvDG,WAAWC,YAA4CJ,KAA5CI,WAAWF,AAAaG,kBAAoBL,KAAjCE;IAE9BN,kBAAkBG,mBAAmB,mBAAKC,UAAW,SAACM,KAAKC;QACzD,IAAID,KAAK,OAAOL,SAASK;QACzB,IAAI,CAACC,SAASC,MAAM,EAAE,OAAOP,SAAS,IAAIQ,MAAM,AAAC,sCAAuD,OAAlBV;QAEtF,IAAMW,UAA2B,EAAE;QACnC,IAAMC,QAAQ,IAAIC,gBAAK,CAACZ,QAAQa,WAAW,IAAI;QAC/CN,SAASO,OAAO,CAAC,SAACC;mBAChBJ,MAAMK,KAAK,CAAC,SAACf;oBAKFgB,OAAT,SAASA,KAAKX,GAAI;oBAChB,IAAIA,KAAK,OAAOL,SAASK;oBACzBI,QAAQQ,IAAI,CAAC;wBAAEH,SAAAA;wBAASb,aAAAA;wBAAaiB,UAAAA;oBAAS;oBAC9ClB;gBACF;gBARA,IAAMC,cAAcf,aAAI,CAACC,IAAI,CAACiB,iBAAiBU;gBAC/C,IAAMK,UAAUC,oBAAS,GAAGnB,cAAcf,aAAI,CAACC,IAAI,CAACc,aAAa;gBACjE,IAAMiB,WAAWhC,aAAI,CAACC,IAAI,CAACgC,SAASE,eAAI;gBAQxCC,WAAE,CAACC,IAAI,CAACL,UAAU,SAACb;oBACjB,gCAAgC;oBAChCA,MAAMR,iBAAiBiB,SAASb,aAAa;wBAAEE,WAAAA;wBAAWD,WAAAA;wBAAWsB,gBAAgBrB;wBAAWsB,gBAAgBvB;oBAAU,GAAGc,QAAQA;gBACvI;YACF;;QAEFN,MAAMgB,KAAK,CAAC,SAACrB;YACX,IAAIA,KAAK,OAAOL,SAASK;YACzB,IAAMsB,SAASrB,SAASC,MAAM,KAAK,IAAIE,OAAO,CAAC,EAAE,GAAGA;YACpDT,SAAS,MAAM2B;QACjB;IACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/constants.ts"],"sourcesContent":["export const isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\nexport const NODE = isWindows ? 'node.exe' : 'node';\n"],"names":["isWindows","process","platform","test","env","OSTYPE","NODE"],"mappings":"AAAA,OAAO,MAAMA,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM,EAAE;AACpG,OAAO,MAAMC,OAAON,YAAY,aAAa,OAAO"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import url from 'url';
|
|
3
|
+
import moduleRoot from 'module-root-sync';
|
|
4
|
+
import worker from './worker.mjs';
|
|
5
|
+
export * from './types.mjs';
|
|
6
|
+
export default function install(versionExpression, options, callback) {
|
|
7
|
+
if (typeof options === 'function') {
|
|
8
|
+
callback = options;
|
|
9
|
+
options = {};
|
|
10
|
+
}
|
|
11
|
+
options = options || {};
|
|
12
|
+
if (typeof callback === 'function') return worker(versionExpression, options, callback);
|
|
13
|
+
return new Promise((resolve, reject)=>worker(versionExpression, options, (err, result)=>{
|
|
14
|
+
err ? reject(err) : resolve(result);
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
import Module from 'module';
|
|
18
|
+
import lazy from 'lazy-cache';
|
|
19
|
+
const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
|
|
20
|
+
const execFunction = lazy(_require)('function-exec-sync');
|
|
21
|
+
const SLEEP_MS = 200;
|
|
22
|
+
const __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);
|
|
23
|
+
const root = moduleRoot(__dirname);
|
|
24
|
+
const workerPath = path.join(root, 'dist', 'cjs', 'worker.js');
|
|
25
|
+
export function sync(versionExpression, options) {
|
|
26
|
+
options = options || {};
|
|
27
|
+
return execFunction().default({
|
|
28
|
+
cwd: process.cwd(),
|
|
29
|
+
sleep: SLEEP_MS,
|
|
30
|
+
callbacks: true
|
|
31
|
+
}, workerPath, versionExpression, options);
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/index.ts"],"sourcesContent":["import path from 'path';\nimport url from 'url';\nimport moduleRoot from 'module-root-sync';\nimport worker from './worker.js';\n\nimport type { InstallCallback, InstallOptions, InstallResult } from './types.js';\n\nexport * from './types.js';\nexport default function install(versionExpression: string, options?: InstallOptions, callback?: InstallCallback): undefined | Promise<InstallResult | InstallResult[]> {\n if (typeof options === 'function') {\n callback = options as InstallCallback;\n options = {};\n }\n options = options || {};\n\n if (typeof callback === 'function') return worker(versionExpression, options, callback) as undefined;\n return new Promise((resolve, reject) =>\n worker(versionExpression, options, (err, result) => {\n err ? reject(err) : resolve(result);\n })\n );\n}\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst execFunction = lazy(_require)('function-exec-sync');\n\nconst SLEEP_MS = 200;\nconst __dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst root = moduleRoot(__dirname);\nconst workerPath = path.join(root, 'dist', 'cjs', 'worker.js');\n\nexport function sync(versionExpression: string, options?: InstallOptions): InstallResult | InstallResult[] {\n options = options || {};\n return execFunction().default({ cwd: process.cwd(), sleep: SLEEP_MS, callbacks: true }, workerPath, versionExpression, options);\n}\n"],"names":["path","url","moduleRoot","worker","install","versionExpression","options","callback","Promise","resolve","reject","err","result","Module","lazy","_require","require","createRequire","execFunction","SLEEP_MS","__dirname","dirname","__filename","fileURLToPath","root","workerPath","join","sync","default","cwd","process","sleep","callbacks"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,OAAOC,gBAAgB,mBAAmB;AAC1C,OAAOC,YAAY,cAAc;AAIjC,cAAc,aAAa;AAC3B,eAAe,SAASC,QAAQC,iBAAyB,EAAEC,OAAwB,EAAEC,QAA0B;IAC7G,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IAEtB,IAAI,OAAOC,aAAa,YAAY,OAAOJ,OAAOE,mBAAmBC,SAASC;IAC9E,OAAO,IAAIC,QAAQ,CAACC,SAASC,SAC3BP,OAAOE,mBAAmBC,SAAS,CAACK,KAAKC;YACvCD,MAAMD,OAAOC,OAAOF,QAAQG;QAC9B;AAEJ;AAEA,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,aAAa;AAC9B,MAAMC,WAAW,OAAOC,YAAY,cAAcH,OAAOI,aAAa,CAAC,YAAYhB,GAAG,IAAIe;AAC1F,MAAME,eAAeJ,KAAKC,UAAU;AAEpC,MAAMI,WAAW;AACjB,MAAMC,YAAYpB,KAAKqB,OAAO,CAAC,OAAOC,eAAe,cAAcrB,IAAIsB,aAAa,CAAC,YAAYtB,GAAG,IAAIqB;AACxG,MAAME,OAAOtB,WAAWkB;AACxB,MAAMK,aAAazB,KAAK0B,IAAI,CAACF,MAAM,QAAQ,OAAO;AAElD,OAAO,SAASG,KAAKtB,iBAAyB,EAAEC,OAAwB;IACtEA,UAAUA,WAAW,CAAC;IACtB,OAAOY,eAAeU,OAAO,CAAC;QAAEC,KAAKC,QAAQD,GAAG;QAAIE,OAAOZ;QAAUa,WAAW;IAAK,GAAGP,YAAYpB,mBAAmBC;AACzH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/installPaths.ts"],"sourcesContent":["import path from 'path';\n\nimport type { InstallPaths } from './types.js';\n\nexport default function installPaths(installPath: string): InstallPaths {\n return {\n cachePath: path.join(installPath, 'cache'),\n buildPath: path.join(installPath, 'build'),\n installPath: path.join(installPath, 'installed'),\n };\n}\n"],"names":["path","installPaths","installPath","cachePath","join","buildPath"],"mappings":"AAAA,OAAOA,UAAU,OAAO;AAIxB,eAAe,SAASC,aAAaC,WAAmB;IACtD,OAAO;QACLC,WAAWH,KAAKI,IAAI,CAACF,aAAa;QAClCG,WAAWL,KAAKI,IAAI,CAACF,aAAa;QAClCA,aAAaF,KAAKI,IAAI,CAACF,aAAa;IACtC;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/types.ts"],"sourcesContent":["export type InstallPaths = {\n cachePath: string;\n buildPath: string;\n installPath: string;\n};\n\nexport type InstallResult = {\n version: string;\n installPath: string;\n execPath: string;\n};\n\nexport interface InstallOptions {\n installPath?: string;\n concurrency?: number;\n}\n\nexport type InstallCallback = (err?: Error, results?: InstallResult | InstallResult[]) => void;\n"],"names":[],"mappings":"AAiBA,WAA+F"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import Queue from 'queue-cb';
|
|
4
|
+
import { NODE, isWindows } from './constants.mjs';
|
|
5
|
+
import home from 'homedir-polyfill';
|
|
6
|
+
import installPaths from './installPaths.mjs';
|
|
7
|
+
const DEFAULT_INSTALL_DIRECTORY = path.join(home(), '.nvu');
|
|
8
|
+
const DEFAULT_INSTALL_DIRECTORIES = installPaths(DEFAULT_INSTALL_DIRECTORY);
|
|
9
|
+
import Module from 'module';
|
|
10
|
+
import lazy from 'lazy-cache';
|
|
11
|
+
const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
|
|
12
|
+
const resolveVersions = lazy(_require)('node-resolve-versions');
|
|
13
|
+
const installRelease = lazy(_require)('node-install-release');
|
|
14
|
+
export default function worker(versionExpression, options, callback) {
|
|
15
|
+
const { buildPath, cachePath, installPath: rootInstallPath } = options.installPath ? installPaths(options.installPath) : DEFAULT_INSTALL_DIRECTORIES;
|
|
16
|
+
resolveVersions()(versionExpression, {
|
|
17
|
+
...options
|
|
18
|
+
}, (err, versions)=>{
|
|
19
|
+
if (err) return callback(err);
|
|
20
|
+
if (!versions.length) return callback(new Error(`No versions found from expression: ${versionExpression}`));
|
|
21
|
+
const results = [];
|
|
22
|
+
const queue = new Queue(options.concurrency || 1);
|
|
23
|
+
versions.forEach((version)=>queue.defer((callback)=>{
|
|
24
|
+
const installPath = path.join(rootInstallPath, version);
|
|
25
|
+
const binRoot = isWindows ? installPath : path.join(installPath, 'bin');
|
|
26
|
+
const execPath = path.join(binRoot, NODE);
|
|
27
|
+
function done(err) {
|
|
28
|
+
if (err) return callback(err);
|
|
29
|
+
results.push({
|
|
30
|
+
version,
|
|
31
|
+
installPath,
|
|
32
|
+
execPath
|
|
33
|
+
});
|
|
34
|
+
callback();
|
|
35
|
+
}
|
|
36
|
+
fs.stat(execPath, (err)=>{
|
|
37
|
+
// TODO remove redundant options
|
|
38
|
+
err ? installRelease()(version, installPath, {
|
|
39
|
+
cachePath,
|
|
40
|
+
buildPath,
|
|
41
|
+
cacheDirectory: cachePath,
|
|
42
|
+
buildDirectory: buildPath
|
|
43
|
+
}, done) : done();
|
|
44
|
+
});
|
|
45
|
+
}));
|
|
46
|
+
queue.await((err)=>{
|
|
47
|
+
if (err) return callback(err);
|
|
48
|
+
const result = versions.length === 1 ? results[0] : results;
|
|
49
|
+
callback(null, result);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-install/src/worker.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport Queue from 'queue-cb';\nimport { NODE, isWindows } from './constants.js';\n\nimport home from 'homedir-polyfill';\nimport installPaths from './installPaths.js';\nconst DEFAULT_INSTALL_DIRECTORY = path.join(home(), '.nvu');\nconst DEFAULT_INSTALL_DIRECTORIES = installPaths(DEFAULT_INSTALL_DIRECTORY);\n\nimport Module from 'module';\nimport lazy from 'lazy-cache';\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst resolveVersions = lazy(_require)('node-resolve-versions');\nconst installRelease = lazy(_require)('node-install-release');\n\nimport type { InstallOptions, InstallResult } from './types.js';\n\nexport default function worker(versionExpression: string, options: InstallOptions, callback) {\n const { buildPath, cachePath, installPath: rootInstallPath } = options.installPath ? installPaths(options.installPath) : DEFAULT_INSTALL_DIRECTORIES;\n\n resolveVersions()(versionExpression, { ...options }, (err, versions) => {\n if (err) return callback(err);\n if (!versions.length) return callback(new Error(`No versions found from expression: ${versionExpression}`));\n\n const results: InstallResult[] = [];\n const queue = new Queue(options.concurrency || 1);\n versions.forEach((version) =>\n queue.defer((callback) => {\n const installPath = path.join(rootInstallPath, version);\n const binRoot = isWindows ? installPath : path.join(installPath, 'bin');\n const execPath = path.join(binRoot, NODE);\n\n function done(err?) {\n if (err) return callback(err);\n results.push({ version, installPath, execPath });\n callback();\n }\n\n fs.stat(execPath, (err) => {\n // TODO remove redundant options\n err ? installRelease()(version, installPath, { cachePath, buildPath, cacheDirectory: cachePath, buildDirectory: buildPath }, done) : done();\n });\n })\n );\n queue.await((err) => {\n if (err) return callback(err);\n const result = versions.length === 1 ? results[0] : results;\n callback(null, result);\n });\n });\n}\n"],"names":["fs","path","Queue","NODE","isWindows","home","installPaths","DEFAULT_INSTALL_DIRECTORY","join","DEFAULT_INSTALL_DIRECTORIES","Module","lazy","_require","require","createRequire","url","resolveVersions","installRelease","worker","versionExpression","options","callback","buildPath","cachePath","installPath","rootInstallPath","err","versions","length","Error","results","queue","concurrency","forEach","version","defer","binRoot","execPath","done","push","stat","cacheDirectory","buildDirectory","await","result"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,WAAW,WAAW;AAC7B,SAASC,IAAI,EAAEC,SAAS,QAAQ,iBAAiB;AAEjD,OAAOC,UAAU,mBAAmB;AACpC,OAAOC,kBAAkB,oBAAoB;AAC7C,MAAMC,4BAA4BN,KAAKO,IAAI,CAACH,QAAQ;AACpD,MAAMI,8BAA8BH,aAAaC;AAEjD,OAAOG,YAAY,SAAS;AAC5B,OAAOC,UAAU,aAAa;AAC9B,MAAMC,WAAW,OAAOC,YAAY,cAAcH,OAAOI,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAC1F,MAAMG,kBAAkBL,KAAKC,UAAU;AACvC,MAAMK,iBAAiBN,KAAKC,UAAU;AAItC,eAAe,SAASM,OAAOC,iBAAyB,EAAEC,OAAuB,EAAEC,QAAQ;IACzF,MAAM,EAAEC,SAAS,EAAEC,SAAS,EAAEC,aAAaC,eAAe,EAAE,GAAGL,QAAQI,WAAW,GAAGlB,aAAac,QAAQI,WAAW,IAAIf;IAEzHO,kBAAkBG,mBAAmB;QAAE,GAAGC,OAAO;IAAC,GAAG,CAACM,KAAKC;QACzD,IAAID,KAAK,OAAOL,SAASK;QACzB,IAAI,CAACC,SAASC,MAAM,EAAE,OAAOP,SAAS,IAAIQ,MAAM,CAAC,mCAAmC,EAAEV,mBAAmB;QAEzG,MAAMW,UAA2B,EAAE;QACnC,MAAMC,QAAQ,IAAI7B,MAAMkB,QAAQY,WAAW,IAAI;QAC/CL,SAASM,OAAO,CAAC,CAACC,UAChBH,MAAMI,KAAK,CAAC,CAACd;gBACX,MAAMG,cAAcvB,KAAKO,IAAI,CAACiB,iBAAiBS;gBAC/C,MAAME,UAAUhC,YAAYoB,cAAcvB,KAAKO,IAAI,CAACgB,aAAa;gBACjE,MAAMa,WAAWpC,KAAKO,IAAI,CAAC4B,SAASjC;gBAEpC,SAASmC,KAAKZ,GAAI;oBAChB,IAAIA,KAAK,OAAOL,SAASK;oBACzBI,QAAQS,IAAI,CAAC;wBAAEL;wBAASV;wBAAaa;oBAAS;oBAC9ChB;gBACF;gBAEArB,GAAGwC,IAAI,CAACH,UAAU,CAACX;oBACjB,gCAAgC;oBAChCA,MAAMT,iBAAiBiB,SAASV,aAAa;wBAAED;wBAAWD;wBAAWmB,gBAAgBlB;wBAAWmB,gBAAgBpB;oBAAU,GAAGgB,QAAQA;gBACvI;YACF;QAEFP,MAAMY,KAAK,CAAC,CAACjB;YACX,IAAIA,KAAK,OAAOL,SAASK;YACzB,MAAMkB,SAASjB,SAASC,MAAM,KAAK,IAAIE,OAAO,CAAC,EAAE,GAAGA;YACpDT,SAAS,MAAMuB;QACjB;IACF;AACF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InstallCallback, InstallOptions, InstallResult } from './types.js';
|
|
2
|
+
export * from './types.js';
|
|
3
|
+
export default function install(versionExpression: string, options?: InstallOptions, callback?: InstallCallback): undefined | Promise<InstallResult | InstallResult[]>;
|
|
4
|
+
export declare function sync(versionExpression: string, options?: InstallOptions): InstallResult | InstallResult[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type InstallPaths = {
|
|
2
|
+
cachePath: string;
|
|
3
|
+
buildPath: string;
|
|
4
|
+
installPath: string;
|
|
5
|
+
};
|
|
6
|
+
export type InstallResult = {
|
|
7
|
+
version: string;
|
|
8
|
+
installPath: string;
|
|
9
|
+
execPath: string;
|
|
10
|
+
};
|
|
11
|
+
export interface InstallOptions {
|
|
12
|
+
installPath?: string;
|
|
13
|
+
concurrency?: number;
|
|
14
|
+
}
|
|
15
|
+
export type InstallCallback = (err?: Error, results?: InstallResult | InstallResult[]) => void;
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "node-version-install",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Install NodeJs by version string asynchronously or synchronously",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"node",
|
|
7
|
+
"version",
|
|
8
|
+
"install",
|
|
9
|
+
"async",
|
|
10
|
+
"sync"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/kmalakoff/node-version-install#README.md",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/kmalakoff/node-version-install/issues"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+ssh://git@github.com/kmalakoff/node-version-install.git"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": {
|
|
22
|
+
"name": "Kevin Malakoff",
|
|
23
|
+
"email": "kmalakoff@gmail.com",
|
|
24
|
+
"url": "https://github.com/kmalakoff"
|
|
25
|
+
},
|
|
26
|
+
"type": "module",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"import": "./dist/esm/index.mjs",
|
|
30
|
+
"require": "./dist/cjs/index.js",
|
|
31
|
+
"types": "./dist/types/index.d.ts"
|
|
32
|
+
},
|
|
33
|
+
"./*": "./*"
|
|
34
|
+
},
|
|
35
|
+
"main": "dist/cjs/index.js",
|
|
36
|
+
"module": "dist/dist/esm/index.mjs",
|
|
37
|
+
"types": "dist/types/index.d.ts",
|
|
38
|
+
"files": [
|
|
39
|
+
"dist"
|
|
40
|
+
],
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsds build",
|
|
43
|
+
"deploy": "tsds deploy",
|
|
44
|
+
"format": "biome check --write --unsafe src/ test/",
|
|
45
|
+
"test": "tsds test:node --no-timeouts",
|
|
46
|
+
"test:engines": "nvu engines npm run test",
|
|
47
|
+
"version": "tsds version"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"function-exec-sync": "^1.1.2",
|
|
51
|
+
"homedir-polyfill": "^1.0.3",
|
|
52
|
+
"lazy-cache": "^2.0.2",
|
|
53
|
+
"module-root-sync": "^0.1.1",
|
|
54
|
+
"node-install-release": "^1.5.2",
|
|
55
|
+
"node-resolve-versions": "^1.0.5",
|
|
56
|
+
"queue-cb": "^1.4.4"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@biomejs/biome": "^1.9.4",
|
|
60
|
+
"@types/mocha": "^10.0.10",
|
|
61
|
+
"@types/node": "^22.10.2",
|
|
62
|
+
"cr": "^0.1.0",
|
|
63
|
+
"fs-exists-sync": "^0.1.0",
|
|
64
|
+
"is-version": "^0.2.1",
|
|
65
|
+
"node-version-utils": "^1.1.3",
|
|
66
|
+
"pinkie-promise": "^2.0.1",
|
|
67
|
+
"rimraf2": "^2.8.2"
|
|
68
|
+
},
|
|
69
|
+
"engines": {
|
|
70
|
+
"node": ">=0.8"
|
|
71
|
+
},
|
|
72
|
+
"tsds": {
|
|
73
|
+
"source": "src/index.ts"
|
|
74
|
+
}
|
|
75
|
+
}
|