node-version-use 2.1.11 → 2.3.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.
@@ -36,6 +36,59 @@ function removeIfExistsSync(filePath) {
36
36
  }
37
37
  }
38
38
  }
39
+ /**
40
+ * On Windows, rename a file out of the way instead of deleting.
41
+ * This works even if the file is currently running.
42
+ */ function moveOutOfWay(filePath) {
43
+ if (!fs.existsSync(filePath)) return;
44
+ var timestamp = Date.now();
45
+ var oldPath = "".concat(filePath, ".old-").concat(timestamp);
46
+ try {
47
+ fs.renameSync(filePath, oldPath);
48
+ } catch (_e) {
49
+ // If rename fails, try delete as fallback (works on Unix)
50
+ try {
51
+ fs.unlinkSync(filePath);
52
+ } catch (_e2) {
53
+ // ignore - will fail on atomic rename instead
54
+ }
55
+ }
56
+ }
57
+ /**
58
+ * Clean up old .old-* files from previous installs
59
+ */ function cleanupOldFiles(dir) {
60
+ try {
61
+ var entries = fs.readdirSync(dir);
62
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
63
+ try {
64
+ for(var _iterator = entries[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
65
+ var entry = _step.value;
66
+ if (entry.includes('.old-')) {
67
+ try {
68
+ fs.unlinkSync(path.join(dir, entry));
69
+ } catch (_e) {
70
+ // ignore - file may still be in use
71
+ }
72
+ }
73
+ }
74
+ } catch (err) {
75
+ _didIteratorError = true;
76
+ _iteratorError = err;
77
+ } finally{
78
+ try {
79
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
80
+ _iterator.return();
81
+ }
82
+ } finally{
83
+ if (_didIteratorError) {
84
+ throw _iteratorError;
85
+ }
86
+ }
87
+ }
88
+ } catch (_e) {
89
+ // ignore if dir doesn't exist
90
+ }
91
+ }
39
92
  /**
40
93
  * Get the platform-specific archive base name (without extension)
41
94
  */ function getArchiveBaseName() {
@@ -181,8 +234,8 @@ function removeIfExistsSync(filePath) {
181
234
  var name = binaries[index];
182
235
  var tempDest = path.join(destDir, "".concat(name, ".tmp-").concat(timestamp).concat(ext));
183
236
  var finalDest = path.join(destDir, "".concat(name).concat(ext));
184
- // Remove existing file if present (for atomic replacement)
185
- removeIfExistsSync(finalDest);
237
+ // Move existing file out of the way (works even if running on Windows)
238
+ moveOutOfWay(finalDest);
186
239
  atomicRename(tempDest, finalDest, function(err) {
187
240
  if (err && !renameError) {
188
241
  renameError = err;
@@ -258,6 +311,8 @@ function removeIfExistsSync(filePath) {
258
311
  // Create directories
259
312
  mkdirp.sync(storagePath);
260
313
  mkdirp.sync(binDir);
314
+ // Clean up old .old-* files from previous installs
315
+ cleanupOldFiles(binDir);
261
316
  var downloadUrl = "https://github.com/".concat(GITHUB_REPO, "/releases/download/binary-v").concat(BINARY_VERSION, "/").concat(archiveBaseName).concat(isWindows ? '.zip' : '.tar.gz');
262
317
  var tempPath = path.join(tmpdir(), "nvu-binary-".concat(Date.now()).concat(isWindows ? '.zip' : '.tar.gz'));
263
318
  console.log("Downloading binary for ".concat(process.platform, "-").concat(process.arch, "..."));
@@ -36,6 +36,59 @@ function removeIfExistsSync(filePath) {
36
36
  }
37
37
  }
38
38
  }
39
+ /**
40
+ * On Windows, rename a file out of the way instead of deleting.
41
+ * This works even if the file is currently running.
42
+ */ function moveOutOfWay(filePath) {
43
+ if (!fs.existsSync(filePath)) return;
44
+ var timestamp = Date.now();
45
+ var oldPath = "".concat(filePath, ".old-").concat(timestamp);
46
+ try {
47
+ fs.renameSync(filePath, oldPath);
48
+ } catch (_e) {
49
+ // If rename fails, try delete as fallback (works on Unix)
50
+ try {
51
+ fs.unlinkSync(filePath);
52
+ } catch (_e2) {
53
+ // ignore - will fail on atomic rename instead
54
+ }
55
+ }
56
+ }
57
+ /**
58
+ * Clean up old .old-* files from previous installs
59
+ */ function cleanupOldFiles(dir) {
60
+ try {
61
+ var entries = fs.readdirSync(dir);
62
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
63
+ try {
64
+ for(var _iterator = entries[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
65
+ var entry = _step.value;
66
+ if (entry.includes('.old-')) {
67
+ try {
68
+ fs.unlinkSync(path.join(dir, entry));
69
+ } catch (_e) {
70
+ // ignore - file may still be in use
71
+ }
72
+ }
73
+ }
74
+ } catch (err) {
75
+ _didIteratorError = true;
76
+ _iteratorError = err;
77
+ } finally{
78
+ try {
79
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
80
+ _iterator.return();
81
+ }
82
+ } finally{
83
+ if (_didIteratorError) {
84
+ throw _iteratorError;
85
+ }
86
+ }
87
+ }
88
+ } catch (_e) {
89
+ // ignore if dir doesn't exist
90
+ }
91
+ }
39
92
  /**
40
93
  * Get the platform-specific archive base name (without extension)
41
94
  */ function getArchiveBaseName() {
@@ -181,8 +234,8 @@ function removeIfExistsSync(filePath) {
181
234
  var name = binaries[index];
182
235
  var tempDest = path.join(destDir, "".concat(name, ".tmp-").concat(timestamp).concat(ext));
183
236
  var finalDest = path.join(destDir, "".concat(name).concat(ext));
184
- // Remove existing file if present (for atomic replacement)
185
- removeIfExistsSync(finalDest);
237
+ // Move existing file out of the way (works even if running on Windows)
238
+ moveOutOfWay(finalDest);
186
239
  atomicRename(tempDest, finalDest, function(err) {
187
240
  if (err && !renameError) {
188
241
  renameError = err;
@@ -258,6 +311,8 @@ function removeIfExistsSync(filePath) {
258
311
  // Create directories
259
312
  mkdirp.sync(storagePath);
260
313
  mkdirp.sync(binDir);
314
+ // Clean up old .old-* files from previous installs
315
+ cleanupOldFiles(binDir);
261
316
  var downloadUrl = "https://github.com/".concat(GITHUB_REPO, "/releases/download/binary-v").concat(BINARY_VERSION, "/").concat(archiveBaseName).concat(isWindows ? '.zip' : '.tar.gz');
262
317
  var tempPath = path.join(tmpdir(), "nvu-binary-".concat(Date.now()).concat(isWindows ? '.zip' : '.tar.gz'));
263
318
  console.log("Downloading binary for ".concat(process.platform, "-").concat(process.arch, "..."));
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/assets/installBinaries.cts"],"sourcesContent":["const envPathKey = require('env-path-key');\nconst fs = require('fs');\nconst { safeRmSync } = require('fs-remove-compat');\nconst getFile = require('get-file-compat');\nconst mkdirp = require('mkdirp-classic');\nconst os = require('os');\nconst path = require('path');\nconst Queue = require('queue-cb');\nconst moduleRoot = require('module-root-sync');\n\nconst root = moduleRoot(__dirname);\n\n// Configuration\nconst GITHUB_REPO = 'kmalakoff/node-version-use';\nconst BINARY_VERSION = require(path.join(root, 'package.json')).binaryVersion;\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\ntype Callback = (err?: Error | null) => void;\n\ninterface PlatformMap {\n [key: string]: string;\n}\n\nconst hasHomedir = typeof os.homedir === 'function';\nfunction homedir(): string {\n if (hasHomedir) return os.homedir();\n const home = require('homedir-polyfill');\n return home();\n}\n\n// Allow NVU_HOME override for testing\nconst storagePath = (process.env.NVU_HOME || path.join(homedir(), '.nvu')) as string;\n\nconst hasTmpdir = typeof os.tmpdir === 'function';\nfunction tmpdir(): string {\n if (hasTmpdir) return os.tmpdir();\n const osShim = require('os-shim');\n return osShim.tmpdir();\n}\n\nfunction removeIfExistsSync(filePath: string): void {\n if (fs.existsSync(filePath)) {\n try {\n fs.unlinkSync(filePath);\n } catch (_e) {\n // ignore cleanup errors\n }\n }\n}\n\n/**\n * Get the platform-specific archive base name (without extension)\n */\nfunction getArchiveBaseName(): string | null {\n const { platform, arch } = process;\n\n const platformMap: PlatformMap = {\n darwin: 'darwin',\n linux: 'linux',\n win32: 'win32',\n };\n\n const archMap: PlatformMap = {\n x64: 'x64',\n arm64: 'arm64',\n amd64: 'x64',\n };\n\n const platformName = platformMap[platform];\n const archName = archMap[arch];\n\n if (!platformName || !archName) return null;\n return `nvu-binary-${platformName}-${archName}`;\n}\n\n/**\n * Copy file\n */\nfunction copyFileSync(src: string, dest: string): void {\n const content = fs.readFileSync(src);\n fs.writeFileSync(dest, content);\n}\n\n/**\n * Atomic rename with fallback to copy+delete for cross-device moves\n */\nfunction atomicRename(src: string, dest: string, callback: Callback) {\n fs.rename(src, dest, (err) => {\n if (!err) return callback(null);\n\n // Cross-device link error - fall back to copy + delete\n if ((err as NodeJS.ErrnoException).code === 'EXDEV') {\n try {\n copyFileSync(src, dest);\n fs.unlinkSync(src);\n callback(null);\n } catch (copyErr) {\n callback(copyErr as Error);\n }\n return;\n }\n\n callback(err);\n });\n}\n\n/**\n * Extract archive to a directory (callback-based)\n */\nfunction extractArchive(archivePath: string, dest: string, callback: Callback) {\n const Iterator = isWindows ? require('zip-iterator') : require('tar-iterator');\n const stream = isWindows ? fs.createReadStream(archivePath) : fs.createReadStream(archivePath).pipe(require('zlib').createGunzip());\n let iterator = new Iterator(stream);\n\n // one by one\n const links = [];\n iterator.forEach(\n (entry, callback) => {\n if (entry.type === 'link') {\n links.unshift(entry);\n callback();\n } else if (entry.type === 'symlink') {\n links.push(entry);\n callback();\n } else entry.create(dest, callback);\n },\n { callbacks: true, concurrency: 1 },\n (_err) => {\n // create links after directories and files\n const queue = new Queue();\n for (let index = 0; index < links.length; index++) {\n const entry = links[index];\n queue.defer(entry.create.bind(entry, dest));\n }\n queue.await((err) => {\n iterator.destroy();\n iterator = null;\n callback(err);\n });\n }\n );\n}\n\n/**\n * Install binaries using atomic rename pattern\n * 1. Extract to temp directory\n * 2. Copy binary to temp files in destination directory\n * 3. Atomic rename temp files to final names\n */\nfunction extractAndInstall(archivePath: string, destDir: string, binaryName: string, callback: Callback) {\n const ext = isWindows ? '.exe' : '';\n\n // Create temp extraction directory\n const tempExtractDir = path.join(tmpdir(), `nvu-extract-${Date.now()}`);\n mkdirp.sync(tempExtractDir);\n\n extractArchive(archivePath, tempExtractDir, (err) => {\n if (err) {\n safeRmSync(tempExtractDir);\n callback(err);\n return;\n }\n\n const extractedPath = path.join(tempExtractDir, binaryName);\n if (!fs.existsSync(extractedPath)) {\n safeRmSync(tempExtractDir);\n callback(new Error(`Extracted binary not found: ${binaryName}. ${archivePath} ${tempExtractDir}`));\n return;\n }\n\n // Binary names to install\n const binaries = ['node', 'npm', 'npx', 'corepack'];\n const timestamp = Date.now();\n let installError: Error | null = null;\n\n // Step 1: Copy extracted binary to temp files in destination directory\n // This ensures the temp files are on the same filesystem for atomic rename\n for (let i = 0; i < binaries.length; i++) {\n const name = binaries[i];\n const tempDest = path.join(destDir, `${name}.tmp-${timestamp}${ext}`);\n\n try {\n // Copy to temp file in destination directory\n copyFileSync(extractedPath, tempDest);\n\n // Set permissions on Unix\n if (!isWindows) fs.chmodSync(tempDest, 0o755);\n } catch (err) {\n installError = err as Error;\n break;\n }\n }\n\n if (installError) {\n // Clean up any temp files we created\n for (let j = 0; j < binaries.length; j++) {\n const tempPath = path.join(destDir, `${binaries[j]}.tmp-${timestamp}${ext}`);\n removeIfExistsSync(tempPath);\n }\n safeRmSync(tempExtractDir);\n callback(installError);\n return;\n }\n\n // Step 2: Atomic rename temp files to final names\n let renameError: Error | null = null;\n\n function doRename(index: number): void {\n if (index >= binaries.length) {\n // All renames complete\n safeRmSync(tempExtractDir);\n callback(renameError);\n return;\n }\n\n const name = binaries[index];\n const tempDest = path.join(destDir, `${name}.tmp-${timestamp}${ext}`);\n const finalDest = path.join(destDir, `${name}${ext}`);\n\n // Remove existing file if present (for atomic replacement)\n removeIfExistsSync(finalDest);\n\n atomicRename(tempDest, finalDest, (err) => {\n if (err && !renameError) {\n renameError = err;\n }\n doRename(index + 1);\n });\n }\n\n doRename(0);\n });\n}\n\n/**\n * Print setup instructions\n */\nmodule.exports.printInstructions = function printInstructions(): void {\n const _nvuBinPath = path.join(storagePath, 'bin');\n\n console.log('nvu binaries installed in ~/.nvu/bin/');\n\n const pathKey = envPathKey();\n const envPath = process.env[pathKey] || '';\n if (envPath.indexOf('.nvu/bin') >= 0) return; // path exists\n\n // provide instructions for path setup\n console.log('');\n console.log('============================================================');\n console.log(' Global node setup');\n console.log('============================================================');\n console.log('');\n if (isWindows) {\n console.log(' # Edit your PowerShell profile');\n console.log(' # Open with: notepad $PROFILE');\n console.log(' # Add this line:');\n console.log(' $env:PATH = \"$HOME\\\\.nvu\\\\bin;$env:APPDATA\\\\npm;$env:PATH\"');\n console.log('');\n console.log(' # This adds:');\n console.log(' # ~/.nvu/bin - node/npm version switching shims');\n console.log(' # %APPDATA%/npm - globally installed npm packages (like nvu)');\n } else {\n console.log(' # For bash (~/.bashrc):');\n console.log(' echo \\'export PATH=\"$HOME/.nvu/bin:$PATH\"\\' >> ~/.bashrc');\n console.log('');\n console.log(' # For zsh (~/.zshrc):');\n console.log(' echo \\'export PATH=\"$HOME/.nvu/bin:$PATH\"\\' >> ~/.zshrc');\n console.log('');\n console.log(' # For fish (~/.config/fish/config.fish):');\n console.log(\" echo 'set -gx PATH $HOME/.nvu/bin $PATH' >> ~/.config/fish/config.fish\");\n }\n\n console.log('');\n console.log('Then restart your terminal or source your shell profile.');\n console.log('');\n console.log(\"Without this, 'nvu 18 npm test' still works - you just won't have\");\n console.log(\"transparent 'node' command override.\");\n console.log('============================================================');\n};\n\n/**\n * Main installation function\n */\nmodule.exports.installBinaries = function installBinaries(options, callback): void {\n const archiveBaseName = getArchiveBaseName();\n\n if (!archiveBaseName) {\n callback(new Error('Unsupported platform/architecture for binary.'));\n return;\n }\n\n const extractedBinaryName = `${archiveBaseName}${isWindows ? '.exe' : ''}`;\n const binDir = path.join(storagePath, 'bin');\n\n // check if we need to upgrade\n if (!options.force) {\n try {\n // already installed\n if (fs.statSync(binDir)) {\n if (fs.readFileSync(path.join(binDir, 'version.txt'), 'utf8') === BINARY_VERSION) {\n callback(null, false);\n return;\n }\n }\n } catch (_err) {}\n }\n\n // Create directories\n mkdirp.sync(storagePath);\n mkdirp.sync(binDir);\n\n const downloadUrl = `https://github.com/${GITHUB_REPO}/releases/download/binary-v${BINARY_VERSION}/${archiveBaseName}${isWindows ? '.zip' : '.tar.gz'}`;\n const tempPath = path.join(tmpdir(), `nvu-binary-${Date.now()}${isWindows ? '.zip' : '.tar.gz'}`);\n\n console.log(`Downloading binary for ${process.platform}-${process.arch}...`);\n\n getFile(downloadUrl, tempPath, (err) => {\n if (err) {\n removeIfExistsSync(tempPath);\n callback(new Error(`No prebuilt binary available for ${process.platform}-${process.arch}. Download: ${downloadUrl}. Error: ${err.message}`));\n return;\n }\n\n console.log('Extracting binary...');\n\n extractAndInstall(tempPath, binDir, extractedBinaryName, (err) => {\n removeIfExistsSync(tempPath);\n if (err) return callback(err);\n\n // save binary version for upgrade checks\n fs.writeFileSync(path.join(binDir, 'version.txt'), BINARY_VERSION, 'utf8');\n console.log('Binary installed successfully!');\n callback(null, true);\n });\n });\n};\n"],"names":["envPathKey","require","fs","safeRmSync","getFile","mkdirp","os","path","Queue","moduleRoot","root","__dirname","GITHUB_REPO","BINARY_VERSION","join","binaryVersion","isWindows","process","platform","test","env","OSTYPE","hasHomedir","homedir","home","storagePath","NVU_HOME","hasTmpdir","tmpdir","osShim","removeIfExistsSync","filePath","existsSync","unlinkSync","_e","getArchiveBaseName","arch","platformMap","darwin","linux","win32","archMap","x64","arm64","amd64","platformName","archName","copyFileSync","src","dest","content","readFileSync","writeFileSync","atomicRename","callback","rename","err","code","copyErr","extractArchive","archivePath","Iterator","stream","createReadStream","pipe","createGunzip","iterator","links","forEach","entry","type","unshift","push","create","callbacks","concurrency","_err","queue","index","length","defer","bind","await","destroy","extractAndInstall","destDir","binaryName","ext","tempExtractDir","Date","now","sync","extractedPath","Error","binaries","timestamp","installError","i","name","tempDest","chmodSync","j","tempPath","renameError","doRename","finalDest","module","exports","printInstructions","_nvuBinPath","console","log","pathKey","envPath","indexOf","installBinaries","options","archiveBaseName","extractedBinaryName","binDir","force","statSync","downloadUrl","message"],"mappings":";AAAA,IAAMA,aAAaC,QAAQ;AAC3B,IAAMC,KAAKD,QAAQ;AACnB,IAAM,AAA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D,SAAS,MAAM;QACjB;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/assets/installBinaries.cts"],"sourcesContent":["const envPathKey = require('env-path-key');\nconst fs = require('fs');\nconst { safeRmSync } = require('fs-remove-compat');\nconst getFile = require('get-file-compat');\nconst mkdirp = require('mkdirp-classic');\nconst os = require('os');\nconst path = require('path');\nconst Queue = require('queue-cb');\nconst moduleRoot = require('module-root-sync');\n\nconst root = moduleRoot(__dirname);\n\n// Configuration\nconst GITHUB_REPO = 'kmalakoff/node-version-use';\nconst BINARY_VERSION = require(path.join(root, 'package.json')).binaryVersion;\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\ntype Callback = (err?: Error | null) => void;\n\ninterface PlatformMap {\n [key: string]: string;\n}\n\nconst hasHomedir = typeof os.homedir === 'function';\nfunction homedir(): string {\n if (hasHomedir) return os.homedir();\n const home = require('homedir-polyfill');\n return home();\n}\n\n// Allow NVU_HOME override for testing\nconst storagePath = (process.env.NVU_HOME || path.join(homedir(), '.nvu')) as string;\n\nconst hasTmpdir = typeof os.tmpdir === 'function';\nfunction tmpdir(): string {\n if (hasTmpdir) return os.tmpdir();\n const osShim = require('os-shim');\n return osShim.tmpdir();\n}\n\nfunction removeIfExistsSync(filePath: string): void {\n if (fs.existsSync(filePath)) {\n try {\n fs.unlinkSync(filePath);\n } catch (_e) {\n // ignore cleanup errors\n }\n }\n}\n\n/**\n * On Windows, rename a file out of the way instead of deleting.\n * This works even if the file is currently running.\n */\nfunction moveOutOfWay(filePath: string): void {\n if (!fs.existsSync(filePath)) return;\n\n const timestamp = Date.now();\n const oldPath = `${filePath}.old-${timestamp}`;\n\n try {\n fs.renameSync(filePath, oldPath);\n } catch (_e) {\n // If rename fails, try delete as fallback (works on Unix)\n try {\n fs.unlinkSync(filePath);\n } catch (_e2) {\n // ignore - will fail on atomic rename instead\n }\n }\n}\n\n/**\n * Clean up old .old-* files from previous installs\n */\nfunction cleanupOldFiles(dir: string): void {\n try {\n const entries = fs.readdirSync(dir);\n for (const entry of entries) {\n if (entry.includes('.old-')) {\n try {\n fs.unlinkSync(path.join(dir, entry));\n } catch (_e) {\n // ignore - file may still be in use\n }\n }\n }\n } catch (_e) {\n // ignore if dir doesn't exist\n }\n}\n\n/**\n * Get the platform-specific archive base name (without extension)\n */\nfunction getArchiveBaseName(): string | null {\n const { platform, arch } = process;\n\n const platformMap: PlatformMap = {\n darwin: 'darwin',\n linux: 'linux',\n win32: 'win32',\n };\n\n const archMap: PlatformMap = {\n x64: 'x64',\n arm64: 'arm64',\n amd64: 'x64',\n };\n\n const platformName = platformMap[platform];\n const archName = archMap[arch];\n\n if (!platformName || !archName) return null;\n return `nvu-binary-${platformName}-${archName}`;\n}\n\n/**\n * Copy file\n */\nfunction copyFileSync(src: string, dest: string): void {\n const content = fs.readFileSync(src);\n fs.writeFileSync(dest, content);\n}\n\n/**\n * Atomic rename with fallback to copy+delete for cross-device moves\n */\nfunction atomicRename(src: string, dest: string, callback: Callback) {\n fs.rename(src, dest, (err) => {\n if (!err) return callback(null);\n\n // Cross-device link error - fall back to copy + delete\n if ((err as NodeJS.ErrnoException).code === 'EXDEV') {\n try {\n copyFileSync(src, dest);\n fs.unlinkSync(src);\n callback(null);\n } catch (copyErr) {\n callback(copyErr as Error);\n }\n return;\n }\n\n callback(err);\n });\n}\n\n/**\n * Extract archive to a directory (callback-based)\n */\nfunction extractArchive(archivePath: string, dest: string, callback: Callback) {\n const Iterator = isWindows ? require('zip-iterator') : require('tar-iterator');\n const stream = isWindows ? fs.createReadStream(archivePath) : fs.createReadStream(archivePath).pipe(require('zlib').createGunzip());\n let iterator = new Iterator(stream);\n\n // one by one\n const links = [];\n iterator.forEach(\n (entry, callback) => {\n if (entry.type === 'link') {\n links.unshift(entry);\n callback();\n } else if (entry.type === 'symlink') {\n links.push(entry);\n callback();\n } else entry.create(dest, callback);\n },\n { callbacks: true, concurrency: 1 },\n (_err) => {\n // create links after directories and files\n const queue = new Queue();\n for (let index = 0; index < links.length; index++) {\n const entry = links[index];\n queue.defer(entry.create.bind(entry, dest));\n }\n queue.await((err) => {\n iterator.destroy();\n iterator = null;\n callback(err);\n });\n }\n );\n}\n\n/**\n * Install binaries using atomic rename pattern\n * 1. Extract to temp directory\n * 2. Copy binary to temp files in destination directory\n * 3. Atomic rename temp files to final names\n */\nfunction extractAndInstall(archivePath: string, destDir: string, binaryName: string, callback: Callback) {\n const ext = isWindows ? '.exe' : '';\n\n // Create temp extraction directory\n const tempExtractDir = path.join(tmpdir(), `nvu-extract-${Date.now()}`);\n mkdirp.sync(tempExtractDir);\n\n extractArchive(archivePath, tempExtractDir, (err) => {\n if (err) {\n safeRmSync(tempExtractDir);\n callback(err);\n return;\n }\n\n const extractedPath = path.join(tempExtractDir, binaryName);\n if (!fs.existsSync(extractedPath)) {\n safeRmSync(tempExtractDir);\n callback(new Error(`Extracted binary not found: ${binaryName}. ${archivePath} ${tempExtractDir}`));\n return;\n }\n\n // Binary names to install\n const binaries = ['node', 'npm', 'npx', 'corepack'];\n const timestamp = Date.now();\n let installError: Error | null = null;\n\n // Step 1: Copy extracted binary to temp files in destination directory\n // This ensures the temp files are on the same filesystem for atomic rename\n for (let i = 0; i < binaries.length; i++) {\n const name = binaries[i];\n const tempDest = path.join(destDir, `${name}.tmp-${timestamp}${ext}`);\n\n try {\n // Copy to temp file in destination directory\n copyFileSync(extractedPath, tempDest);\n\n // Set permissions on Unix\n if (!isWindows) fs.chmodSync(tempDest, 0o755);\n } catch (err) {\n installError = err as Error;\n break;\n }\n }\n\n if (installError) {\n // Clean up any temp files we created\n for (let j = 0; j < binaries.length; j++) {\n const tempPath = path.join(destDir, `${binaries[j]}.tmp-${timestamp}${ext}`);\n removeIfExistsSync(tempPath);\n }\n safeRmSync(tempExtractDir);\n callback(installError);\n return;\n }\n\n // Step 2: Atomic rename temp files to final names\n let renameError: Error | null = null;\n\n function doRename(index: number): void {\n if (index >= binaries.length) {\n // All renames complete\n safeRmSync(tempExtractDir);\n callback(renameError);\n return;\n }\n\n const name = binaries[index];\n const tempDest = path.join(destDir, `${name}.tmp-${timestamp}${ext}`);\n const finalDest = path.join(destDir, `${name}${ext}`);\n\n // Move existing file out of the way (works even if running on Windows)\n moveOutOfWay(finalDest);\n\n atomicRename(tempDest, finalDest, (err) => {\n if (err && !renameError) {\n renameError = err;\n }\n doRename(index + 1);\n });\n }\n\n doRename(0);\n });\n}\n\n/**\n * Print setup instructions\n */\nmodule.exports.printInstructions = function printInstructions(): void {\n const _nvuBinPath = path.join(storagePath, 'bin');\n\n console.log('nvu binaries installed in ~/.nvu/bin/');\n\n const pathKey = envPathKey();\n const envPath = process.env[pathKey] || '';\n if (envPath.indexOf('.nvu/bin') >= 0) return; // path exists\n\n // provide instructions for path setup\n console.log('');\n console.log('============================================================');\n console.log(' Global node setup');\n console.log('============================================================');\n console.log('');\n if (isWindows) {\n console.log(' # Edit your PowerShell profile');\n console.log(' # Open with: notepad $PROFILE');\n console.log(' # Add this line:');\n console.log(' $env:PATH = \"$HOME\\\\.nvu\\\\bin;$env:APPDATA\\\\npm;$env:PATH\"');\n console.log('');\n console.log(' # This adds:');\n console.log(' # ~/.nvu/bin - node/npm version switching shims');\n console.log(' # %APPDATA%/npm - globally installed npm packages (like nvu)');\n } else {\n console.log(' # For bash (~/.bashrc):');\n console.log(' echo \\'export PATH=\"$HOME/.nvu/bin:$PATH\"\\' >> ~/.bashrc');\n console.log('');\n console.log(' # For zsh (~/.zshrc):');\n console.log(' echo \\'export PATH=\"$HOME/.nvu/bin:$PATH\"\\' >> ~/.zshrc');\n console.log('');\n console.log(' # For fish (~/.config/fish/config.fish):');\n console.log(\" echo 'set -gx PATH $HOME/.nvu/bin $PATH' >> ~/.config/fish/config.fish\");\n }\n\n console.log('');\n console.log('Then restart your terminal or source your shell profile.');\n console.log('');\n console.log(\"Without this, 'nvu 18 npm test' still works - you just won't have\");\n console.log(\"transparent 'node' command override.\");\n console.log('============================================================');\n};\n\n/**\n * Main installation function\n */\nmodule.exports.installBinaries = function installBinaries(options, callback): void {\n const archiveBaseName = getArchiveBaseName();\n\n if (!archiveBaseName) {\n callback(new Error('Unsupported platform/architecture for binary.'));\n return;\n }\n\n const extractedBinaryName = `${archiveBaseName}${isWindows ? '.exe' : ''}`;\n const binDir = path.join(storagePath, 'bin');\n\n // check if we need to upgrade\n if (!options.force) {\n try {\n // already installed\n if (fs.statSync(binDir)) {\n if (fs.readFileSync(path.join(binDir, 'version.txt'), 'utf8') === BINARY_VERSION) {\n callback(null, false);\n return;\n }\n }\n } catch (_err) {}\n }\n\n // Create directories\n mkdirp.sync(storagePath);\n mkdirp.sync(binDir);\n\n // Clean up old .old-* files from previous installs\n cleanupOldFiles(binDir);\n\n const downloadUrl = `https://github.com/${GITHUB_REPO}/releases/download/binary-v${BINARY_VERSION}/${archiveBaseName}${isWindows ? '.zip' : '.tar.gz'}`;\n const tempPath = path.join(tmpdir(), `nvu-binary-${Date.now()}${isWindows ? '.zip' : '.tar.gz'}`);\n\n console.log(`Downloading binary for ${process.platform}-${process.arch}...`);\n\n getFile(downloadUrl, tempPath, (err) => {\n if (err) {\n removeIfExistsSync(tempPath);\n callback(new Error(`No prebuilt binary available for ${process.platform}-${process.arch}. Download: ${downloadUrl}. Error: ${err.message}`));\n return;\n }\n\n console.log('Extracting binary...');\n\n extractAndInstall(tempPath, binDir, extractedBinaryName, (err) => {\n removeIfExistsSync(tempPath);\n if (err) return callback(err);\n\n // save binary version for upgrade checks\n fs.writeFileSync(path.join(binDir, 'version.txt'), BINARY_VERSION, 'utf8');\n console.log('Binary installed successfully!');\n callback(null, true);\n });\n });\n};\n"],"names":["envPathKey","require","fs","safeRmSync","getFile","mkdirp","os","path","Queue","moduleRoot","root","__dirname","GITHUB_REPO","BINARY_VERSION","join","binaryVersion","isWindows","process","platform","test","env","OSTYPE","hasHomedir","homedir","home","storagePath","NVU_HOME","hasTmpdir","tmpdir","osShim","removeIfExistsSync","filePath","existsSync","unlinkSync","_e","moveOutOfWay","timestamp","Date","now","oldPath","renameSync","_e2","cleanupOldFiles","dir","entries","readdirSync","entry","includes","getArchiveBaseName","arch","platformMap","darwin","linux","win32","archMap","x64","arm64","amd64","platformName","archName","copyFileSync","src","dest","content","readFileSync","writeFileSync","atomicRename","callback","rename","err","code","copyErr","extractArchive","archivePath","Iterator","stream","createReadStream","pipe","createGunzip","iterator","links","forEach","type","unshift","push","create","callbacks","concurrency","_err","queue","index","length","defer","bind","await","destroy","extractAndInstall","destDir","binaryName","ext","tempExtractDir","sync","extractedPath","Error","binaries","installError","i","name","tempDest","chmodSync","j","tempPath","renameError","doRename","finalDest","module","exports","printInstructions","_nvuBinPath","console","log","pathKey","envPath","indexOf","installBinaries","options","archiveBaseName","extractedBinaryName","binDir","force","statSync","downloadUrl","message"],"mappings":";AAAA,IAAMA,aAAaC,QAAQ;AAC3B,IAAMC,KAAKD,QAAQ;AACnB,IAAM,AAAEE,aAAeF,QAAQ,oBAAvBE;AACR,IAAMC,UAAUH,QAAQ;AACxB,IAAMI,SAASJ,QAAQ;AACvB,IAAMK,KAAKL,QAAQ;AACnB,IAAMM,OAAON,QAAQ;AACrB,IAAMO,QAAQP,QAAQ;AACtB,IAAMQ,aAAaR,QAAQ;AAE3B,IAAMS,OAAOD,WAAWE;AAExB,gBAAgB;AAChB,IAAMC,cAAc;AACpB,IAAMC,iBAAiBZ,QAAQM,KAAKO,IAAI,CAACJ,MAAM,iBAAiBK,aAAa;AAE7E,IAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAQ3F,IAAMC,aAAa,OAAOhB,GAAGiB,OAAO,KAAK;AACzC,SAASA;IACP,IAAID,YAAY,OAAOhB,GAAGiB,OAAO;IACjC,IAAMC,OAAOvB,QAAQ;IACrB,OAAOuB;AACT;AAEA,sCAAsC;AACtC,IAAMC,cAAeR,QAAQG,GAAG,CAACM,QAAQ,IA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AAI+D,OAAO;YACxI;QACF;QAEAb,QAAQC,GAAG,CAAC;QAEZxB,kBAAkBe,UAAUiB,QAAQD,qBAAqB,SAAC1D;YACxDvC,mBAAmBiF;YACnB,IAAI1C,KAAK,OAAOF,SAASE;YAEzB,yCAAyC;YACzCnE,GAAG+D,aAAa,CAAC1D,KAAKO,IAAI,CAACkH,QAAQ,gBAAgBnH,gBAAgB;YACnE0G,QAAQC,GAAG,CAAC;YACZrD,SAAS,MAAM;QACjB;IACF;AACF"}
@@ -35,6 +35,42 @@ function removeIfExistsSync(filePath) {
35
35
  }
36
36
  }
37
37
  }
38
+ /**
39
+ * On Windows, rename a file out of the way instead of deleting.
40
+ * This works even if the file is currently running.
41
+ */ function moveOutOfWay(filePath) {
42
+ if (!fs.existsSync(filePath)) return;
43
+ const timestamp = Date.now();
44
+ const oldPath = `${filePath}.old-${timestamp}`;
45
+ try {
46
+ fs.renameSync(filePath, oldPath);
47
+ } catch (_e) {
48
+ // If rename fails, try delete as fallback (works on Unix)
49
+ try {
50
+ fs.unlinkSync(filePath);
51
+ } catch (_e2) {
52
+ // ignore - will fail on atomic rename instead
53
+ }
54
+ }
55
+ }
56
+ /**
57
+ * Clean up old .old-* files from previous installs
58
+ */ function cleanupOldFiles(dir) {
59
+ try {
60
+ const entries = fs.readdirSync(dir);
61
+ for (const entry of entries){
62
+ if (entry.includes('.old-')) {
63
+ try {
64
+ fs.unlinkSync(path.join(dir, entry));
65
+ } catch (_e) {
66
+ // ignore - file may still be in use
67
+ }
68
+ }
69
+ }
70
+ } catch (_e) {
71
+ // ignore if dir doesn't exist
72
+ }
73
+ }
38
74
  /**
39
75
  * Get the platform-specific archive base name (without extension)
40
76
  */ function getArchiveBaseName() {
@@ -180,8 +216,8 @@ function removeIfExistsSync(filePath) {
180
216
  const name = binaries[index];
181
217
  const tempDest = path.join(destDir, `${name}.tmp-${timestamp}${ext}`);
182
218
  const finalDest = path.join(destDir, `${name}${ext}`);
183
- // Remove existing file if present (for atomic replacement)
184
- removeIfExistsSync(finalDest);
219
+ // Move existing file out of the way (works even if running on Windows)
220
+ moveOutOfWay(finalDest);
185
221
  atomicRename(tempDest, finalDest, (err)=>{
186
222
  if (err && !renameError) {
187
223
  renameError = err;
@@ -257,6 +293,8 @@ function removeIfExistsSync(filePath) {
257
293
  // Create directories
258
294
  mkdirp.sync(storagePath);
259
295
  mkdirp.sync(binDir);
296
+ // Clean up old .old-* files from previous installs
297
+ cleanupOldFiles(binDir);
260
298
  const downloadUrl = `https://github.com/${GITHUB_REPO}/releases/download/binary-v${BINARY_VERSION}/${archiveBaseName}${isWindows ? '.zip' : '.tar.gz'}`;
261
299
  const tempPath = path.join(tmpdir(), `nvu-binary-${Date.now()}${isWindows ? '.zip' : '.tar.gz'}`);
262
300
  console.log(`Downloading binary for ${process.platform}-${process.arch}...`);
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/assets/installBinaries.cts"],"sourcesContent":["const envPathKey = require('env-path-key');\nconst fs = require('fs');\nconst { safeRmSync } = require('fs-remove-compat');\nconst getFile = require('get-file-compat');\nconst mkdirp = require('mkdirp-classic');\nconst os = require('os');\nconst path = require('path');\nconst Queue = require('queue-cb');\nconst moduleRoot = require('module-root-sync');\n\nconst root = moduleRoot(__dirname);\n\n// Configuration\nconst GITHUB_REPO = 'kmalakoff/node-version-use';\nconst BINARY_VERSION = require(path.join(root, 'package.json')).binaryVersion;\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\ntype Callback = (err?: Error | null) => void;\n\ninterface PlatformMap {\n [key: string]: string;\n}\n\nconst hasHomedir = typeof os.homedir === 'function';\nfunction homedir(): string {\n if (hasHomedir) return os.homedir();\n const home = require('homedir-polyfill');\n return home();\n}\n\n// Allow NVU_HOME override for testing\nconst storagePath = (process.env.NVU_HOME || path.join(homedir(), '.nvu')) as string;\n\nconst hasTmpdir = typeof os.tmpdir === 'function';\nfunction tmpdir(): string {\n if (hasTmpdir) return os.tmpdir();\n const osShim = require('os-shim');\n return osShim.tmpdir();\n}\n\nfunction removeIfExistsSync(filePath: string): void {\n if (fs.existsSync(filePath)) {\n try {\n fs.unlinkSync(filePath);\n } catch (_e) {\n // ignore cleanup errors\n }\n }\n}\n\n/**\n * Get the platform-specific archive base name (without extension)\n */\nfunction getArchiveBaseName(): string | null {\n const { platform, arch } = process;\n\n const platformMap: PlatformMap = {\n darwin: 'darwin',\n linux: 'linux',\n win32: 'win32',\n };\n\n const archMap: PlatformMap = {\n x64: 'x64',\n arm64: 'arm64',\n amd64: 'x64',\n };\n\n const platformName = platformMap[platform];\n const archName = archMap[arch];\n\n if (!platformName || !archName) return null;\n return `nvu-binary-${platformName}-${archName}`;\n}\n\n/**\n * Copy file\n */\nfunction copyFileSync(src: string, dest: string): void {\n const content = fs.readFileSync(src);\n fs.writeFileSync(dest, content);\n}\n\n/**\n * Atomic rename with fallback to copy+delete for cross-device moves\n */\nfunction atomicRename(src: string, dest: string, callback: Callback) {\n fs.rename(src, dest, (err) => {\n if (!err) return callback(null);\n\n // Cross-device link error - fall back to copy + delete\n if ((err as NodeJS.ErrnoException).code === 'EXDEV') {\n try {\n copyFileSync(src, dest);\n fs.unlinkSync(src);\n callback(null);\n } catch (copyErr) {\n callback(copyErr as Error);\n }\n return;\n }\n\n callback(err);\n });\n}\n\n/**\n * Extract archive to a directory (callback-based)\n */\nfunction extractArchive(archivePath: string, dest: string, callback: Callback) {\n const Iterator = isWindows ? require('zip-iterator') : require('tar-iterator');\n const stream = isWindows ? fs.createReadStream(archivePath) : fs.createReadStream(archivePath).pipe(require('zlib').createGunzip());\n let iterator = new Iterator(stream);\n\n // one by one\n const links = [];\n iterator.forEach(\n (entry, callback) => {\n if (entry.type === 'link') {\n links.unshift(entry);\n callback();\n } else if (entry.type === 'symlink') {\n links.push(entry);\n callback();\n } else entry.create(dest, callback);\n },\n { callbacks: true, concurrency: 1 },\n (_err) => {\n // create links after directories and files\n const queue = new Queue();\n for (let index = 0; index < links.length; index++) {\n const entry = links[index];\n queue.defer(entry.create.bind(entry, dest));\n }\n queue.await((err) => {\n iterator.destroy();\n iterator = null;\n callback(err);\n });\n }\n );\n}\n\n/**\n * Install binaries using atomic rename pattern\n * 1. Extract to temp directory\n * 2. Copy binary to temp files in destination directory\n * 3. Atomic rename temp files to final names\n */\nfunction extractAndInstall(archivePath: string, destDir: string, binaryName: string, callback: Callback) {\n const ext = isWindows ? '.exe' : '';\n\n // Create temp extraction directory\n const tempExtractDir = path.join(tmpdir(), `nvu-extract-${Date.now()}`);\n mkdirp.sync(tempExtractDir);\n\n extractArchive(archivePath, tempExtractDir, (err) => {\n if (err) {\n safeRmSync(tempExtractDir);\n callback(err);\n return;\n }\n\n const extractedPath = path.join(tempExtractDir, binaryName);\n if (!fs.existsSync(extractedPath)) {\n safeRmSync(tempExtractDir);\n callback(new Error(`Extracted binary not found: ${binaryName}. ${archivePath} ${tempExtractDir}`));\n return;\n }\n\n // Binary names to install\n const binaries = ['node', 'npm', 'npx', 'corepack'];\n const timestamp = Date.now();\n let installError: Error | null = null;\n\n // Step 1: Copy extracted binary to temp files in destination directory\n // This ensures the temp files are on the same filesystem for atomic rename\n for (let i = 0; i < binaries.length; i++) {\n const name = binaries[i];\n const tempDest = path.join(destDir, `${name}.tmp-${timestamp}${ext}`);\n\n try {\n // Copy to temp file in destination directory\n copyFileSync(extractedPath, tempDest);\n\n // Set permissions on Unix\n if (!isWindows) fs.chmodSync(tempDest, 0o755);\n } catch (err) {\n installError = err as Error;\n break;\n }\n }\n\n if (installError) {\n // Clean up any temp files we created\n for (let j = 0; j < binaries.length; j++) {\n const tempPath = path.join(destDir, `${binaries[j]}.tmp-${timestamp}${ext}`);\n removeIfExistsSync(tempPath);\n }\n safeRmSync(tempExtractDir);\n callback(installError);\n return;\n }\n\n // Step 2: Atomic rename temp files to final names\n let renameError: Error | null = null;\n\n function doRename(index: number): void {\n if (index >= binaries.length) {\n // All renames complete\n safeRmSync(tempExtractDir);\n callback(renameError);\n return;\n }\n\n const name = binaries[index];\n const tempDest = path.join(destDir, `${name}.tmp-${timestamp}${ext}`);\n const finalDest = path.join(destDir, `${name}${ext}`);\n\n // Remove existing file if present (for atomic replacement)\n removeIfExistsSync(finalDest);\n\n atomicRename(tempDest, finalDest, (err) => {\n if (err && !renameError) {\n renameError = err;\n }\n doRename(index + 1);\n });\n }\n\n doRename(0);\n });\n}\n\n/**\n * Print setup instructions\n */\nmodule.exports.printInstructions = function printInstructions(): void {\n const _nvuBinPath = path.join(storagePath, 'bin');\n\n console.log('nvu binaries installed in ~/.nvu/bin/');\n\n const pathKey = envPathKey();\n const envPath = process.env[pathKey] || '';\n if (envPath.indexOf('.nvu/bin') >= 0) return; // path exists\n\n // provide instructions for path setup\n console.log('');\n console.log('============================================================');\n console.log(' Global node setup');\n console.log('============================================================');\n console.log('');\n if (isWindows) {\n console.log(' # Edit your PowerShell profile');\n console.log(' # Open with: notepad $PROFILE');\n console.log(' # Add this line:');\n console.log(' $env:PATH = \"$HOME\\\\.nvu\\\\bin;$env:APPDATA\\\\npm;$env:PATH\"');\n console.log('');\n console.log(' # This adds:');\n console.log(' # ~/.nvu/bin - node/npm version switching shims');\n console.log(' # %APPDATA%/npm - globally installed npm packages (like nvu)');\n } else {\n console.log(' # For bash (~/.bashrc):');\n console.log(' echo \\'export PATH=\"$HOME/.nvu/bin:$PATH\"\\' >> ~/.bashrc');\n console.log('');\n console.log(' # For zsh (~/.zshrc):');\n console.log(' echo \\'export PATH=\"$HOME/.nvu/bin:$PATH\"\\' >> ~/.zshrc');\n console.log('');\n console.log(' # For fish (~/.config/fish/config.fish):');\n console.log(\" echo 'set -gx PATH $HOME/.nvu/bin $PATH' >> ~/.config/fish/config.fish\");\n }\n\n console.log('');\n console.log('Then restart your terminal or source your shell profile.');\n console.log('');\n console.log(\"Without this, 'nvu 18 npm test' still works - you just won't have\");\n console.log(\"transparent 'node' command override.\");\n console.log('============================================================');\n};\n\n/**\n * Main installation function\n */\nmodule.exports.installBinaries = function installBinaries(options, callback): void {\n const archiveBaseName = getArchiveBaseName();\n\n if (!archiveBaseName) {\n callback(new Error('Unsupported platform/architecture for binary.'));\n return;\n }\n\n const extractedBinaryName = `${archiveBaseName}${isWindows ? '.exe' : ''}`;\n const binDir = path.join(storagePath, 'bin');\n\n // check if we need to upgrade\n if (!options.force) {\n try {\n // already installed\n if (fs.statSync(binDir)) {\n if (fs.readFileSync(path.join(binDir, 'version.txt'), 'utf8') === BINARY_VERSION) {\n callback(null, false);\n return;\n }\n }\n } catch (_err) {}\n }\n\n // Create directories\n mkdirp.sync(storagePath);\n mkdirp.sync(binDir);\n\n const downloadUrl = `https://github.com/${GITHUB_REPO}/releases/download/binary-v${BINARY_VERSION}/${archiveBaseName}${isWindows ? '.zip' : '.tar.gz'}`;\n const tempPath = path.join(tmpdir(), `nvu-binary-${Date.now()}${isWindows ? '.zip' : '.tar.gz'}`);\n\n console.log(`Downloading binary for ${process.platform}-${process.arch}...`);\n\n getFile(downloadUrl, tempPath, (err) => {\n if (err) {\n removeIfExistsSync(tempPath);\n callback(new Error(`No prebuilt binary available for ${process.platform}-${process.arch}. Download: ${downloadUrl}. Error: ${err.message}`));\n return;\n }\n\n console.log('Extracting binary...');\n\n extractAndInstall(tempPath, binDir, extractedBinaryName, (err) => {\n removeIfExistsSync(tempPath);\n if (err) return callback(err);\n\n // save binary version for upgrade checks\n fs.writeFileSync(path.join(binDir, 'version.txt'), BINARY_VERSION, 'utf8');\n console.log('Binary installed successfully!');\n callback(null, true);\n });\n });\n};\n"],"names":["envPathKey","require","fs","safeRmSync","getFile","mkdirp","os","path","Queue","moduleRoot","root","__dirname","GITHUB_REPO","BINARY_VERSION","join","binaryVersion","isWindows","process","platform","test","env","OSTYPE","hasHomedir","homedir","home","storagePath","NVU_HOME","hasTmpdir","tmpdir","osShim","removeIfExistsSync","filePath","existsSync","unlinkSync","_e","getArchiveBaseName","arch","platformMap","darwin","linux","win32","archMap","x64","arm64","amd64","platformName","archName","copyFileSync","src","dest","content","readFileSync","writeFileSync","atomicRename","callback","rename","err","code","copyErr","extractArchive","archivePath","Iterator","stream","createReadStream","pipe","createGunzip","iterator","links","forEach","entry","type","unshift","push","create","callbacks","concurrency","_err","queue","index","length","defer","bind","await","destroy","extractAndInstall","destDir","binaryName","ext","tempExtractDir","Date","now","sync","extractedPath","Error","binaries","timestamp","installError","i","name","tempDest","chmodSync","j","tempPath","renameError","doRename","finalDest","module","exports","printInstructions","_nvuBinPath","console","log","pathKey","envPath","indexOf","installBinaries","options","archiveBaseName","extractedBinaryName","binDir","force","statSync","downloadUrl","message"],"mappings":"AAAA,MAAMA,aAAaC,QAAQ;AAC3B,MAAMC,KAAKD,QAAQ;AACnB,MAAM,EAAEE,UAAU,EAAE,GAAGF,QAAQ;AAC/B,MAAMG,UAAUH,QAAQ;AACxB,MAAMI,SAASJ,QAAQ;AACvB,MAAMK,KAAKL,QAAQ;AACnB,MAAMM,OAAON,QAAQ;AACrB,MAAMO,QAAQP,QAAQ;AACtB,MAAMQ,aAAaR,QAAQ;AAE3B,MAAMS,OAAOD,WAAWE;AAExB,gBAAgB;AAChB,MAAMC,cAAc;AACpB,MAAMC,iBAAiBZ,QAAQM,KAAKO,IAAI,CAACJ,MAAM,iBAAiBK,aAAa;AAE7E,MAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAQ3F,MAAMC,aAAa,OAAOhB,GAAGiB,OAAO,KAAK;AACzC,SAASA;IACP,IAAID,YAAY,OAAOhB,GAAGiB,OAAO;IACjC,MAAMC,OAAOvB,QAAQ;IACrB,OAAOuB;AACT;AAEA,sCAAsC;AACtC,MAAMC,cAAeR,QAAQG,GAAG,CAACM,QAAQ,IAAInB,KAAKO,IAAI,CAACS,WAAW;AAElE,MAAMI,YAAY,OAAOrB,GAAGsB,MAAM,KAAK;AACvC,SAASA;IACP,IAAID,WAAW,OAAOrB,GAAGs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5E,QAAQC,QAAQ,CAAC,CAAC,EAAED,QAAQmB,IAAI,CAAC,YAAY,EAAEsF,YAAY,SAAS,EAAElE,IAAImE,OAAO,EAAE;YAC1I;QACF;QAEAb,QAAQC,GAAG,CAAC;QAEZ3B,kBAAkBkB,UAAUiB,QAAQD,qBAAqB,CAAC9D;YACxD1B,mBAAmBwE;YACnB,IAAI9C,KAAK,OAAOF,SAASE;YAEzB,yCAAyC;YACzCtD,GAAGkD,aAAa,CAAC7C,KAAKO,IAAI,CAACyG,QAAQ,gBAAgB1G,gBAAgB;YACnEiG,QAAQC,GAAG,CAAC;YACZzD,SAAS,MAAM;QACjB;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-version-use/src/assets/installBinaries.cts"],"sourcesContent":["const envPathKey = require('env-path-key');\nconst fs = require('fs');\nconst { safeRmSync } = require('fs-remove-compat');\nconst getFile = require('get-file-compat');\nconst mkdirp = require('mkdirp-classic');\nconst os = require('os');\nconst path = require('path');\nconst Queue = require('queue-cb');\nconst moduleRoot = require('module-root-sync');\n\nconst root = moduleRoot(__dirname);\n\n// Configuration\nconst GITHUB_REPO = 'kmalakoff/node-version-use';\nconst BINARY_VERSION = require(path.join(root, 'package.json')).binaryVersion;\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\ntype Callback = (err?: Error | null) => void;\n\ninterface PlatformMap {\n [key: string]: string;\n}\n\nconst hasHomedir = typeof os.homedir === 'function';\nfunction homedir(): string {\n if (hasHomedir) return os.homedir();\n const home = require('homedir-polyfill');\n return home();\n}\n\n// Allow NVU_HOME override for testing\nconst storagePath = (process.env.NVU_HOME || path.join(homedir(), '.nvu')) as string;\n\nconst hasTmpdir = typeof os.tmpdir === 'function';\nfunction tmpdir(): string {\n if (hasTmpdir) return os.tmpdir();\n const osShim = require('os-shim');\n return osShim.tmpdir();\n}\n\nfunction removeIfExistsSync(filePath: string): void {\n if (fs.existsSync(filePath)) {\n try {\n fs.unlinkSync(filePath);\n } catch (_e) {\n // ignore cleanup errors\n }\n }\n}\n\n/**\n * On Windows, rename a file out of the way instead of deleting.\n * This works even if the file is currently running.\n */\nfunction moveOutOfWay(filePath: string): void {\n if (!fs.existsSync(filePath)) return;\n\n const timestamp = Date.now();\n const oldPath = `${filePath}.old-${timestamp}`;\n\n try {\n fs.renameSync(filePath, oldPath);\n } catch (_e) {\n // If rename fails, try delete as fallback (works on Unix)\n try {\n fs.unlinkSync(filePath);\n } catch (_e2) {\n // ignore - will fail on atomic rename instead\n }\n }\n}\n\n/**\n * Clean up old .old-* files from previous installs\n */\nfunction cleanupOldFiles(dir: string): void {\n try {\n const entries = fs.readdirSync(dir);\n for (const entry of entries) {\n if (entry.includes('.old-')) {\n try {\n fs.unlinkSync(path.join(dir, entry));\n } catch (_e) {\n // ignore - file may still be in use\n }\n }\n }\n } catch (_e) {\n // ignore if dir doesn't exist\n }\n}\n\n/**\n * Get the platform-specific archive base name (without extension)\n */\nfunction getArchiveBaseName(): string | null {\n const { platform, arch } = process;\n\n const platformMap: PlatformMap = {\n darwin: 'darwin',\n linux: 'linux',\n win32: 'win32',\n };\n\n const archMap: PlatformMap = {\n x64: 'x64',\n arm64: 'arm64',\n amd64: 'x64',\n };\n\n const platformName = platformMap[platform];\n const archName = archMap[arch];\n\n if (!platformName || !archName) return null;\n return `nvu-binary-${platformName}-${archName}`;\n}\n\n/**\n * Copy file\n */\nfunction copyFileSync(src: string, dest: string): void {\n const content = fs.readFileSync(src);\n fs.writeFileSync(dest, content);\n}\n\n/**\n * Atomic rename with fallback to copy+delete for cross-device moves\n */\nfunction atomicRename(src: string, dest: string, callback: Callback) {\n fs.rename(src, dest, (err) => {\n if (!err) return callback(null);\n\n // Cross-device link error - fall back to copy + delete\n if ((err as NodeJS.ErrnoException).code === 'EXDEV') {\n try {\n copyFileSync(src, dest);\n fs.unlinkSync(src);\n callback(null);\n } catch (copyErr) {\n callback(copyErr as Error);\n }\n return;\n }\n\n callback(err);\n });\n}\n\n/**\n * Extract archive to a directory (callback-based)\n */\nfunction extractArchive(archivePath: string, dest: string, callback: Callback) {\n const Iterator = isWindows ? require('zip-iterator') : require('tar-iterator');\n const stream = isWindows ? fs.createReadStream(archivePath) : fs.createReadStream(archivePath).pipe(require('zlib').createGunzip());\n let iterator = new Iterator(stream);\n\n // one by one\n const links = [];\n iterator.forEach(\n (entry, callback) => {\n if (entry.type === 'link') {\n links.unshift(entry);\n callback();\n } else if (entry.type === 'symlink') {\n links.push(entry);\n callback();\n } else entry.create(dest, callback);\n },\n { callbacks: true, concurrency: 1 },\n (_err) => {\n // create links after directories and files\n const queue = new Queue();\n for (let index = 0; index < links.length; index++) {\n const entry = links[index];\n queue.defer(entry.create.bind(entry, dest));\n }\n queue.await((err) => {\n iterator.destroy();\n iterator = null;\n callback(err);\n });\n }\n );\n}\n\n/**\n * Install binaries using atomic rename pattern\n * 1. Extract to temp directory\n * 2. Copy binary to temp files in destination directory\n * 3. Atomic rename temp files to final names\n */\nfunction extractAndInstall(archivePath: string, destDir: string, binaryName: string, callback: Callback) {\n const ext = isWindows ? '.exe' : '';\n\n // Create temp extraction directory\n const tempExtractDir = path.join(tmpdir(), `nvu-extract-${Date.now()}`);\n mkdirp.sync(tempExtractDir);\n\n extractArchive(archivePath, tempExtractDir, (err) => {\n if (err) {\n safeRmSync(tempExtractDir);\n callback(err);\n return;\n }\n\n const extractedPath = path.join(tempExtractDir, binaryName);\n if (!fs.existsSync(extractedPath)) {\n safeRmSync(tempExtractDir);\n callback(new Error(`Extracted binary not found: ${binaryName}. ${archivePath} ${tempExtractDir}`));\n return;\n }\n\n // Binary names to install\n const binaries = ['node', 'npm', 'npx', 'corepack'];\n const timestamp = Date.now();\n let installError: Error | null = null;\n\n // Step 1: Copy extracted binary to temp files in destination directory\n // This ensures the temp files are on the same filesystem for atomic rename\n for (let i = 0; i < binaries.length; i++) {\n const name = binaries[i];\n const tempDest = path.join(destDir, `${name}.tmp-${timestamp}${ext}`);\n\n try {\n // Copy to temp file in destination directory\n copyFileSync(extractedPath, tempDest);\n\n // Set permissions on Unix\n if (!isWindows) fs.chmodSync(tempDest, 0o755);\n } catch (err) {\n installError = err as Error;\n break;\n }\n }\n\n if (installError) {\n // Clean up any temp files we created\n for (let j = 0; j < binaries.length; j++) {\n const tempPath = path.join(destDir, `${binaries[j]}.tmp-${timestamp}${ext}`);\n removeIfExistsSync(tempPath);\n }\n safeRmSync(tempExtractDir);\n callback(installError);\n return;\n }\n\n // Step 2: Atomic rename temp files to final names\n let renameError: Error | null = null;\n\n function doRename(index: number): void {\n if (index >= binaries.length) {\n // All renames complete\n safeRmSync(tempExtractDir);\n callback(renameError);\n return;\n }\n\n const name = binaries[index];\n const tempDest = path.join(destDir, `${name}.tmp-${timestamp}${ext}`);\n const finalDest = path.join(destDir, `${name}${ext}`);\n\n // Move existing file out of the way (works even if running on Windows)\n moveOutOfWay(finalDest);\n\n atomicRename(tempDest, finalDest, (err) => {\n if (err && !renameError) {\n renameError = err;\n }\n doRename(index + 1);\n });\n }\n\n doRename(0);\n });\n}\n\n/**\n * Print setup instructions\n */\nmodule.exports.printInstructions = function printInstructions(): void {\n const _nvuBinPath = path.join(storagePath, 'bin');\n\n console.log('nvu binaries installed in ~/.nvu/bin/');\n\n const pathKey = envPathKey();\n const envPath = process.env[pathKey] || '';\n if (envPath.indexOf('.nvu/bin') >= 0) return; // path exists\n\n // provide instructions for path setup\n console.log('');\n console.log('============================================================');\n console.log(' Global node setup');\n console.log('============================================================');\n console.log('');\n if (isWindows) {\n console.log(' # Edit your PowerShell profile');\n console.log(' # Open with: notepad $PROFILE');\n console.log(' # Add this line:');\n console.log(' $env:PATH = \"$HOME\\\\.nvu\\\\bin;$env:APPDATA\\\\npm;$env:PATH\"');\n console.log('');\n console.log(' # This adds:');\n console.log(' # ~/.nvu/bin - node/npm version switching shims');\n console.log(' # %APPDATA%/npm - globally installed npm packages (like nvu)');\n } else {\n console.log(' # For bash (~/.bashrc):');\n console.log(' echo \\'export PATH=\"$HOME/.nvu/bin:$PATH\"\\' >> ~/.bashrc');\n console.log('');\n console.log(' # For zsh (~/.zshrc):');\n console.log(' echo \\'export PATH=\"$HOME/.nvu/bin:$PATH\"\\' >> ~/.zshrc');\n console.log('');\n console.log(' # For fish (~/.config/fish/config.fish):');\n console.log(\" echo 'set -gx PATH $HOME/.nvu/bin $PATH' >> ~/.config/fish/config.fish\");\n }\n\n console.log('');\n console.log('Then restart your terminal or source your shell profile.');\n console.log('');\n console.log(\"Without this, 'nvu 18 npm test' still works - you just won't have\");\n console.log(\"transparent 'node' command override.\");\n console.log('============================================================');\n};\n\n/**\n * Main installation function\n */\nmodule.exports.installBinaries = function installBinaries(options, callback): void {\n const archiveBaseName = getArchiveBaseName();\n\n if (!archiveBaseName) {\n callback(new Error('Unsupported platform/architecture for binary.'));\n return;\n }\n\n const extractedBinaryName = `${archiveBaseName}${isWindows ? '.exe' : ''}`;\n const binDir = path.join(storagePath, 'bin');\n\n // check if we need to upgrade\n if (!options.force) {\n try {\n // already installed\n if (fs.statSync(binDir)) {\n if (fs.readFileSync(path.join(binDir, 'version.txt'), 'utf8') === BINARY_VERSION) {\n callback(null, false);\n return;\n }\n }\n } catch (_err) {}\n }\n\n // Create directories\n mkdirp.sync(storagePath);\n mkdirp.sync(binDir);\n\n // Clean up old .old-* files from previous installs\n cleanupOldFiles(binDir);\n\n const downloadUrl = `https://github.com/${GITHUB_REPO}/releases/download/binary-v${BINARY_VERSION}/${archiveBaseName}${isWindows ? '.zip' : '.tar.gz'}`;\n const tempPath = path.join(tmpdir(), `nvu-binary-${Date.now()}${isWindows ? '.zip' : '.tar.gz'}`);\n\n console.log(`Downloading binary for ${process.platform}-${process.arch}...`);\n\n getFile(downloadUrl, tempPath, (err) => {\n if (err) {\n removeIfExistsSync(tempPath);\n callback(new Error(`No prebuilt binary available for ${process.platform}-${process.arch}. Download: ${downloadUrl}. Error: ${err.message}`));\n return;\n }\n\n console.log('Extracting binary...');\n\n extractAndInstall(tempPath, binDir, extractedBinaryName, (err) => {\n removeIfExistsSync(tempPath);\n if (err) return callback(err);\n\n // save binary version for upgrade checks\n fs.writeFileSync(path.join(binDir, 'version.txt'), BINARY_VERSION, 'utf8');\n console.log('Binary installed successfully!');\n callback(null, true);\n });\n });\n};\n"],"names":["envPathKey","require","fs","safeRmSync","getFile","mkdirp","os","path","Queue","moduleRoot","root","__dirname","GITHUB_REPO","BINARY_VERSION","join","binaryVersion","isWindows","process","platform","test","env","OSTYPE","hasHomedir","homedir","home","storagePath","NVU_HOME","hasTmpdir","tmpdir","osShim","removeIfExistsSync","filePath","existsSync","unlinkSync","_e","moveOutOfWay","timestamp","Date","now","oldPath","renameSync","_e2","cleanupOldFiles","dir","entries","readdirSync","entry","includes","getArchiveBaseName","arch","platformMap","darwin","linux","win32","archMap","x64","arm64","amd64","platformName","archName","copyFileSync","src","dest","content","readFileSync","writeFileSync","atomicRename","callback","rename","err","code","copyErr","extractArchive","archivePath","Iterator","stream","createReadStream","pipe","createGunzip","iterator","links","forEach","type","unshift","push","create","callbacks","concurrency","_err","queue","index","length","defer","bind","await","destroy","extractAndInstall","destDir","binaryName","ext","tempExtractDir","sync","extractedPath","Error","binaries","installError","i","name","tempDest","chmodSync","j","tempPath","renameError","doRename","finalDest","module","exports","printInstructions","_nvuBinPath","console","log","pathKey","envPath","indexOf","installBinaries","options","archiveBaseName","extractedBinaryName","binDir","force","statSync","downloadUrl","message"],"mappings":"AAAA,MAAMA,aAAaC,QAAQ;AAC3B,MAAMC,KAAKD,QAAQ;AACnB,MAAM,EAAEE,UAAU,EAAE,GAAGF,QAAQ;AAC/B,MAAMG,UAAUH,QAAQ;AACxB,MAAMI,SAASJ,QAAQ;AACvB,MAAMK,KAAKL,QAAQ;AACnB,MAAMM,OAAON,QAAQ;AACrB,MAAMO,QAAQP,QAAQ;AACtB,MAAMQ,aAAaR,QAAQ;AAE3B,MAAMS,OAAOD,WAAWE;AAExB,gBAAgB;AAChB,MAAMC,cAA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AS,IAAIoC,MAAM,CAAC,iCAAiC,EAAEtF,QAAQC,QAAQ,CAAC,CAAC,EAAED,QAAQgC,IAAI,CAAC,YAAY,EAAEkF,YAAY,SAAS,EAAE9D,IAAI+D,OAAO,EAAE;YAC1I;QACF;QAEAb,QAAQC,GAAG,CAAC;QAEZxB,kBAAkBe,UAAUiB,QAAQD,qBAAqB,CAAC1D;YACxDvC,mBAAmBiF;YACnB,IAAI1C,KAAK,OAAOF,SAASE;YAEzB,yCAAyC;YACzCnE,GAAG+D,aAAa,CAAC1D,KAAKO,IAAI,CAACkH,QAAQ,gBAAgBnH,gBAAgB;YACnE0G,QAAQC,GAAG,CAAC;YACZrD,SAAS,MAAM;QACjB;IACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-version-use",
3
- "version": "2.1.11",
3
+ "version": "2.3.0",
4
4
  "description": "Cross-platform solution for using multiple versions of node. Useful for compatibility testing",
5
5
  "keywords": [
6
6
  "node",