node-install-release 1.15.6 → 1.15.8
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.js +5 -5
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/installNode/installCompressed.js +2 -4
- package/dist/cjs/installNode/installCompressed.js.map +1 -1
- package/dist/cjs/lib/copyFile.js +2 -6
- package/dist/cjs/lib/copyFile.js.map +1 -1
- package/dist/esm/cli.js +1 -1
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/installNode/installCompressed.js +2 -4
- package/dist/esm/installNode/installCompressed.js.map +1 -1
- package/dist/esm/lib/copyFile.js +2 -6
- package/dist/esm/lib/copyFile.js.map +1 -1
- package/package.json +27 -27
package/dist/cjs/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return _default;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
var
|
|
11
|
+
var _exitcompat = /*#__PURE__*/ _interop_require_default(require("exit-compat"));
|
|
12
12
|
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
13
13
|
var _getoptscompat = /*#__PURE__*/ _interop_require_default(require("getopts-compat"));
|
|
14
14
|
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
@@ -66,18 +66,18 @@ var _default = function(argv, name) {
|
|
|
66
66
|
});
|
|
67
67
|
if (options.version) {
|
|
68
68
|
console.log(getPackageVersion());
|
|
69
|
-
(0,
|
|
69
|
+
(0, _exitcompat.default)(0);
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
if (options.help) {
|
|
73
73
|
printHelp(cliName);
|
|
74
|
-
(0,
|
|
74
|
+
(0, _exitcompat.default)(0);
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
var args = options._;
|
|
78
78
|
if (args.length < 1) {
|
|
79
79
|
console.log("Missing command. Example usage: ".concat(cliName, " <version> [directory]"));
|
|
80
|
-
(0,
|
|
80
|
+
(0, _exitcompat.default)(ERROR_CODE);
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
(0, _indexts.default)(args[0], options, function(err, result) {
|
|
@@ -87,7 +87,7 @@ var _default = function(argv, name) {
|
|
|
87
87
|
else console.log("".concat(result.version, " installed in: ").concat(result.installPath));
|
|
88
88
|
console.log('======================');
|
|
89
89
|
}
|
|
90
|
-
(0,
|
|
90
|
+
(0, _exitcompat.default)(err ? ERROR_CODE : 0);
|
|
91
91
|
});
|
|
92
92
|
};
|
|
93
93
|
/* 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; }
|
package/dist/cjs/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/cli.ts"],"sourcesContent":["import exit from 'exit';\nimport fs from 'fs';\nimport getopts from 'getopts-compat';\nimport path from 'path';\nimport url from 'url';\nimport install, { type InstallOptions } from './index.ts';\n\nconst ERROR_CODE = 9;\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\n\nfunction getPackageVersion(): string {\n const packagePath = path.join(__dirname, '..', '..', 'package.json');\n const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));\n return packageJson.version;\n}\n\nfunction printHelp(name: string): void {\n const version = getPackageVersion();\n console.log(`${name} v${version}`);\n console.log('');\n console.log(`Usage: ${name} <version> [options]`);\n console.log('');\n console.log('Arguments:');\n console.log(' version Node.js version to install (e.g., 18.0.0, lts, stable)');\n console.log('');\n console.log('Options:');\n console.log(' -p, --platform Target platform (default: current platform)');\n console.log(' -a, --arch Target architecture (default: current architecture)');\n console.log(' -f, --filename Specific filename to download');\n console.log(' -i, --installPath Installation directory');\n console.log(' -c, --storagePath Cache storage directory');\n console.log(' -si, --silent Suppress output');\n console.log(' -v, --version Show version number');\n console.log(' -h, --help Show this help message');\n}\n\nexport default (argv: string[], name?: string): undefined => {\n const cliName = name || 'nir';\n const options = getopts(argv, {\n alias: { platform: 'p', arch: 'a', filename: 'f', installPath: 'i', storagePath: 'c', silent: 'si', version: 'v', help: 'h' },\n boolean: ['silent', 'version', 'help'],\n });\n\n if (options.version) {\n console.log(getPackageVersion());\n exit(0);\n return;\n }\n\n if (options.help) {\n printHelp(cliName);\n exit(0);\n return;\n }\n\n const args = options._;\n if (args.length < 1) {\n console.log(`Missing command. Example usage: ${cliName} <version> [directory]`);\n exit(ERROR_CODE);\n return;\n }\n install(args[0], options as InstallOptions, (err, result) => {\n if (!options.silent) {\n console.log('\\n======================');\n if (err) console.log(`${args[0]} not installed. Error: ${err.message}`);\n else console.log(`${result.version} installed in: ${result.installPath}`);\n console.log('======================');\n }\n exit(err ? ERROR_CODE : 0);\n });\n};\n"],"names":["ERROR_CODE","__dirname","path","dirname","__filename","url","fileURLToPath","getPackageVersion","packagePath","join","packageJson","JSON","parse","fs","readFileSync","version","printHelp","name","console","log","argv","cliName","options","getopts","alias","platform","arch","filename","installPath","storagePath","silent","help","boolean","exit","args","_","length","install","err","result","message"],"mappings":";;;;+BAoCA;;;eAAA;;;
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/cli.ts"],"sourcesContent":["import exit from 'exit-compat';\nimport fs from 'fs';\nimport getopts from 'getopts-compat';\nimport path from 'path';\nimport url from 'url';\nimport install, { type InstallOptions } from './index.ts';\n\nconst ERROR_CODE = 9;\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\n\nfunction getPackageVersion(): string {\n const packagePath = path.join(__dirname, '..', '..', 'package.json');\n const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));\n return packageJson.version;\n}\n\nfunction printHelp(name: string): void {\n const version = getPackageVersion();\n console.log(`${name} v${version}`);\n console.log('');\n console.log(`Usage: ${name} <version> [options]`);\n console.log('');\n console.log('Arguments:');\n console.log(' version Node.js version to install (e.g., 18.0.0, lts, stable)');\n console.log('');\n console.log('Options:');\n console.log(' -p, --platform Target platform (default: current platform)');\n console.log(' -a, --arch Target architecture (default: current architecture)');\n console.log(' -f, --filename Specific filename to download');\n console.log(' -i, --installPath Installation directory');\n console.log(' -c, --storagePath Cache storage directory');\n console.log(' -si, --silent Suppress output');\n console.log(' -v, --version Show version number');\n console.log(' -h, --help Show this help message');\n}\n\nexport default (argv: string[], name?: string): undefined => {\n const cliName = name || 'nir';\n const options = getopts(argv, {\n alias: { platform: 'p', arch: 'a', filename: 'f', installPath: 'i', storagePath: 'c', silent: 'si', version: 'v', help: 'h' },\n boolean: ['silent', 'version', 'help'],\n });\n\n if (options.version) {\n console.log(getPackageVersion());\n exit(0);\n return;\n }\n\n if (options.help) {\n printHelp(cliName);\n exit(0);\n return;\n }\n\n const args = options._;\n if (args.length < 1) {\n console.log(`Missing command. Example usage: ${cliName} <version> [directory]`);\n exit(ERROR_CODE);\n return;\n }\n install(args[0], options as InstallOptions, (err, result) => {\n if (!options.silent) {\n console.log('\\n======================');\n if (err) console.log(`${args[0]} not installed. Error: ${err.message}`);\n else console.log(`${result.version} installed in: ${result.installPath}`);\n console.log('======================');\n }\n exit(err ? ERROR_CODE : 0);\n });\n};\n"],"names":["ERROR_CODE","__dirname","path","dirname","__filename","url","fileURLToPath","getPackageVersion","packagePath","join","packageJson","JSON","parse","fs","readFileSync","version","printHelp","name","console","log","argv","cliName","options","getopts","alias","platform","arch","filename","installPath","storagePath","silent","help","boolean","exit","args","_","length","install","err","result","message"],"mappings":";;;;+BAoCA;;;eAAA;;;iEApCiB;yDACF;oEACK;2DACH;0DACD;8DAC6B;;;;;;AAE7C,IAAMA,aAAa;AACnB,IAAMC,YAAYC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcA,aAAaC,YAAG,CAACC,aAAa,CAAC;AAElG,SAASC;IACP,I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AG,CAAC,AAAC,mCAA0C,OAARE,SAAQ;QACvDY,IAAAA,mBAAI,EAACjC;QACL;IACF;IACAqC,IAAAA,gBAAO,EAACH,IAAI,CAAC,EAAE,EAAEZ,SAA2B,SAACgB,KAAKC;QAChD,IAAI,CAACjB,QAAQQ,MAAM,EAAE;YACnBZ,QAAQC,GAAG,CAAC;YACZ,IAAImB,KAAKpB,QAAQC,GAAG,CAAC,AAAC,GAAmCmB,OAAjCJ,IAAI,CAAC,EAAE,EAAC,2BAAqC,OAAZI,IAAIE,OAAO;iBAC/DtB,QAAQC,GAAG,CAAC,AAAC,GAAkCoB,OAAhCA,OAAOxB,OAAO,EAAC,mBAAoC,OAAnBwB,OAAOX,WAAW;YACtEV,QAAQC,GAAG,CAAC;QACd;QACAc,IAAAA,mBAAI,EAACK,MAAMtC,aAAa;IAC1B;AACF"}
|
|
@@ -9,9 +9,9 @@ Object.defineProperty(exports, "default", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
|
+
var _fsremovecompat = require("fs-remove-compat");
|
|
12
13
|
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
14
|
var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
|
|
14
|
-
var _rimraf2 = /*#__PURE__*/ _interop_require_default(require("rimraf2"));
|
|
15
15
|
var _constantsts = require("../constants.js");
|
|
16
16
|
var _conditionalCachets = /*#__PURE__*/ _interop_require_default(require("../lib/conditionalCache.js"));
|
|
17
17
|
var _conditionalExtractts = /*#__PURE__*/ _interop_require_default(require("../lib/conditionalExtract.js"));
|
|
@@ -44,9 +44,7 @@ function installCompressed(distPath, dest, options, callback) {
|
|
|
44
44
|
// some compressed versions of node come with npm pre-installed, but we want to override with a specific version
|
|
45
45
|
var libPath = platform === 'win32' ? dest : _path.default.join(dest, 'lib');
|
|
46
46
|
var installPath = _path.default.join(libPath, 'node_modules', 'npm');
|
|
47
|
-
(0,
|
|
48
|
-
disableGlob: true
|
|
49
|
-
}, function() {
|
|
47
|
+
(0, _fsremovecompat.safeRm)(installPath, function() {
|
|
50
48
|
return callback(err, checksum);
|
|
51
49
|
});
|
|
52
50
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installCompressed.ts"],"sourcesContent":["import fs from 'fs';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installCompressed.ts"],"sourcesContent":["import fs from 'fs';\nimport { safeRm } from 'fs-remove-compat';\nimport path from 'path';\nimport Queue from 'queue-cb';\n\nimport { NODE_DIST_BASE_URL } from '../constants.ts';\nimport conditionalCache from '../lib/conditionalCache.ts';\nimport conditionalExtract from '../lib/conditionalExtract.ts';\nimport type { ChecksumCallback, ChecksumResult, InstallOptions } from '../types.ts';\nimport validateDownload from './validateDownload.ts';\n\nexport default function installCompressed(distPath: string, dest: string, options: InstallOptions, callback: ChecksumCallback): undefined {\n const platform = options.platform;\n const downloadPath = `${NODE_DIST_BASE_URL}/${distPath}`;\n const cachePath = path.join(options.cachePath, path.basename(downloadPath));\n\n fs.stat(dest, (err) => {\n if (!err) return callback(); // already exists\n\n let checksum: ChecksumResult | undefined;\n const queue = new Queue(1);\n queue.defer(conditionalCache.bind(null, downloadPath, cachePath));\n queue.defer((cb) => {\n validateDownload(distPath, cachePath, (err, result) => {\n checksum = result;\n cb(err);\n });\n });\n queue.defer(conditionalExtract.bind(null, cachePath, dest, { strip: 1, time: 1000 }));\n queue.await((err) => {\n // some compressed versions of node come with npm pre-installed, but we want to override with a specific version\n const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');\n const installPath = path.join(libPath, 'node_modules', 'npm');\n safeRm(installPath, () => callback(err, checksum));\n });\n });\n}\n"],"names":["installCompressed","distPath","dest","options","callback","platform","downloadPath","NODE_DIST_BASE_URL","cachePath","path","join","basename","fs","stat","err","checksum","queue","Queue","defer","conditionalCache","bind","cb","validateDownload","result","conditionalExtract","strip","time","await","libPath","installPath","safeRm"],"mappings":";;;;+BAWA;;;eAAwBA;;;yDAXT;8BACQ;2DACN;8DACC;2BAEiB;yEACN;2EACE;yEAEF;;;;;;AAEd,SAASA,kBAAkBC,QAAgB,EAAEC,IAAY,EAAEC,OAAuB,EAAEC,QAA0B;IAC3H,IAAMC,WAAWF,QAAQE,QAAQ;IACjC,IAAMC,eAAe,AAAC,GAAwBL,OAAtBM,+BAAkB,EAAC,KAAY,OAATN;IAC9C,IAAMO,YAAYC,aAAI,CAACC,IAAI,CAACP,QAAQK,SAAS,EAAEC,aAAI,CAACE,QAAQ,CAACL;IAE7DM,WAAE,CAACC,IAAI,CAACX,MAAM,SAACY;QACb,IAAI,CAACA,KAAK,OAAOV,YAAY,iBAAiB;QAE9C,IAAIW;QACJ,IAAMC,QAAQ,IAAIC,gBAAK,CAAC;QACxBD,MAAME,KAAK,CAACC,2BAAgB,CAACC,IAAI,CAAC,MAAMd,cAAcE;QACtDQ,MAAME,KAAK,CAAC,SAACG;YACXC,IAAAA,2BAAgB,EAACrB,UAAUO,WAAW,SAACM,KAAKS;gBAC1CR,WAAWQ;gBACXF,GAAGP;YACL;QACF;QACAE,MAAME,KAAK,CAACM,6BAAkB,CAACJ,IAAI,CAAC,MAAMZ,WAAWN,MAAM;YAAEuB,OAAO;YAAGC,MAAM;QAAK;QAClFV,MAAMW,KAAK,CAAC,SAACb;YACX,gHAAgH;YAChH,IAAMc,UAAUvB,aAAa,UAAUH,OAAOO,aAAI,CAACC,IAAI,CAACR,MAAM;YAC9D,IAAM2B,cAAcpB,aAAI,CAACC,IAAI,CAACkB,SAAS,gBAAgB;YACvDE,IAAAA,sBAAM,EAACD,aAAa;uBAAMzB,SAASU,KAAKC;;QAC1C;IACF;AACF"}
|
package/dist/cjs/lib/copyFile.js
CHANGED
|
@@ -9,8 +9,8 @@ Object.defineProperty(exports, "default", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
var _fscopycompat = require("fs-copy-compat");
|
|
12
|
+
var _fsremovecompat = require("fs-remove-compat");
|
|
12
13
|
var _queuecb = /*#__PURE__*/ _interop_require_default(require("queue-cb"));
|
|
13
|
-
var _rimraf2 = /*#__PURE__*/ _interop_require_default(require("rimraf2"));
|
|
14
14
|
var _ensureDestinationParentts = /*#__PURE__*/ _interop_require_default(require("./ensureDestinationParent.js"));
|
|
15
15
|
function _interop_require_default(obj) {
|
|
16
16
|
return obj && obj.__esModule ? obj : {
|
|
@@ -21,11 +21,7 @@ function safeCopyFile(src, dest, callback) {
|
|
|
21
21
|
var queue = new _queuecb.default(1);
|
|
22
22
|
queue.defer(_ensureDestinationParentts.default.bind(null, dest));
|
|
23
23
|
queue.defer(function(callback) {
|
|
24
|
-
(0,
|
|
25
|
-
disableGlob: true
|
|
26
|
-
}, function(err) {
|
|
27
|
-
err && err.code !== 'EEXIST' ? callback(err) : callback();
|
|
28
|
-
});
|
|
24
|
+
(0, _fsremovecompat.safeRm)(dest, callback);
|
|
29
25
|
});
|
|
30
26
|
queue.defer(_fscopycompat.copyFile.bind(null, src, dest));
|
|
31
27
|
queue.await(callback);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/copyFile.ts"],"sourcesContent":["import type { NoParamCallback } from 'fs';\nimport { copyFile } from 'fs-copy-compat';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/copyFile.ts"],"sourcesContent":["import type { NoParamCallback } from 'fs';\nimport { copyFile } from 'fs-copy-compat';\nimport { safeRm } from 'fs-remove-compat';\nimport Queue from 'queue-cb';\n\nimport ensureDestinationParent from './ensureDestinationParent.ts';\n\nexport default function safeCopyFile(src: string, dest: string, callback: NoParamCallback) {\n const queue = new Queue(1);\n\n queue.defer(ensureDestinationParent.bind(null, dest));\n queue.defer((callback) => {\n safeRm(dest, callback);\n });\n queue.defer(copyFile.bind(null, src, dest));\n queue.await(callback);\n}\n"],"names":["safeCopyFile","src","dest","callback","queue","Queue","defer","ensureDestinationParent","bind","safeRm","copyFile","await"],"mappings":";;;;+BAOA;;;eAAwBA;;;4BANC;8BACF;8DACL;gFAEkB;;;;;;AAErB,SAASA,aAAaC,GAAW,EAAEC,IAAY,EAAEC,QAAyB;IACvF,IAAMC,QAAQ,IAAIC,gBAAK,CAAC;IAExBD,MAAME,KAAK,CAACC,kCAAuB,CAACC,IAAI,CAAC,MAAMN;IAC/CE,MAAME,KAAK,CAAC,SAACH;QACXM,IAAAA,sBAAM,EAACP,MAAMC;IACf;IACAC,MAAME,KAAK,CAACI,sBAAQ,CAACF,IAAI,CAAC,MAAMP,KAAKC;IACrCE,MAAMO,KAAK,CAACR;AACd"}
|
package/dist/esm/cli.js
CHANGED
package/dist/esm/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/cli.ts"],"sourcesContent":["import exit from 'exit';\nimport fs from 'fs';\nimport getopts from 'getopts-compat';\nimport path from 'path';\nimport url from 'url';\nimport install, { type InstallOptions } from './index.ts';\n\nconst ERROR_CODE = 9;\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\n\nfunction getPackageVersion(): string {\n const packagePath = path.join(__dirname, '..', '..', 'package.json');\n const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));\n return packageJson.version;\n}\n\nfunction printHelp(name: string): void {\n const version = getPackageVersion();\n console.log(`${name} v${version}`);\n console.log('');\n console.log(`Usage: ${name} <version> [options]`);\n console.log('');\n console.log('Arguments:');\n console.log(' version Node.js version to install (e.g., 18.0.0, lts, stable)');\n console.log('');\n console.log('Options:');\n console.log(' -p, --platform Target platform (default: current platform)');\n console.log(' -a, --arch Target architecture (default: current architecture)');\n console.log(' -f, --filename Specific filename to download');\n console.log(' -i, --installPath Installation directory');\n console.log(' -c, --storagePath Cache storage directory');\n console.log(' -si, --silent Suppress output');\n console.log(' -v, --version Show version number');\n console.log(' -h, --help Show this help message');\n}\n\nexport default (argv: string[], name?: string): undefined => {\n const cliName = name || 'nir';\n const options = getopts(argv, {\n alias: { platform: 'p', arch: 'a', filename: 'f', installPath: 'i', storagePath: 'c', silent: 'si', version: 'v', help: 'h' },\n boolean: ['silent', 'version', 'help'],\n });\n\n if (options.version) {\n console.log(getPackageVersion());\n exit(0);\n return;\n }\n\n if (options.help) {\n printHelp(cliName);\n exit(0);\n return;\n }\n\n const args = options._;\n if (args.length < 1) {\n console.log(`Missing command. Example usage: ${cliName} <version> [directory]`);\n exit(ERROR_CODE);\n return;\n }\n install(args[0], options as InstallOptions, (err, result) => {\n if (!options.silent) {\n console.log('\\n======================');\n if (err) console.log(`${args[0]} not installed. Error: ${err.message}`);\n else console.log(`${result.version} installed in: ${result.installPath}`);\n console.log('======================');\n }\n exit(err ? ERROR_CODE : 0);\n });\n};\n"],"names":["exit","fs","getopts","path","url","install","ERROR_CODE","__dirname","dirname","__filename","fileURLToPath","getPackageVersion","packagePath","join","packageJson","JSON","parse","readFileSync","version","printHelp","name","console","log","argv","cliName","options","alias","platform","arch","filename","installPath","storagePath","silent","help","boolean","args","_","length","err","result","message"],"mappings":"AAAA,OAAOA,UAAU,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/cli.ts"],"sourcesContent":["import exit from 'exit-compat';\nimport fs from 'fs';\nimport getopts from 'getopts-compat';\nimport path from 'path';\nimport url from 'url';\nimport install, { type InstallOptions } from './index.ts';\n\nconst ERROR_CODE = 9;\nconst __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath(import.meta.url));\n\nfunction getPackageVersion(): string {\n const packagePath = path.join(__dirname, '..', '..', 'package.json');\n const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));\n return packageJson.version;\n}\n\nfunction printHelp(name: string): void {\n const version = getPackageVersion();\n console.log(`${name} v${version}`);\n console.log('');\n console.log(`Usage: ${name} <version> [options]`);\n console.log('');\n console.log('Arguments:');\n console.log(' version Node.js version to install (e.g., 18.0.0, lts, stable)');\n console.log('');\n console.log('Options:');\n console.log(' -p, --platform Target platform (default: current platform)');\n console.log(' -a, --arch Target architecture (default: current architecture)');\n console.log(' -f, --filename Specific filename to download');\n console.log(' -i, --installPath Installation directory');\n console.log(' -c, --storagePath Cache storage directory');\n console.log(' -si, --silent Suppress output');\n console.log(' -v, --version Show version number');\n console.log(' -h, --help Show this help message');\n}\n\nexport default (argv: string[], name?: string): undefined => {\n const cliName = name || 'nir';\n const options = getopts(argv, {\n alias: { platform: 'p', arch: 'a', filename: 'f', installPath: 'i', storagePath: 'c', silent: 'si', version: 'v', help: 'h' },\n boolean: ['silent', 'version', 'help'],\n });\n\n if (options.version) {\n console.log(getPackageVersion());\n exit(0);\n return;\n }\n\n if (options.help) {\n printHelp(cliName);\n exit(0);\n return;\n }\n\n const args = options._;\n if (args.length < 1) {\n console.log(`Missing command. Example usage: ${cliName} <version> [directory]`);\n exit(ERROR_CODE);\n return;\n }\n install(args[0], options as InstallOptions, (err, result) => {\n if (!options.silent) {\n console.log('\\n======================');\n if (err) console.log(`${args[0]} not installed. Error: ${err.message}`);\n else console.log(`${result.version} installed in: ${result.installPath}`);\n console.log('======================');\n }\n exit(err ? ERROR_CODE : 0);\n });\n};\n"],"names":["exit","fs","getopts","path","url","install","ERROR_CODE","__dirname","dirname","__filename","fileURLToPath","getPackageVersion","packagePath","join","packageJson","JSON","parse","readFileSync","version","printHelp","name","console","log","argv","cliName","options","alias","platform","arch","filename","installPath","storagePath","silent","help","boolean","args","_","length","err","result","message"],"mappings":"AAAA,OAAOA,UAAU,cAAc;AAC/B,OAAOC,QAAQ,KAAK;AACpB,OAAOC,aAAa,iBAAiB;AACrC,OAAOC,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AACtB,O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ChBd,UAAUK;QACVxB,KAAK;QACL;IACF;IAEA,MAAMmC,OAAOV,QAAQW,CAAC;IACtB,IAAID,KAAKE,MAAM,GAAG,GAAG;QACnBhB,QAAQC,GAAG,CAAC,CAAC,gCAAgC,EAAEE,QAAQ,sBAAsB,CAAC;QAC9ExB,KAAKM;QACL;IACF;IACAD,QAAQ8B,IAAI,CAAC,EAAE,EAAEV,SAA2B,CAACa,KAAKC;QAChD,IAAI,CAACd,QAAQO,MAAM,EAAE;YACnBX,QAAQC,GAAG,CAAC;YACZ,IAAIgB,KAAKjB,QAAQC,GAAG,CAAC,GAAGa,IAAI,CAAC,EAAE,CAAC,uBAAuB,EAAEG,IAAIE,OAAO,EAAE;iBACjEnB,QAAQC,GAAG,CAAC,GAAGiB,OAAOrB,OAAO,CAAC,eAAe,EAAEqB,OAAOT,WAAW,EAAE;YACxET,QAAQC,GAAG,CAAC;QACd;QACAtB,KAAKsC,MAAMhC,aAAa;IAC1B;AACF,CAAA,EAAE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
|
+
import { safeRm } from 'fs-remove-compat';
|
|
2
3
|
import path from 'path';
|
|
3
4
|
import Queue from 'queue-cb';
|
|
4
|
-
import rimraf2 from 'rimraf2';
|
|
5
5
|
import { NODE_DIST_BASE_URL } from '../constants.js';
|
|
6
6
|
import conditionalCache from '../lib/conditionalCache.js';
|
|
7
7
|
import conditionalExtract from '../lib/conditionalExtract.js';
|
|
@@ -29,9 +29,7 @@ export default function installCompressed(distPath, dest, options, callback) {
|
|
|
29
29
|
// some compressed versions of node come with npm pre-installed, but we want to override with a specific version
|
|
30
30
|
const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');
|
|
31
31
|
const installPath = path.join(libPath, 'node_modules', 'npm');
|
|
32
|
-
|
|
33
|
-
disableGlob: true
|
|
34
|
-
}, ()=>callback(err, checksum));
|
|
32
|
+
safeRm(installPath, ()=>callback(err, checksum));
|
|
35
33
|
});
|
|
36
34
|
});
|
|
37
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installCompressed.ts"],"sourcesContent":["import fs from 'fs';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/installCompressed.ts"],"sourcesContent":["import fs from 'fs';\nimport { safeRm } from 'fs-remove-compat';\nimport path from 'path';\nimport Queue from 'queue-cb';\n\nimport { NODE_DIST_BASE_URL } from '../constants.ts';\nimport conditionalCache from '../lib/conditionalCache.ts';\nimport conditionalExtract from '../lib/conditionalExtract.ts';\nimport type { ChecksumCallback, ChecksumResult, InstallOptions } from '../types.ts';\nimport validateDownload from './validateDownload.ts';\n\nexport default function installCompressed(distPath: string, dest: string, options: InstallOptions, callback: ChecksumCallback): undefined {\n const platform = options.platform;\n const downloadPath = `${NODE_DIST_BASE_URL}/${distPath}`;\n const cachePath = path.join(options.cachePath, path.basename(downloadPath));\n\n fs.stat(dest, (err) => {\n if (!err) return callback(); // already exists\n\n let checksum: ChecksumResult | undefined;\n const queue = new Queue(1);\n queue.defer(conditionalCache.bind(null, downloadPath, cachePath));\n queue.defer((cb) => {\n validateDownload(distPath, cachePath, (err, result) => {\n checksum = result;\n cb(err);\n });\n });\n queue.defer(conditionalExtract.bind(null, cachePath, dest, { strip: 1, time: 1000 }));\n queue.await((err) => {\n // some compressed versions of node come with npm pre-installed, but we want to override with a specific version\n const libPath = platform === 'win32' ? dest : path.join(dest, 'lib');\n const installPath = path.join(libPath, 'node_modules', 'npm');\n safeRm(installPath, () => callback(err, checksum));\n });\n });\n}\n"],"names":["fs","safeRm","path","Queue","NODE_DIST_BASE_URL","conditionalCache","conditionalExtract","validateDownload","installCompressed","distPath","dest","options","callback","platform","downloadPath","cachePath","join","basename","stat","err","checksum","queue","defer","bind","cb","result","strip","time","await","libPath","installPath"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,S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-remove-compat';
|
|
2
3
|
import Queue from 'queue-cb';
|
|
3
|
-
import rimraf2 from 'rimraf2';
|
|
4
4
|
import ensureDestinationParent from './ensureDestinationParent.js';
|
|
5
5
|
export default function safeCopyFile(src, dest, callback) {
|
|
6
6
|
const queue = new Queue(1);
|
|
7
7
|
queue.defer(ensureDestinationParent.bind(null, dest));
|
|
8
8
|
queue.defer((callback)=>{
|
|
9
|
-
|
|
10
|
-
disableGlob: true
|
|
11
|
-
}, (err)=>{
|
|
12
|
-
err && err.code !== 'EEXIST' ? callback(err) : callback();
|
|
13
|
-
});
|
|
9
|
+
safeRm(dest, callback);
|
|
14
10
|
});
|
|
15
11
|
queue.defer(copyFile.bind(null, src, dest));
|
|
16
12
|
queue.await(callback);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/copyFile.ts"],"sourcesContent":["import type { NoParamCallback } from 'fs';\nimport { copyFile } from 'fs-copy-compat';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/lib/copyFile.ts"],"sourcesContent":["import type { NoParamCallback } from 'fs';\nimport { copyFile } from 'fs-copy-compat';\nimport { safeRm } from 'fs-remove-compat';\nimport Queue from 'queue-cb';\n\nimport ensureDestinationParent from './ensureDestinationParent.ts';\n\nexport default function safeCopyFile(src: string, dest: string, callback: NoParamCallback) {\n const queue = new Queue(1);\n\n queue.defer(ensureDestinationParent.bind(null, dest));\n queue.defer((callback) => {\n safeRm(dest, callback);\n });\n queue.defer(copyFile.bind(null, src, dest));\n queue.await(callback);\n}\n"],"names":["copyFile","safeRm","Queue","ensureDestinationParent","safeCopyFile","src","dest","callback","queue","defer","bind","await"],"mappings":"AACA,SAASA,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,WAAW,WAAW;AAE7B,OAAOC,6BAA6B,+BAA+B;AAEnE,eAAe,SAASC,aAAaC,GAAW,EAAEC,IAAY,EAAEC,QAAyB;IACvF,MAAMC,QAAQ,IAAIN,MAAM;IAExBM,MAAMC,KAAK,CAACN,wBAAwBO,IAAI,CAAC,MAAMJ;IAC/CE,MAAMC,KAAK,CAAC,CAACF;QACXN,OAAOK,MAAMC;IACf;IACAC,MAAMC,KAAK,CAACT,SAASU,IAAI,CAAC,MAAML,KAAKC;IACrCE,MAAMG,KAAK,CAACJ;AACd"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-install-release",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.8",
|
|
4
4
|
"description": "Cross-platform solution for installing releases of Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -44,34 +44,34 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"cpu-arch": "^1.0.4",
|
|
47
|
-
"cross-spawn-cb": "
|
|
48
|
-
"exit": "
|
|
49
|
-
"fast-extract": "
|
|
50
|
-
"fs-copy-compat": "
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"node-
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
47
|
+
"cross-spawn-cb": "^2.4.10",
|
|
48
|
+
"exit-compat": "^1.0.0",
|
|
49
|
+
"fast-extract": "^1.8.13",
|
|
50
|
+
"fs-copy-compat": "^0.1.3",
|
|
51
|
+
"fs-remove-compat": "^0.2.1",
|
|
52
|
+
"get-remote": "^2.3.0",
|
|
53
|
+
"getopts-compat": "^2.2.6",
|
|
54
|
+
"homedir-polyfill": "^1.0.3",
|
|
55
|
+
"is-version": "^1.0.7",
|
|
56
|
+
"lodash.keys": "^4.2.0",
|
|
57
|
+
"mkdirp-classic": "^0.5.3",
|
|
58
|
+
"node-filename-to-dist-paths": "^1.3.11",
|
|
59
|
+
"node-resolve-versions": "^1.3.11",
|
|
60
|
+
"on-one": "^1.0.8",
|
|
61
|
+
"queue-cb": "^1.6.1"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@types/mocha": "
|
|
65
|
-
"@types/node": "
|
|
66
|
-
"cr": "
|
|
67
|
-
"lodash.find": "
|
|
68
|
-
"lodash.values": "
|
|
69
|
-
"node-version-compare": "
|
|
70
|
-
"node-version-use": "
|
|
71
|
-
"node-version-utils": "
|
|
72
|
-
"pinkie-promise": "
|
|
73
|
-
"ts-dev-stack": "
|
|
74
|
-
"tsds-config": "
|
|
64
|
+
"@types/mocha": "^10.0.10",
|
|
65
|
+
"@types/node": "^25.0.0",
|
|
66
|
+
"cr": "^0.1.0",
|
|
67
|
+
"lodash.find": "^4.6.0",
|
|
68
|
+
"lodash.values": "^4.3.0",
|
|
69
|
+
"node-version-compare": "^1.0.3",
|
|
70
|
+
"node-version-use": "^2.1.0",
|
|
71
|
+
"node-version-utils": "^1.3.15",
|
|
72
|
+
"pinkie-promise": "^2.0.1",
|
|
73
|
+
"ts-dev-stack": "^1.21.2",
|
|
74
|
+
"tsds-config": "^0.2.0"
|
|
75
75
|
},
|
|
76
76
|
"engines": {
|
|
77
77
|
"node": ">=0.8"
|