From 2c6c7cbd3557fdf598d9b0c6f7574c77eb20ff99 Mon Sep 17 00:00:00 2001 From: Gugu8 Date: Tue, 8 Sep 2026 19:22:35 +1200 Subject: [PATCH] Refactor launcher path resolution in index.js --- cli/release/index.js | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/cli/release/index.js b/cli/release/index.js index abd8193784..f055ab967a 100644 --- a/cli/release/index.js +++ b/cli/release/index.js @@ -1,21 +1,13 @@ #!/usr/bin/env node - +'use strict' const fs = require('fs') const path = require('path') -const packagedLauncherPath = path.join(__dirname, 'launcher.js') -const sourceLauncherPath = path.join( - __dirname, - '..', - 'release-core', - 'launcher.js', -) -// Published packages must not let an unrelated sibling path shadow their -// bundled launcher. Source checkouts only fall back when that copy is absent. +const packaged = path.join(__dirname, 'launcher.js') +const source = path.join(__dirname, '..', 'release-core', 'launcher.js') + const { createLauncher } = require( - fs.existsSync(packagedLauncherPath) - ? packagedLauncherPath - : sourceLauncherPath, + fs.existsSync(packaged) ? packaged : source ) const launcher = createLauncher({ @@ -28,8 +20,8 @@ const launcher = createLauncher({ module.exports = launcher if (require.main === module) { - launcher.main().catch((error) => { - console.error('❌ Unexpected error:', error.message) + launcher.main().catch(err => { + console.error('❌ Unexpected error:', err.message) process.exit(1) }) }