node-version-use 2.1.5 → 2.1.7
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/assets/installBinaries.cjs +284 -0
- package/assets/postinstall.cjs +11 -404
- package/dist/cjs/assets/installBinaries.cjs +284 -0
- package/dist/cjs/assets/installBinaries.cjs.map +1 -0
- package/dist/cjs/assets/installBinaries.d.cts +1 -0
- package/dist/cjs/assets/postinstall.cjs +11 -404
- package/dist/cjs/assets/postinstall.cjs.map +1 -1
- package/dist/cjs/commands/default.js.map +1 -1
- package/dist/cjs/commands/index.js +2 -3
- package/dist/cjs/commands/index.js.map +1 -1
- package/dist/cjs/commands/list.js.map +1 -1
- package/dist/cjs/commands/setup.js +23 -41
- package/dist/cjs/commands/setup.js.map +1 -1
- package/dist/cjs/commands/teardown.js +2 -1
- package/dist/cjs/commands/teardown.js.map +1 -1
- package/dist/cjs/commands/uninstall.js.map +1 -1
- package/dist/cjs/commands/which.js.map +1 -1
- package/dist/cjs/compat.d.cts +1 -0
- package/dist/cjs/compat.d.ts +1 -0
- package/dist/cjs/compat.js +11 -4
- package/dist/cjs/compat.js.map +1 -1
- package/dist/cjs/lib/findInstalledVersions.js.map +1 -1
- package/dist/esm/assets/installBinaries.cjs +282 -0
- package/dist/esm/assets/installBinaries.cjs.map +1 -0
- package/dist/esm/assets/installBinaries.d.cts +1 -0
- package/dist/esm/assets/postinstall.cjs +11 -404
- package/dist/esm/assets/postinstall.cjs.map +1 -1
- package/dist/esm/commands/default.js +8 -8
- package/dist/esm/commands/default.js.map +1 -1
- package/dist/esm/commands/index.js +2 -3
- package/dist/esm/commands/index.js.map +1 -1
- package/dist/esm/commands/list.js +3 -3
- package/dist/esm/commands/list.js.map +1 -1
- package/dist/esm/commands/setup.js +39 -57
- package/dist/esm/commands/setup.js.map +1 -1
- package/dist/esm/commands/teardown.js +2 -1
- package/dist/esm/commands/teardown.js.map +1 -1
- package/dist/esm/commands/uninstall.js +12 -12
- package/dist/esm/commands/uninstall.js.map +1 -1
- package/dist/esm/commands/which.js +5 -5
- package/dist/esm/commands/which.js.map +1 -1
- package/dist/esm/compat.d.ts +1 -0
- package/dist/esm/compat.js +17 -13
- package/dist/esm/compat.js.map +1 -1
- package/dist/esm/lib/findInstalledVersions.js +19 -19
- package/dist/esm/lib/findInstalledVersions.js.map +1 -1
- package/package.json +24 -19
|
@@ -13,11 +13,11 @@ Object.defineProperty(exports, /**
|
|
|
13
13
|
return setupCmd;
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
var _child_process = require("child_process");
|
|
17
16
|
var _exitcompat = /*#__PURE__*/ _interop_require_default(require("exit-compat"));
|
|
18
17
|
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
18
|
+
var _getoptscompat = /*#__PURE__*/ _interop_require_default(require("getopts-compat"));
|
|
19
|
+
var _module = /*#__PURE__*/ _interop_require_default(require("module"));
|
|
19
20
|
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
20
|
-
var _url = /*#__PURE__*/ _interop_require_default(require("url"));
|
|
21
21
|
var _compatts = require("../compat.js");
|
|
22
22
|
var _constantsts = require("../constants.js");
|
|
23
23
|
var _findInstalledVersionsts = require("../lib/findInstalledVersions.js");
|
|
@@ -26,44 +26,28 @@ function _interop_require_default(obj) {
|
|
|
26
26
|
default: obj
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
var
|
|
29
|
+
var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
|
|
30
|
+
var _require1 = _require('../assets/installBinaries.cjs'), installBinaries = _require1.installBinaries, printInstructions = _require1.printInstructions;
|
|
30
31
|
function setupCmd(args) {
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
for(var i = 0; i < args.length; i++){
|
|
42
|
-
if (args[i] === '--shims') {
|
|
43
|
-
hasShimsFlag = true;
|
|
44
|
-
break;
|
|
32
|
+
var options = (0, _getoptscompat.default)(args, {
|
|
33
|
+
boolean: [
|
|
34
|
+
'force'
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
installBinaries(options, function(err, installed) {
|
|
38
|
+
if (err) {
|
|
39
|
+
console.error("Setup failed: ".concat(err.message || err));
|
|
40
|
+
(0, _exitcompat.default)(1);
|
|
41
|
+
return;
|
|
45
42
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
var postinstallPath = _path.default.join(__dirname, '..', '..', '..', 'scripts', 'postinstall.cjs');
|
|
53
|
-
if (_fs.default.existsSync(postinstallPath)) {
|
|
54
|
-
// Run the postinstall script
|
|
55
|
-
try {
|
|
56
|
-
(0, _child_process.execSync)('node "'.concat(postinstallPath, '"'), {
|
|
57
|
-
stdio: 'inherit'
|
|
58
|
-
});
|
|
59
|
-
} catch (_err) {
|
|
60
|
-
// postinstall handles its own errors gracefully
|
|
43
|
+
printInstructions();
|
|
44
|
+
if (!installed) console.log('Use --force to reinstall.');
|
|
45
|
+
if (options.force) {
|
|
46
|
+
var binDir = _path.default.join(_constantsts.storagePath, 'bin');
|
|
47
|
+
createShimsForGlobalPackages(binDir);
|
|
48
|
+
return;
|
|
61
49
|
}
|
|
62
|
-
}
|
|
63
|
-
console.log('Setup script not found.');
|
|
64
|
-
console.log('Try reinstalling: npm install -g node-version-use');
|
|
65
|
-
(0, _exitcompat.default)(1);
|
|
66
|
-
}
|
|
50
|
+
});
|
|
67
51
|
}
|
|
68
52
|
/**
|
|
69
53
|
* Create shims for all global packages in the default Node version
|
|
@@ -107,9 +91,7 @@ function setupCmd(args) {
|
|
|
107
91
|
var entry = entries[i];
|
|
108
92
|
var name = entry.name;
|
|
109
93
|
// Skip our routing shims (node/npm/npx) - don't overwrite them
|
|
110
|
-
if (name === 'node' || name === 'npm' || name === 'npx')
|
|
111
|
-
continue;
|
|
112
|
-
}
|
|
94
|
+
if (name === 'node' || name === 'npm' || name === 'npx') continue;
|
|
113
95
|
var shimPath = _path.default.join(binDir, name);
|
|
114
96
|
// Skip if shim already exists
|
|
115
97
|
if (_fs.default.existsSync(shimPath)) {
|
|
@@ -128,7 +110,7 @@ function setupCmd(args) {
|
|
|
128
110
|
}
|
|
129
111
|
}
|
|
130
112
|
console.log('');
|
|
131
|
-
console.log("Done. Created ".concat(created, " shims, skipped ").concat(skipped, " (already
|
|
113
|
+
console.log("Done. Created ".concat(created, " shims, skipped ").concat(skipped, " (already exists)."));
|
|
132
114
|
(0, _exitcompat.default)(0);
|
|
133
115
|
}
|
|
134
116
|
/* 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/commands/setup.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/commands/setup.ts"],"sourcesContent":["import exit from 'exit-compat';\nimport fs from 'fs';\nimport getopts from 'getopts-compat';\nimport Module from 'module';\nimport path from 'path';\nimport { readdirWithTypes } from '../compat.ts';\nimport { storagePath } from '../constants.ts';\nimport { findInstalledVersions } from '../lib/findInstalledVersions.ts';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst { installBinaries, printInstructions } = _require('../assets/installBinaries.cjs');\n\n/**\n * nvu setup [--shims]\n *\n * Install/reinstall nvu binaries to ~/.nvu/bin\n * With --shims: create shims for existing global packages\n */\nexport default function setupCmd(args: string[]): void {\n const options = getopts(args, { boolean: ['force'] });\n\n installBinaries(options, (err, installed) => {\n if (err) {\n console.error(`Setup failed: ${err.message || err}`);\n exit(1);\n return;\n }\n\n printInstructions();\n if (!installed) console.log('Use --force to reinstall.');\n\n if (options.force) {\n const binDir = path.join(storagePath, 'bin');\n createShimsForGlobalPackages(binDir);\n return;\n }\n });\n}\n\n/**\n * Create shims for all global packages in the default Node version\n */\nfunction createShimsForGlobalPackages(binDir: string): void {\n // Read default version\n const defaultPath = path.join(storagePath, 'default');\n if (!fs.existsSync(defaultPath)) {\n console.log('No default Node version set.');\n console.log('Set one with: nvu default <version>');\n exit(1);\n return;\n }\n\n const defaultVersion = fs.readFileSync(defaultPath, 'utf8').trim();\n const versionsDir = path.join(storagePath, 'installed');\n\n // Resolve to exact version\n const matches = findInstalledVersions(versionsDir, defaultVersion);\n if (matches.length === 0) {\n console.log(`Default version ${defaultVersion} is not installed.`);\n exit(1);\n return;\n }\n\n const resolvedVersion = matches[matches.length - 1];\n const nodeBinDir = path.join(versionsDir, resolvedVersion, 'bin');\n\n if (!fs.existsSync(nodeBinDir)) {\n console.log(`No bin directory found for ${resolvedVersion}`);\n exit(1);\n return;\n }\n\n // Get the node shim to copy from\n const nodeShim = path.join(binDir, 'node');\n if (!fs.existsSync(nodeShim)) {\n console.log('Node shim not found. Run: nvu setup');\n exit(1);\n return;\n }\n\n // Scan binaries in Node's bin directory\n const entries = readdirWithTypes(nodeBinDir);\n let created = 0;\n let skipped = 0;\n\n for (let i = 0; i < entries.length; i++) {\n const entry = entries[i];\n const name = entry.name;\n\n // Skip our routing shims (node/npm/npx) - don't overwrite them\n if (name === 'node' || name === 'npm' || name === 'npx') continue;\n const shimPath = path.join(binDir, name);\n\n // Skip if shim already exists\n if (fs.existsSync(shimPath)) {\n skipped++;\n continue;\n }\n\n // Copy the node shim\n try {\n const shimContent = fs.readFileSync(nodeShim);\n fs.writeFileSync(shimPath, shimContent);\n fs.chmodSync(shimPath, 493); // 0755\n console.log(`Created shim: ${name}`);\n created++;\n } catch (err) {\n console.error(`Failed to create shim for ${name}: ${(err as Error).message}`);\n }\n }\n\n console.log('');\n console.log(`Done. Created ${created} shims, skipped ${skipped} (already exists).`);\n exit(0);\n}\n"],"names":["setupCmd","_require","require","Module","createRequire","installBinaries","printInstructions","args","options","getopts","boolean","err","installed","console","error","message","exit","log","force","binDir","path","join","storagePath","createShimsForGlobalPackages","defaultPath","fs","existsSync","defaultVersion","readFileSync","trim","versionsDir","matches","findInstalledVersions","length","resolvedVersion","nodeBinDir","nodeShim","entries","readdirWithTypes","created","skipped","i","entry","name","shimPath","shimContent","writeFileSync","chmodSync"],"mappings":";;;;+BAYA;;;;;CAKC,GACD;;;eAAwBA;;;iEAlBP;yDACF;oEACK;6DACD;2DACF;wBACgB;2BACL;uCACU;;;;;;AAEtC,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAA+CD,YAAAA,SAAS,kCAAhDI,kBAAuCJ,UAAvCI,iBAAiBC,oBAAsBL,UAAtBK;AAQV,SAASN,SAASO,IAAc;IAC7C,IAAMC,UAAUC,IAAAA,sBAAO,EAACF,MAAM;QAAEG,SAAS;YAAC;SAAQ;IAAC;IAEnDL,gBAAgBG,SAAS,SAACG,KAAKC;QAC7B,IAAID,KAAK;YACPE,QAAQC,KAAK,CAAC,AAAC,iBAAmC,OAAnBH,IAAII,OAAO,IAAIJ;YAC9CK,IAAAA,mBAAI,EAAC;YACL;QACF;QAEAV;QACA,IAAI,CAACM,WAAWC,QAAQI,GAAG,CAAC;QAE5B,IAAIT,QAAQU,KAAK,EAAE;YACjB,IAAMC,SAASC,aAAI,CAACC,IAAI,CAACC,wBAAW,EAAE;YACtCC,6BAA6BJ;YAC7B;QACF;IACF;AACF;AAEA;;CAEC,GACD,SAASI,6BAA6BJ,MAAc;IAClD,uBAAuB;IACvB,IAAMK,cAAcJ,aAAI,CAACC,IAAI,CAACC,wBAAW,EAAE;IAC3C,IAAI,CAACG,WAAE,CAACC,UAAU,CAACF,cAAc;QAC/BX,QAAQI,GAAG,CAAC;QACZJ,QAAQI,GAAG,CAAC;QACZ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;QACF;QAEA,qBAAqB;QACrB,IAAI;YACF,IAAMK,cAAcpB,WAAE,CAACG,YAAY,CAACQ;YACpCX,WAAE,CAACqB,aAAa,CAACF,UAAUC;YAC3BpB,WAAE,CAACsB,SAAS,CAACH,UAAU,MAAM,OAAO;YACpC/B,QAAQI,GAAG,CAAC,AAAC,iBAAqB,OAAL0B;YAC7BJ;QACF,EAAE,OAAO5B,KAAK;YACZE,QAAQC,KAAK,CAAC,AAAC,6BAAqC,OAAT6B,MAAK,MAA2B,OAAvB,AAAChC,IAAcI,OAAO;QAC5E;IACF;IAEAF,QAAQI,GAAG,CAAC;IACZJ,QAAQI,GAAG,CAAC,AAAC,iBAA0CuB,OAA1BD,SAAQ,oBAA0B,OAARC,SAAQ;IAC/DxB,IAAAA,mBAAI,EAAC;AACP"}
|
|
@@ -22,6 +22,7 @@ function _interop_require_default(obj) {
|
|
|
22
22
|
default: obj
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
+
var isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);
|
|
25
26
|
function teardownCmd(_args) {
|
|
26
27
|
var binDir = _path.default.join(_constantsts.storagePath, 'bin');
|
|
27
28
|
var binaries = [
|
|
@@ -29,7 +30,7 @@ function teardownCmd(_args) {
|
|
|
29
30
|
'npm',
|
|
30
31
|
'npx'
|
|
31
32
|
];
|
|
32
|
-
var ext =
|
|
33
|
+
var ext = isWindows ? '.exe' : '';
|
|
33
34
|
var removed = 0;
|
|
34
35
|
for(var i = 0; i < binaries.length; i++){
|
|
35
36
|
var binaryPath = _path.default.join(binDir, binaries[i] + ext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/commands/teardown.ts"],"sourcesContent":["import exit from 'exit-compat';\nimport fs from 'fs';\nimport { rmSync } from 'fs-remove-compat';\nimport path from 'path';\nimport { storagePath } from '../constants.ts';\n\n/**\n * nvu teardown\n *\n * Remove nvu binaries from ~/.nvu/bin\n */\nexport default function teardownCmd(_args: string[]): void {\n const binDir = path.join(storagePath, 'bin');\n\n const binaries = ['node', 'npm', 'npx'];\n const ext =
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/commands/teardown.ts"],"sourcesContent":["import exit from 'exit-compat';\nimport fs from 'fs';\nimport { rmSync } from 'fs-remove-compat';\nimport path from 'path';\nimport { storagePath } from '../constants.ts';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\n/**\n * nvu teardown\n *\n * Remove nvu binaries from ~/.nvu/bin\n */\nexport default function teardownCmd(_args: string[]): void {\n const binDir = path.join(storagePath, 'bin');\n\n const binaries = ['node', 'npm', 'npx'];\n const ext = isWindows ? '.exe' : '';\n\n let removed = 0;\n for (let i = 0; i < binaries.length; i++) {\n const binaryPath = path.join(binDir, binaries[i] + ext);\n if (fs.existsSync(binaryPath)) {\n rmSync(binaryPath, { force: true });\n removed++;\n }\n }\n\n if (removed > 0) {\n console.log(`Removed ${removed} binary(s) from ${binDir}`);\n console.log('');\n console.log('You may also want to remove ~/.nvu/bin from your PATH.');\n } else {\n console.log('No binaries found to remove.');\n }\n\n exit(0);\n}\n"],"names":["teardownCmd","isWindows","process","platform","test","env","OSTYPE","_args","binDir","path","join","storagePath","binaries","ext","removed","i","length","binaryPath","fs","existsSync","rmSync","force","console","log","exit"],"mappings":";;;;+BAQA;;;;CAIC,GACD;;;eAAwBA;;;iEAbP;yDACF;8BACQ;2DACN;2BACW;;;;;;AAE5B,IAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAO5E,SAASN,YAAYO,KAAe;IACjD,IAAMC,SAASC,aAAI,CAACC,IAAI,CAACC,wBAAW,EAAE;IAEtC,IAAMC,WAAW;QAAC;QAAQ;QAAO;KAAM;IACvC,IAAMC,MAAMZ,YAAY,SAAS;IAEjC,IAAIa,UAAU;IACd,IAAK,IAAIC,IAAI,GAAGA,IAAIH,SAASI,MAAM,EAAED,IAAK;QACxC,IAAME,aAAaR,aAAI,CAACC,IAAI,CAACF,QAAQI,QAAQ,CAACG,EAAE,GAAGF;QACnD,IAAIK,WAAE,CAACC,UAAU,CAACF,aAAa;YAC7BG,IAAAA,sBAAM,EAACH,YAAY;gBAAEI,OAAO;YAAK;YACjCP;QACF;IACF;IAEA,IAAIA,UAAU,GAAG;QACfQ,QAAQC,GAAG,CAAC,AAAC,WAAoCf,OAA1BM,SAAQ,oBAAyB,OAAPN;QACjDc,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;IACd,OAAO;QACLD,QAAQC,GAAG,CAAC;IACd;IAEAC,IAAAA,mBAAI,EAAC;AACP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/commands/uninstall.ts"],"sourcesContent":["import exit from 'exit-compat';\nimport fs from 'fs';\nimport path from 'path';\nimport { rmSync } from '../compat.ts';\nimport { storagePath } from '../constants.ts';\nimport { findInstalledVersions, getAllInstalledVersions } from '../lib/findInstalledVersions.ts';\n\n/**\n * nvu uninstall <version>\n *\n * Remove an installed Node version.\n */\nexport default function uninstallCmd(args: string[]): void {\n if (args.length === 0) {\n console.log('Usage: nvu uninstall <version>');\n console.log('Example: nvu uninstall 20');\n console.log(' nvu uninstall v20.19.6');\n exit(1);\n return;\n }\n\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/commands/uninstall.ts"],"sourcesContent":["import exit from 'exit-compat';\nimport fs from 'fs';\nimport path from 'path';\nimport { rmSync } from '../compat.ts';\nimport { storagePath } from '../constants.ts';\nimport { findInstalledVersions, getAllInstalledVersions } from '../lib/findInstalledVersions.ts';\n\n/**\n * nvu uninstall <version>\n *\n * Remove an installed Node version.\n */\nexport default function uninstallCmd(args: string[]): void {\n if (args.length === 0) {\n console.log('Usage: nvu uninstall <version>');\n console.log('Example: nvu uninstall 20');\n console.log(' nvu uninstall v20.19.6');\n exit(1);\n return;\n }\n\n const version = args[0].trim();\n const versionsPath = path.join(storagePath, 'installed');\n\n // Find all matching installed versions\n const matches = findInstalledVersions(versionsPath, version);\n\n if (matches.length === 0) {\n console.log(`Node ${version} is not installed.`);\n console.log('');\n console.log('Installed versions:');\n listInstalledVersions(versionsPath);\n exit(1);\n return;\n }\n\n if (matches.length > 1) {\n console.log(`Multiple versions match \"${version}\":`);\n for (let i = 0; i < matches.length; i++) {\n console.log(` ${matches[i]}`);\n }\n console.log('');\n console.log('Please specify the exact version to uninstall.');\n exit(1);\n return;\n }\n\n const installedVersion = matches[0];\n const versionPath = path.join(versionsPath, installedVersion);\n\n // Check if this is the current default (exact match since we store exact versions)\n const defaultPath = path.join(storagePath, 'default');\n if (fs.existsSync(defaultPath)) {\n const defaultVersion = fs.readFileSync(defaultPath, 'utf8').trim();\n\n // Normalize both for comparison\n const normalizedDefault = defaultVersion.replace(/^v/, '');\n const normalizedInstalled = installedVersion.replace(/^v/, '');\n\n if (normalizedInstalled === normalizedDefault) {\n console.error(`Cannot uninstall default version ${installedVersion}.`);\n console.error('');\n console.error('Change your default first:');\n console.error(' nvu default <version>');\n exit(1);\n return;\n }\n }\n\n // Remove the version directory\n try {\n rmSync(versionPath);\n console.log(`Removed Node ${installedVersion}`);\n } catch (err) {\n console.error(`Failed to remove Node ${installedVersion}:`, (err as Error).message);\n exit(1);\n return;\n }\n\n exit(0);\n}\n\n/**\n * List installed versions for user reference\n */\nfunction listInstalledVersions(versionsPath: string): void {\n const versions = getAllInstalledVersions(versionsPath);\n\n if (versions.length === 0) {\n console.log(' (none)');\n } else {\n for (let i = 0; i < versions.length; i++) {\n console.log(` ${versions[i]}`);\n }\n }\n}\n"],"names":["uninstallCmd","args","length","console","log","exit","version","trim","versionsPath","path","join","storagePath","matches","findInstalledVersions","listInstalledVersions","i","installedVersion","versionPath","defaultPath","fs","existsSync","defaultVersion","readFileSync","normalizedDefault","replace","normalizedInstalled","error","rmSync","err","message","versions","getAllInstalledVersions"],"mappings":";;;;+BAOA;;;;CAIC,GACD;;;eAAwBA;;;iEAZP;yDACF;2DACE;wBACM;2BACK;uCACmC;;;;;;AAOhD,SAASA,aAAaC,IAAc;IACjD,IAAIA,KAAKC,MAAM,KAAK,GAAG;QACrBC,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZC,IAAAA,mBAAI,EAAC;QACL;IACF;IAEA,IAAMC,UAAUL,IAAI,CAAC,EAAE,CAACM,IAAI;IAC5B,IAAMC,eAAeC,aAAI,CAACC,IAAI,CAACC,wBAAW,EAAE;IAE5C,uCAAuC;IACvC,IAAMC,UAAUC,IAAAA,8CAAqB,EAACL,cAAcF;IAEpD,IAAIM,QAAQV,MAAM,KAAK,GAAG;QACxBC,QAAQC,GAAG,CAAC,AAAC,QAAe,OAARE,SAAQ;QAC5BH,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZU,sBAAsBN;QACtBH,IAAAA,mBAAI,EAAC;QACL;IACF;IAEA,IAAIO,QAAQV,MAAM,GAAG,GAAG;QACtBC,QAAQC,GAAG,CAAC,AAAC,4BAAmC,OAARE,SAAQ;QAChD,IAAK,IAAIS,IAAI,GAAGA,IAAIH,QAAQV,MAAM,EAAEa,IAAK;YACvCZ,QAAQC,GAAG,CAAC,AAAC,KAAe,OAAXQ,OAAO,CAACG,EAAE;QAC7B;QACAZ,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZC,IAAAA,mBAAI,EAAC;QACL;IACF;IAEA,IAAMW,mBAAmBJ,OAAO,CAAC,EAAE;IACnC,IAAMK,cAAcR,aAAI,CAACC,IAAI,CAACF,cAAcQ;IAE5C,mFAAmF;IACnF,IAAME,cAAcT,aAAI,CAACC,IAAI,CAACC,wBAAW,EAAE;IAC3C,IAAIQ,WAAE,CAACC,UAAU,CAACF,cAAc;QAC9B,IAAMG,iBAAiBF,WAAE,CAACG,YAAY,CAACJ,aAAa,QAAQX,IAAI;QAEhE,gCAAgC;QAChC,IAAMgB,oBAAoBF,eAAeG,OAAO,CAAC,MAAM;QACvD,IAAMC,sBAAsBT,iBAAiBQ,OAAO,CAAC,MAAM;QAE3D,IAAIC,wBAAwBF,mBAAmB;YAC7CpB,QAAQuB,KAAK,CAAC,AAAC,oCAAoD,OAAjBV,kBAAiB;YACnEb,QAAQuB,KAAK,CAAC;YACdvB,QAAQuB,KAAK,CAAC;YACdvB,QAAQuB,KAAK,CAAC;YACdrB,IAAAA,mBAAI,EAAC;YACL;QACF;IACF;IAEA,+BAA+B;IAC/B,IAAI;QACFsB,IAAAA,gBAAM,EAACV;QACPd,QAAQC,GAAG,CAAC,AAAC,gBAAgC,OAAjBY;IAC9B,EAAE,OAAOY,KAAK;QACZzB,QAAQuB,KAAK,CAAC,AAAC,yBAAyC,OAAjBV,kBAAiB,MAAI,AAACY,IAAcC,OAAO;QAClFxB,IAAAA,mBAAI,EAAC;QACL;IACF;IAEAA,IAAAA,mBAAI,EAAC;AACP;AAEA;;CAEC,GACD,SAASS,sBAAsBN,YAAoB;IACjD,IAAMsB,WAAWC,IAAAA,gDAAuB,EAACvB;IAEzC,IAAIsB,SAAS5B,MAAM,KAAK,GAAG;QACzBC,QAAQC,GAAG,CAAC;IACd,OAAO;QACL,IAAK,IAAIW,IAAI,GAAGA,IAAIe,SAAS5B,MAAM,EAAEa,IAAK;YACxCZ,QAAQC,GAAG,CAAC,AAAC,KAAgB,OAAZ0B,QAAQ,CAACf,EAAE;QAC9B;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/commands/which.ts"],"sourcesContent":["import exit from 'exit-compat';\nimport fs from 'fs';\nimport path from 'path';\nimport { storagePath } from '../constants.ts';\nimport { findInstalledVersions } from '../lib/findInstalledVersions.ts';\n\n/**\n * nvu which\n *\n * Show which Node binary would be used based on current directory.\n * This simulates what the nvu binary would do.\n */\nexport default function whichCmd(_args: string[]): void {\n const cwd = process.cwd();\n\n // Resolve version using the same logic as the nvu binary\n const version = resolveVersion(cwd);\n\n if (!version) {\n console.log('No Node version configured for this directory.');\n console.log('');\n console.log('To configure a version:');\n console.log(' nvu local <version> - Set version for this project');\n console.log(' nvu default <version> - Set global default');\n exit(1);\n return;\n }\n\n // Resolve partial version to exact installed version\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/commands/which.ts"],"sourcesContent":["import exit from 'exit-compat';\nimport fs from 'fs';\nimport path from 'path';\nimport { storagePath } from '../constants.ts';\nimport { findInstalledVersions } from '../lib/findInstalledVersions.ts';\n\n/**\n * nvu which\n *\n * Show which Node binary would be used based on current directory.\n * This simulates what the nvu binary would do.\n */\nexport default function whichCmd(_args: string[]): void {\n const cwd = process.cwd();\n\n // Resolve version using the same logic as the nvu binary\n const version = resolveVersion(cwd);\n\n if (!version) {\n console.log('No Node version configured for this directory.');\n console.log('');\n console.log('To configure a version:');\n console.log(' nvu local <version> - Set version for this project');\n console.log(' nvu default <version> - Set global default');\n exit(1);\n return;\n }\n\n // Resolve partial version to exact installed version\n const versionsPath = path.join(storagePath, 'installed');\n const matches = findInstalledVersions(versionsPath, version);\n const resolvedVersion = matches.length > 0 ? matches[matches.length - 1] : null;\n\n // Display version (show resolution if different)\n if (resolvedVersion && resolvedVersion !== version && resolvedVersion !== `v${version}`) {\n console.log(`Version: ${version} \\u2192 ${resolvedVersion}`);\n } else {\n console.log(`Version: ${resolvedVersion || version}`);\n }\n console.log(`Source: ${getVersionSource(cwd)}`);\n\n if (resolvedVersion) {\n const actualVersionPath = path.join(versionsPath, resolvedVersion);\n const nodePath = path.join(actualVersionPath, 'bin', 'node');\n console.log(`Binary: ${nodePath}`);\n if (fs.existsSync(nodePath)) {\n console.log('Status: Installed');\n } else {\n console.log('Status: Directory exists but binary not found');\n }\n } else {\n console.log(`Status: Not installed (run: nvu install ${version})`);\n }\n\n exit(0);\n}\n\n/**\n * Resolve version from config files (mirrors nvu binary logic)\n */\nfunction resolveVersion(cwd: string): string | null {\n // Walk up directories looking for .nvurc or .nvmrc\n let dir = cwd;\n while (true) {\n // Check .nvurc first\n const nvurcPath = path.join(dir, '.nvurc');\n if (fs.existsSync(nvurcPath)) {\n return fs.readFileSync(nvurcPath, 'utf8').trim();\n }\n\n // Check .nvmrc\n const nvmrcPath = path.join(dir, '.nvmrc');\n if (fs.existsSync(nvmrcPath)) {\n return fs.readFileSync(nvmrcPath, 'utf8').trim();\n }\n\n // Move to parent\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n\n // Check global default\n const defaultPath = path.join(storagePath, 'default');\n if (fs.existsSync(defaultPath)) {\n return fs.readFileSync(defaultPath, 'utf8').trim();\n }\n\n return null;\n}\n\n/**\n * Determine the source of the version (for display)\n */\nfunction getVersionSource(cwd: string): string {\n let dir = cwd;\n while (true) {\n const nvurcPath = path.join(dir, '.nvurc');\n if (fs.existsSync(nvurcPath)) {\n return nvurcPath;\n }\n\n const nvmrcPath = path.join(dir, '.nvmrc');\n if (fs.existsSync(nvmrcPath)) {\n return nvmrcPath;\n }\n\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n\n const defaultPath = path.join(storagePath, 'default');\n if (fs.existsSync(defaultPath)) {\n return `${defaultPath} (global default)`;\n }\n\n return 'none';\n}\n"],"names":["whichCmd","_args","cwd","process","version","resolveVersion","console","log","exit","versionsPath","path","join","storagePath","matches","findInstalledVersions","resolvedVersion","length","getVersionSource","actualVersionPath","nodePath","fs","existsSync","dir","nvurcPath","readFileSync","trim","nvmrcPath","parent","dirname","defaultPath"],"mappings":";;;;+BAMA;;;;;CAKC,GACD;;;eAAwBA;;;iEAZP;yDACF;2DACE;2BACW;uCACU;;;;;;AAQvB,SAASA,SAASC,KAAe;IAC9C,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AACT"}
|
package/dist/cjs/compat.d.cts
CHANGED
package/dist/cjs/compat.d.ts
CHANGED
package/dist/cjs/compat.js
CHANGED
|
@@ -26,6 +26,9 @@ _export(exports, {
|
|
|
26
26
|
},
|
|
27
27
|
get stringEndsWith () {
|
|
28
28
|
return stringEndsWith;
|
|
29
|
+
},
|
|
30
|
+
get tmpdir () {
|
|
31
|
+
return tmpdir;
|
|
29
32
|
}
|
|
30
33
|
});
|
|
31
34
|
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
@@ -41,12 +44,16 @@ function _interop_require_default(obj) {
|
|
|
41
44
|
var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
|
|
42
45
|
var hasHomedir = typeof _os.default.homedir === 'function';
|
|
43
46
|
function homedir() {
|
|
44
|
-
if (hasHomedir)
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
var home = _require('homedir-polyfill');
|
|
47
|
+
if (hasHomedir) return _os.default.homedir();
|
|
48
|
+
var home = require('homedir-polyfill');
|
|
48
49
|
return home();
|
|
49
50
|
}
|
|
51
|
+
var hasTmpdir = typeof _os.default.tmpdir === 'function';
|
|
52
|
+
function tmpdir() {
|
|
53
|
+
if (hasTmpdir) return _os.default.tmpdir();
|
|
54
|
+
var osShim = require('os-shim');
|
|
55
|
+
return osShim.tmpdir();
|
|
56
|
+
}
|
|
50
57
|
/**
|
|
51
58
|
* String.prototype.endsWith wrapper for Node.js 0.8+
|
|
52
59
|
* - Uses native endsWith on Node 4.0+ / ES2015+
|
package/dist/cjs/compat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/compat.ts"],"sourcesContent":["/**\n * Compatibility Layer for Node.js 0.8+\n * Local to this package - contains only needed functions.\n */\nimport fs from 'fs';\nimport _Module from 'module';\nimport os from 'os';\nimport path from 'path';\n\n// Use existing require in CJS, or createRequire in ESM (Node 12.2+)\
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/compat.ts"],"sourcesContent":["/**\n * Compatibility Layer for Node.js 0.8+\n * Local to this package - contains only needed functions.\n */\nimport fs from 'fs';\nimport _Module from 'module';\nimport os from 'os';\nimport path from 'path';\n\n// Use existing require in CJS, or createRequire in ESM (Node 12.2+)\nconst _require = typeof require === 'undefined' ? _Module.createRequire(import.meta.url) : require;\n\nconst hasHomedir = typeof os.homedir === 'function';\nexport function homedir(): string {\n if (hasHomedir) return os.homedir();\n const home = require('homedir-polyfill');\n return home();\n}\n\nconst hasTmpdir = typeof os.tmpdir === 'function';\nexport function tmpdir(): string {\n if (hasTmpdir) return os.tmpdir();\n const osShim = require('os-shim');\n return osShim.tmpdir();\n}\n\n/**\n * String.prototype.endsWith wrapper for Node.js 0.8+\n * - Uses native endsWith on Node 4.0+ / ES2015+\n * - Falls back to lastIndexOf on Node 0.8-3.x\n */\nconst hasEndsWith = typeof String.prototype.endsWith === 'function';\n\nexport function stringEndsWith(str: string, search: string, position?: number): boolean {\n if (hasEndsWith) {\n return str.endsWith(search, position);\n }\n const len = position === undefined ? str.length : position;\n return str.lastIndexOf(search) === len - search.length;\n}\n\n/**\n * Recursive mkdir for Node.js 0.8+\n */\nexport function mkdirpSync(dir: string): void {\n const mkdirp = _require('mkdirp-classic');\n mkdirp.sync(dir);\n}\n\n/**\n * Recursive rm for Node.js 0.8+\n */\nexport function rmSync(dir: string): void {\n const safeRmSync = _require('fs-remove-compat').safeRmSync;\n safeRmSync(dir);\n}\n\n/**\n * Read directory entries with types for Node.js 0.8+\n * Returns array of {name, isDirectory()}\n */\nexport interface DirEntry {\n name: string;\n isDirectory(): boolean;\n}\n\nexport function readdirWithTypes(dir: string): DirEntry[] {\n const names = fs.readdirSync(dir);\n return names.map((name) => {\n const fullPath = path.join(dir, name);\n let stat: fs.Stats;\n try {\n stat = fs.statSync(fullPath);\n } catch (_e) {\n // If stat fails, treat as non-directory\n return { name: name, isDirectory: () => false };\n }\n return {\n name: name,\n isDirectory: () => stat.isDirectory(),\n };\n });\n}\n"],"names":["homedir","mkdirpSync","readdirWithTypes","rmSync","stringEndsWith","tmpdir","_require","require","_Module","createRequire","hasHomedir","os","home","hasTmpdir","osShim","hasEndsWith","String","prototype","endsWith","str","search","position","len","undefined","length","lastIndexOf","dir","mkdirp","sync","safeRmSync","names","fs","readdirSync","map","name","fullPath","path","join","stat","statSync","_e","isDirectory"],"mappings":"AAAA;;;CAGC;;;;;;;;;;;QAUeA;eAAAA;;QA+BAC;eAAAA;;QAsBAC;eAAAA;;QAdAC;eAAAA;;QAnBAC;eAAAA;;QAbAC;eAAAA;;;yDAhBD;6DACK;yDACL;2DACE;;;;;;AAEjB,oEAAoE;AACpE,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAO,CAACC,aAAa,CAAC,uDAAmBF;AAE3F,IAAMG,aAAa,OAAOC,WAAE,CAACX,OAAO,KAAK;AAClC,SAASA;IACd,IAAIU,YAAY,OAAOC,WAAE,CAACX,OAAO;IACjC,IAAMY,OAAOL,QAAQ;IACrB,OAAOK;AACT;AAEA,IAAMC,YAAY,OAAOF,WAAE,CAACN,MAAM,KAAK;AAChC,SAASA;IACd,IAAIQ,WAAW,OAAOF,WAAE,CAACN,MAAM;IAC/B,IAAMS,SAASP,QAAQ;IACvB,OAAOO,OAAOT,MAAM;AACtB;AAEA;;;;CAIC,GACD,IAAMU,cAAc,OAAOC,OAAOC,SAAS,CAACC,QAAQ,KAAK;AAElD,SAASd,eAAee,GAAW,EAAEC,MAAc,EAAEC,QAAiB;IAC3E,IAAIN,aAAa;QACf,OAAOI,IAAID,QAAQ,CAACE,QAAQC;IAC9B;IACA,IAAMC,MAAMD,aAAaE,YAAYJ,IAAIK,MAAM,GAAGH;IAClD,OAAOF,IAAIM,WAAW,CAACL,YAAYE,MAAMF,OAAOI,MAAM;AACxD;AAKO,SAASvB,WAAWyB,GAAW;IACpC,IAAMC,SAASrB,SAAS;IACxBqB,OAAOC,IAAI,CAACF;AACd;AAKO,SAASvB,OAAOuB,GAAW;IAChC,IAAMG,aAAavB,SAAS,oBAAoBuB,UAAU;IAC1DA,WAAWH;AACb;AAWO,SAASxB,iBAAiBwB,GAAW;IAC1C,IAAMI,QAAQC,WAAE,CAACC,WAAW,CAACN;IAC7B,OAAOI,MAAMG,GAAG,CAAC,SAACC;QAChB,IAAMC,WAAWC,aAAI,CAACC,IAAI,CAACX,KAAKQ;QAChC,IAAII;QACJ,IAAI;YACFA,OAAOP,WAAE,CAACQ,QAAQ,CAACJ;QACrB,EAAE,OAAOK,IAAI;YACX,wCAAwC;YACxC,OAAO;gBAAEN,MAAMA;gBAAMO,aAAa;2BAAM;;YAAM;QAChD;QACA,OAAO;YACLP,MAAMA;YACNO,aAAa;uBAAMH,KAAKG,WAAW;;QACrC;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/lib/findInstalledVersions.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { readdirWithTypes } from '../compat.ts';\n\n/**\n * Compare two semver version strings (e.g., \"20.19.0\" vs \"20.9.1\")\n * Returns: negative if a < b, positive if a > b, 0 if equal\n */\nfunction compareVersions(a: string, b: string): number {\n
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/lib/findInstalledVersions.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { readdirWithTypes } from '../compat.ts';\n\n/**\n * Compare two semver version strings (e.g., \"20.19.0\" vs \"20.9.1\")\n * Returns: negative if a < b, positive if a > b, 0 if equal\n */\nfunction compareVersions(a: string, b: string): number {\n const aParts = a.replace(/^v/, '').split('.');\n const bParts = b.replace(/^v/, '').split('.');\n const len = Math.max(aParts.length, bParts.length);\n\n for (let i = 0; i < len; i++) {\n const aNum = parseInt(aParts[i], 10) || 0;\n const bNum = parseInt(bParts[i], 10) || 0;\n if (aNum !== bNum) {\n return aNum - bNum;\n }\n }\n return 0;\n}\n\n/**\n * Find all installed versions matching the given version string\n * Results are sorted in ascending semver order (lowest first, highest last)\n */\nexport function findInstalledVersions(versionsPath: string, version: string): string[] {\n if (!fs.existsSync(versionsPath)) {\n return [];\n }\n\n const normalizedVersion = version.replace(/^v/, '');\n const matches: string[] = [];\n\n // Try exact matches first\n const exactMatches = [version, `v${normalizedVersion}`, normalizedVersion];\n for (let i = 0; i < exactMatches.length; i++) {\n const v = exactMatches[i];\n const versionPath = path.join(versionsPath, v);\n if (fs.existsSync(versionPath) && fs.statSync(versionPath).isDirectory()) {\n if (matches.indexOf(v) === -1) {\n matches.push(v);\n }\n }\n }\n\n // If we have an exact match, return just that\n if (matches.length > 0) {\n return matches;\n }\n\n // Try partial match (e.g., \"20\" matches \"v20.19.6\")\n const entries = readdirWithTypes(versionsPath);\n for (let j = 0; j < entries.length; j++) {\n const entry = entries[j];\n if (!entry.isDirectory()) continue;\n const dirVersion = entry.name.replace(/^v/, '');\n if (dirVersion.indexOf(`${normalizedVersion}.`) === 0) {\n matches.push(entry.name);\n }\n }\n\n // Sort by semver (ascending) so highest version is last\n matches.sort(compareVersions);\n\n return matches;\n}\n\n/**\n * Get all installed versions\n */\nexport function getAllInstalledVersions(versionsPath: string): string[] {\n if (!fs.existsSync(versionsPath)) {\n return [];\n }\n\n const entries = readdirWithTypes(versionsPath);\n const versions: string[] = [];\n for (let i = 0; i < entries.length; i++) {\n if (entries[i].isDirectory()) {\n versions.push(entries[i].name);\n }\n }\n\n return versions;\n}\n"],"names":["findInstalledVersions","getAllInstalledVersions","compareVersions","a","b","aParts","replace","split","bParts","len","Math","max","length","i","aNum","parseInt","bNum","versionsPath","version","fs","existsSync","normalizedVersion","matches","exactMatches","v","versionPath","path","join","statSync","isDirectory","indexOf","push","entries","readdirWithTypes","j","entry","dirVersion","name","sort","versions"],"mappings":";;;;;;;;;;;QA2BgBA;eAAAA;;QA6CAC;eAAAA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oD;IACpD,IAAMU,UAAUC,IAAAA,0BAAgB,EAAChB;IACjC,IAAK,IAAIiB,IAAI,GAAGA,IAAIF,QAAQpB,MAAM,EAAEsB,IAAK;QACvC,IAAMC,QAAQH,OAAO,CAACE,EAAE;QACxB,IAAI,CAACC,MAAMN,WAAW,IAAI;QAC1B,IAAMO,aAAaD,MAAME,IAAI,CAAC/B,OAAO,CAAC,MAAM;QAC5C,IAAI8B,WAAWN,OAAO,CAAC,AAAC,GAAoB,OAAlBT,mBAAkB,UAAQ,GAAG;YACrDC,QAAQS,IAAI,CAACI,MAAME,IAAI;QACzB;IACF;IAEA,wDAAwD;IACxDf,QAAQgB,IAAI,CAACpC;IAEb,OAAOoB;AACT;AAKO,SAASrB,wBAAwBgB,YAAoB;IAC1D,IAAI,CAACE,WAAE,CAACC,UAAU,CAACH,eAAe;QAChC,OAAO,EAAE;IACX;IAEA,IAAMe,UAAUC,IAAAA,0BAAgB,EAAChB;IACjC,IAAMsB,WAAqB,EAAE;IAC7B,IAAK,IAAI1B,IAAI,GAAGA,IAAImB,QAAQpB,MAAM,EAAEC,IAAK;QACvC,IAAImB,OAAO,CAACnB,EAAE,CAACgB,WAAW,IAAI;YAC5BU,SAASR,IAAI,CAACC,OAAO,CAACnB,EAAE,CAACwB,IAAI;QAC/B;IACF;IAEA,OAAOE;AACT"}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
const envPathKey = require('env-path-key');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const { safeRmSync } = require('fs-remove-compat');
|
|
4
|
+
const getFile = require('get-file-compat');
|
|
5
|
+
const mkdirp = require('mkdirp-classic');
|
|
6
|
+
const os = require('os');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const Queue = require('queue-cb');
|
|
9
|
+
const moduleRoot = require('module-root-sync');
|
|
10
|
+
const root = moduleRoot(__dirname);
|
|
11
|
+
// Configuration
|
|
12
|
+
const GITHUB_REPO = 'kmalakoff/node-version-use';
|
|
13
|
+
const BINARY_VERSION = require(path.join(root, 'package.json')).binaryVersion;
|
|
14
|
+
const isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);
|
|
15
|
+
const hasHomedir = typeof os.homedir === 'function';
|
|
16
|
+
function homedir() {
|
|
17
|
+
if (hasHomedir) return os.homedir();
|
|
18
|
+
const home = require('homedir-polyfill');
|
|
19
|
+
return home();
|
|
20
|
+
}
|
|
21
|
+
// Allow NVU_HOME override for testing
|
|
22
|
+
const storagePath = process.env.NVU_HOME || path.join(homedir(), '.nvu');
|
|
23
|
+
const hasTmpdir = typeof os.tmpdir === 'function';
|
|
24
|
+
function tmpdir() {
|
|
25
|
+
if (hasTmpdir) return os.tmpdir();
|
|
26
|
+
const osShim = require('os-shim');
|
|
27
|
+
return osShim.tmpdir();
|
|
28
|
+
}
|
|
29
|
+
function removeIfExistsSync(filePath) {
|
|
30
|
+
if (fs.existsSync(filePath)) {
|
|
31
|
+
try {
|
|
32
|
+
fs.unlinkSync(filePath);
|
|
33
|
+
} catch (_e) {
|
|
34
|
+
// ignore cleanup errors
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get the platform-specific archive base name (without extension)
|
|
40
|
+
*/ function getArchiveBaseName() {
|
|
41
|
+
const { platform, arch } = process;
|
|
42
|
+
const platformMap = {
|
|
43
|
+
darwin: 'darwin',
|
|
44
|
+
linux: 'linux',
|
|
45
|
+
win32: 'win32'
|
|
46
|
+
};
|
|
47
|
+
const archMap = {
|
|
48
|
+
x64: 'x64',
|
|
49
|
+
arm64: 'arm64',
|
|
50
|
+
amd64: 'x64'
|
|
51
|
+
};
|
|
52
|
+
const platformName = platformMap[platform];
|
|
53
|
+
const archName = archMap[arch];
|
|
54
|
+
if (!platformName || !archName) return null;
|
|
55
|
+
return `nvu-binary-${platformName}-${archName}`;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Copy file
|
|
59
|
+
*/ function copyFileSync(src, dest) {
|
|
60
|
+
const content = fs.readFileSync(src);
|
|
61
|
+
fs.writeFileSync(dest, content);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Atomic rename with fallback to copy+delete for cross-device moves
|
|
65
|
+
*/ function atomicRename(src, dest, callback) {
|
|
66
|
+
fs.rename(src, dest, (err)=>{
|
|
67
|
+
if (!err) {
|
|
68
|
+
callback(null);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
// Cross-device link error - fall back to copy + delete
|
|
72
|
+
if (err.code === 'EXDEV') {
|
|
73
|
+
try {
|
|
74
|
+
copyFileSync(src, dest);
|
|
75
|
+
fs.unlinkSync(src);
|
|
76
|
+
callback(null);
|
|
77
|
+
} catch (copyErr) {
|
|
78
|
+
callback(copyErr);
|
|
79
|
+
}
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
callback(err);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Extract archive to a directory (callback-based)
|
|
87
|
+
*/ function extractArchive(archivePath, dest, callback) {
|
|
88
|
+
const Iterator = isWindows ? require('zip-iterator') : require('tar-iterator');
|
|
89
|
+
const stream = isWindows ? fs.createReadStream(archivePath) : fs.createReadStream(archivePath).pipe(require('zlib').createGunzip());
|
|
90
|
+
let iterator = new Iterator(stream);
|
|
91
|
+
// one by one
|
|
92
|
+
const links = [];
|
|
93
|
+
iterator.forEach((entry, callback)=>{
|
|
94
|
+
if (entry.type === 'link') {
|
|
95
|
+
links.unshift(entry);
|
|
96
|
+
callback();
|
|
97
|
+
} else if (entry.type === 'symlink') {
|
|
98
|
+
links.push(entry);
|
|
99
|
+
callback();
|
|
100
|
+
} else entry.create(dest, callback);
|
|
101
|
+
}, {
|
|
102
|
+
callbacks: true,
|
|
103
|
+
concurrency: 1
|
|
104
|
+
}, (_err)=>{
|
|
105
|
+
// create links after directories and files
|
|
106
|
+
const queue = new Queue();
|
|
107
|
+
for(let index = 0; index < links.length; index++){
|
|
108
|
+
const entry = links[index];
|
|
109
|
+
queue.defer(entry.create.bind(entry, dest));
|
|
110
|
+
}
|
|
111
|
+
queue.await((err)=>{
|
|
112
|
+
iterator.destroy();
|
|
113
|
+
iterator = null;
|
|
114
|
+
callback(err);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Install binaries using atomic rename pattern
|
|
120
|
+
* 1. Extract to temp directory
|
|
121
|
+
* 2. Copy binary to temp files in destination directory
|
|
122
|
+
* 3. Atomic rename temp files to final names
|
|
123
|
+
*/ function extractAndInstall(archivePath, destDir, binaryName, callback) {
|
|
124
|
+
const ext = isWindows ? '.exe' : '';
|
|
125
|
+
// Create temp extraction directory
|
|
126
|
+
const tempExtractDir = path.join(tmpdir(), `nvu-extract-${Date.now()}`);
|
|
127
|
+
mkdirp.sync(tempExtractDir);
|
|
128
|
+
extractArchive(archivePath, tempExtractDir, (err)=>{
|
|
129
|
+
if (err) {
|
|
130
|
+
safeRmSync(tempExtractDir);
|
|
131
|
+
callback(err);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const extractedPath = path.join(tempExtractDir, binaryName);
|
|
135
|
+
if (!fs.existsSync(extractedPath)) {
|
|
136
|
+
safeRmSync(tempExtractDir);
|
|
137
|
+
callback(new Error(`Extracted binary not found: ${binaryName}. ${archivePath} ${tempExtractDir}`));
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
// Binary names to install
|
|
141
|
+
const binaries = [
|
|
142
|
+
'node',
|
|
143
|
+
'npm',
|
|
144
|
+
'npx',
|
|
145
|
+
'corepack'
|
|
146
|
+
];
|
|
147
|
+
const timestamp = Date.now();
|
|
148
|
+
let installError = null;
|
|
149
|
+
// Step 1: Copy extracted binary to temp files in destination directory
|
|
150
|
+
// This ensures the temp files are on the same filesystem for atomic rename
|
|
151
|
+
for(let i = 0; i < binaries.length; i++){
|
|
152
|
+
const name = binaries[i];
|
|
153
|
+
const tempDest = path.join(destDir, `${name}.tmp-${timestamp}${ext}`);
|
|
154
|
+
try {
|
|
155
|
+
// Copy to temp file in destination directory
|
|
156
|
+
copyFileSync(extractedPath, tempDest);
|
|
157
|
+
// Set permissions on Unix
|
|
158
|
+
if (!isWindows) fs.chmodSync(tempDest, 0o755);
|
|
159
|
+
} catch (err) {
|
|
160
|
+
installError = err;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (installError) {
|
|
165
|
+
// Clean up any temp files we created
|
|
166
|
+
for(let j = 0; j < binaries.length; j++){
|
|
167
|
+
const tempPath = path.join(destDir, `${binaries[j]}.tmp-${timestamp}${ext}`);
|
|
168
|
+
removeIfExistsSync(tempPath);
|
|
169
|
+
}
|
|
170
|
+
safeRmSync(tempExtractDir);
|
|
171
|
+
callback(installError);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
// Step 2: Atomic rename temp files to final names
|
|
175
|
+
let renameError = null;
|
|
176
|
+
function doRename(index) {
|
|
177
|
+
if (index >= binaries.length) {
|
|
178
|
+
// All renames complete
|
|
179
|
+
safeRmSync(tempExtractDir);
|
|
180
|
+
callback(renameError);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const name = binaries[index];
|
|
184
|
+
const tempDest = path.join(destDir, `${name}.tmp-${timestamp}${ext}`);
|
|
185
|
+
const finalDest = path.join(destDir, `${name}${ext}`);
|
|
186
|
+
// Remove existing file if present (for atomic replacement)
|
|
187
|
+
removeIfExistsSync(finalDest);
|
|
188
|
+
atomicRename(tempDest, finalDest, (err)=>{
|
|
189
|
+
if (err && !renameError) {
|
|
190
|
+
renameError = err;
|
|
191
|
+
}
|
|
192
|
+
doRename(index + 1);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
doRename(0);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Print setup instructions
|
|
200
|
+
*/ module.exports.printInstructions = function printInstructions() {
|
|
201
|
+
const nvuBinPath = path.join(storagePath, 'bin');
|
|
202
|
+
console.log('nvu binaries installed in ~/.nvu/bin/');
|
|
203
|
+
const pathKey = envPathKey();
|
|
204
|
+
const envPath = process.env[pathKey] || '';
|
|
205
|
+
if (envPath.indexOf('.nvu/bin') >= 0) return; // path exists
|
|
206
|
+
// provide instructions for path setup
|
|
207
|
+
console.log('');
|
|
208
|
+
console.log('============================================================');
|
|
209
|
+
console.log(' Global node setup');
|
|
210
|
+
console.log('============================================================');
|
|
211
|
+
console.log('');
|
|
212
|
+
if (isWindows) {
|
|
213
|
+
console.log(' PowerShell (add to $PROFILE):');
|
|
214
|
+
console.log(` $env:PATH = "${nvuBinPath};$env:PATH"`);
|
|
215
|
+
console.log('');
|
|
216
|
+
console.log(' CMD (run as administrator):');
|
|
217
|
+
console.log(` setx PATH "${nvuBinPath};%PATH%"`);
|
|
218
|
+
} else {
|
|
219
|
+
console.log(' # For bash (~/.bashrc):');
|
|
220
|
+
console.log(' echo \'export PATH="$HOME/.nvu/bin:$PATH"\' >> ~/.bashrc');
|
|
221
|
+
console.log('');
|
|
222
|
+
console.log(' # For zsh (~/.zshrc):');
|
|
223
|
+
console.log(' echo \'export PATH="$HOME/.nvu/bin:$PATH"\' >> ~/.zshrc');
|
|
224
|
+
console.log('');
|
|
225
|
+
console.log(' # For fish (~/.config/fish/config.fish):');
|
|
226
|
+
console.log(" echo 'set -gx PATH $HOME/.nvu/bin $PATH' >> ~/.config/fish/config.fish");
|
|
227
|
+
}
|
|
228
|
+
console.log('');
|
|
229
|
+
console.log('Then restart your terminal or source your shell profile.');
|
|
230
|
+
console.log('');
|
|
231
|
+
console.log("Without this, 'nvu 18 npm test' still works - you just won't have");
|
|
232
|
+
console.log("transparent 'node' command override.");
|
|
233
|
+
console.log('============================================================');
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Main installation function
|
|
237
|
+
*/ module.exports.installBinaries = function installBinaries(options, callback) {
|
|
238
|
+
const archiveBaseName = getArchiveBaseName();
|
|
239
|
+
if (!archiveBaseName) {
|
|
240
|
+
callback(new Error('Unsupported platform/architecture for binary.'));
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const extractedBinaryName = `${archiveBaseName}${isWindows ? '.exe' : ''}`;
|
|
244
|
+
const binDir = path.join(storagePath, 'bin');
|
|
245
|
+
// check if we need to upgrade
|
|
246
|
+
if (!options.force) {
|
|
247
|
+
try {
|
|
248
|
+
// already installed
|
|
249
|
+
if (fs.statSync(binDir)) {
|
|
250
|
+
if (fs.readFileSync(path.join(binDir, 'version.txt'), 'utf8') === BINARY_VERSION) {
|
|
251
|
+
callback(null, false);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
} catch (_err) {}
|
|
256
|
+
}
|
|
257
|
+
// Create directories
|
|
258
|
+
mkdirp.sync(storagePath);
|
|
259
|
+
mkdirp.sync(binDir);
|
|
260
|
+
const downloadUrl = `https://github.com/${GITHUB_REPO}/releases/download/binary-v${BINARY_VERSION}/${archiveBaseName}${isWindows ? '.zip' : '.tar.gz'}`;
|
|
261
|
+
const tempPath = path.join(tmpdir(), `nvu-binary-${Date.now()}${isWindows ? '.zip' : '.tar.gz'}`);
|
|
262
|
+
console.log(`Downloading binary for ${process.platform}-${process.arch}...`);
|
|
263
|
+
getFile(downloadUrl, tempPath, (err)=>{
|
|
264
|
+
if (err) {
|
|
265
|
+
removeIfExistsSync(tempPath);
|
|
266
|
+
callback(new Error(`No prebuilt binary available for ${process.platform}-${process.arch}. Download: ${downloadUrl}. Error: ${err.message}`));
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
console.log('Extracting binary...');
|
|
270
|
+
extractAndInstall(tempPath, binDir, extractedBinaryName, (err)=>{
|
|
271
|
+
removeIfExistsSync(tempPath);
|
|
272
|
+
if (err) {
|
|
273
|
+
callback(err);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
// save binary version for upgrade checks
|
|
277
|
+
fs.writeFileSync(path.join(binDir, 'version.txt'), BINARY_VERSION, 'utf8');
|
|
278
|
+
console.log('Binary installed successfully!');
|
|
279
|
+
callback(null, true);
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
};
|