Skip to content

Commit 2c6c7cb

Browse files
Refactor launcher path resolution in index.js
1 parent a28c784 commit 2c6c7cb

1 file changed

Lines changed: 7 additions & 15 deletions

File tree

cli/release/index.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
#!/usr/bin/env node
2-
2+
'use strict'
33
const fs = require('fs')
44
const path = require('path')
55

6-
const packagedLauncherPath = path.join(__dirname, 'launcher.js')
7-
const sourceLauncherPath = path.join(
8-
__dirname,
9-
'..',
10-
'release-core',
11-
'launcher.js',
12-
)
13-
// Published packages must not let an unrelated sibling path shadow their
14-
// bundled launcher. Source checkouts only fall back when that copy is absent.
6+
const packaged = path.join(__dirname, 'launcher.js')
7+
const source = path.join(__dirname, '..', 'release-core', 'launcher.js')
8+
159
const { createLauncher } = require(
16-
fs.existsSync(packagedLauncherPath)
17-
? packagedLauncherPath
18-
: sourceLauncherPath,
10+
fs.existsSync(packaged) ? packaged : source
1911
)
2012

2113
const launcher = createLauncher({
@@ -28,8 +20,8 @@ const launcher = createLauncher({
2820
module.exports = launcher
2921

3022
if (require.main === module) {
31-
launcher.main().catch((error) => {
32-
console.error('❌ Unexpected error:', error.message)
23+
launcher.main().catch(err => {
24+
console.error('❌ Unexpected error:', err.message)
3325
process.exit(1)
3426
})
3527
}

0 commit comments

Comments
 (0)