electerm 3.3.1 → 3.3.3
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/npm/electerm +6 -33
- package/npm/install.js +25 -20
- package/package.json +1 -1
package/npm/electerm
CHANGED
|
@@ -18,56 +18,37 @@ const os = require('os')
|
|
|
18
18
|
const plat = os.platform()
|
|
19
19
|
const packageRoot = path.resolve(__dirname, '..')
|
|
20
20
|
|
|
21
|
-
/**
|
|
22
|
-
* Get the path to the installed electerm binary
|
|
23
|
-
*/
|
|
24
21
|
function getElectermExePath () {
|
|
25
|
-
// macOS: prefer the installed app in /Applications
|
|
26
22
|
if (plat === 'darwin') {
|
|
27
23
|
const appBinary = '/Applications/electerm.app/Contents/MacOS/electerm'
|
|
28
24
|
if (fs.existsSync(appBinary)) {
|
|
29
25
|
return appBinary
|
|
30
26
|
}
|
|
31
|
-
// Fallback: extracted folder
|
|
32
27
|
return path.join(packageRoot, 'electerm', 'electerm')
|
|
33
28
|
}
|
|
34
29
|
|
|
35
|
-
// Windows
|
|
36
30
|
if (plat === 'win32') {
|
|
37
31
|
return path.join(packageRoot, 'electerm', 'electerm.exe')
|
|
38
32
|
}
|
|
39
33
|
|
|
40
|
-
// Linux
|
|
41
34
|
return path.join(packageRoot, 'electerm', 'electerm')
|
|
42
35
|
}
|
|
43
36
|
|
|
44
|
-
/**
|
|
45
|
-
* Check if the electerm binary exists
|
|
46
|
-
*/
|
|
47
|
-
function isElectermInstalled () {
|
|
48
|
-
return fs.existsSync(getElectermExePath())
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Launch the installed electerm binary
|
|
53
|
-
*/
|
|
54
37
|
function launchElecterm () {
|
|
55
38
|
const exePath = getElectermExePath()
|
|
56
39
|
|
|
57
40
|
if (!fs.existsSync(exePath)) {
|
|
58
|
-
console.error('
|
|
41
|
+
console.error('electerm binary not found at:', exePath)
|
|
59
42
|
console.error('')
|
|
60
|
-
console.error('The binary may not have been installed.
|
|
43
|
+
console.error('The binary may not have been installed properly.')
|
|
44
|
+
console.error('Try running manually:')
|
|
61
45
|
console.error(' node', path.join(packageRoot, 'npm', 'install.js'))
|
|
62
46
|
process.exit(1)
|
|
63
47
|
}
|
|
64
48
|
|
|
65
|
-
// Spawn the binary, passing through all args
|
|
66
49
|
const child = spawn(exePath, process.argv.slice(2), {
|
|
67
50
|
stdio: 'inherit',
|
|
68
|
-
// On macOS/Linux, detach so the app survives if the terminal closes
|
|
69
51
|
detached: plat !== 'win32',
|
|
70
|
-
// On Windows, don't create a console window for the spawn
|
|
71
52
|
windowsHide: false
|
|
72
53
|
})
|
|
73
54
|
|
|
@@ -85,16 +66,8 @@ function launchElecterm () {
|
|
|
85
66
|
})
|
|
86
67
|
}
|
|
87
68
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
// ---------------------------------------------------------------------------
|
|
91
|
-
|
|
92
|
-
if (!isElectermInstalled()) {
|
|
93
|
-
console.error('electerm binary not found. It should have been installed during npm install.')
|
|
94
|
-
console.error('')
|
|
95
|
-
console.error('Try running manually:')
|
|
96
|
-
console.error(' node', path.join(packageRoot, 'npm', 'install.js'))
|
|
97
|
-
process.exit(1)
|
|
69
|
+
if (require.main === module) {
|
|
70
|
+
launchElecterm()
|
|
98
71
|
}
|
|
99
72
|
|
|
100
|
-
launchElecterm
|
|
73
|
+
module.exports = { launchElecterm }
|
package/npm/install.js
CHANGED
|
@@ -191,6 +191,15 @@ async function runLinux (folderName, filePattern) {
|
|
|
191
191
|
console.log(` Installing to: ${extractDir}`)
|
|
192
192
|
mv(join(tmpDir, extractedFolder), extractDir)
|
|
193
193
|
|
|
194
|
+
// Fix chrome-sandbox permissions on Linux (Electron requires specific permissions)
|
|
195
|
+
if (plat === 'linux') {
|
|
196
|
+
const chromeSandboxPath = join(extractDir, 'chrome-sandbox')
|
|
197
|
+
if (fs.existsSync(chromeSandboxPath)) {
|
|
198
|
+
console.log(' Fixing chrome-sandbox permissions...')
|
|
199
|
+
fs.chmodSync(chromeSandboxPath, 0o4755)
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
194
203
|
// Clean up temp files
|
|
195
204
|
rm('-rf', tmpDir)
|
|
196
205
|
|
|
@@ -207,6 +216,7 @@ async function runWin (archName) {
|
|
|
207
216
|
const target = join(packageRoot, `electerm-${ver}-win-${archName}`)
|
|
208
217
|
|
|
209
218
|
rm('-rf', [target, extractDir])
|
|
219
|
+
fs.mkdirSync(extractDir, { recursive: true })
|
|
210
220
|
|
|
211
221
|
const pattern = new RegExp(`electerm-\\d+\\.\\d+\\.\\d+-win-${archName}\\.tar\\.gz$`)
|
|
212
222
|
console.log(' Fetching release info...')
|
|
@@ -215,7 +225,8 @@ async function runWin (archName) {
|
|
|
215
225
|
throw new Error(`No release found for Windows ${archName}`)
|
|
216
226
|
}
|
|
217
227
|
|
|
218
|
-
//
|
|
228
|
+
// Download to a temp file, then extract directly to extractDir with strip:1
|
|
229
|
+
// (avoids a rename which can fail on Windows when AV has file locks)
|
|
219
230
|
const tmpDir = join(packageRoot, '.electerm-tmp')
|
|
220
231
|
rm('-rf', tmpDir)
|
|
221
232
|
fs.mkdirSync(tmpDir, { recursive: true })
|
|
@@ -225,19 +236,16 @@ async function runWin (archName) {
|
|
|
225
236
|
|
|
226
237
|
const { filepath } = await download(releaseInfo.browser_download_url, tmpDir, { extract: false, displayName: releaseInfo.name })
|
|
227
238
|
|
|
228
|
-
|
|
239
|
+
console.log(` Installing to: ${extractDir}`)
|
|
240
|
+
await extractTarGz(filepath, extractDir, 1)
|
|
229
241
|
|
|
230
|
-
|
|
231
|
-
const extractedFolder = entries.find(e => fs.statSync(join(tmpDir, e)).isDirectory())
|
|
242
|
+
rm('-rf', tmpDir)
|
|
232
243
|
|
|
233
|
-
|
|
234
|
-
|
|
244
|
+
const exePath = getElectermExePath()
|
|
245
|
+
if (!fs.existsSync(exePath)) {
|
|
246
|
+
throw new Error(`electerm.exe not found at ${exePath} after extraction. Archive may have an unexpected structure.`)
|
|
235
247
|
}
|
|
236
248
|
|
|
237
|
-
console.log(` Installing to: ${extractDir}`)
|
|
238
|
-
mv(join(tmpDir, extractedFolder), extractDir)
|
|
239
|
-
rm('-rf', tmpDir)
|
|
240
|
-
|
|
241
249
|
showFinalMessage()
|
|
242
250
|
}
|
|
243
251
|
|
|
@@ -251,6 +259,7 @@ async function runWin7 () {
|
|
|
251
259
|
const target = join(packageRoot, `electerm-${ver}-win7`)
|
|
252
260
|
|
|
253
261
|
rm('-rf', [target, extractDir])
|
|
262
|
+
fs.mkdirSync(extractDir, { recursive: true })
|
|
254
263
|
|
|
255
264
|
console.log(' Fetching release info...')
|
|
256
265
|
const releaseInfo = await getReleaseInfo(r => /electerm-\d+\.\d+\.\d+-win7\.tar\.gz$/.test(r.name))
|
|
@@ -258,7 +267,6 @@ async function runWin7 () {
|
|
|
258
267
|
throw new Error('No release found for Windows 7')
|
|
259
268
|
}
|
|
260
269
|
|
|
261
|
-
// Extract to temp, then move
|
|
262
270
|
const tmpDir = join(packageRoot, '.electerm-tmp')
|
|
263
271
|
rm('-rf', tmpDir)
|
|
264
272
|
fs.mkdirSync(tmpDir, { recursive: true })
|
|
@@ -268,19 +276,16 @@ async function runWin7 () {
|
|
|
268
276
|
|
|
269
277
|
const { filepath } = await download(releaseInfo.browser_download_url, tmpDir, { extract: false, displayName: releaseInfo.name })
|
|
270
278
|
|
|
271
|
-
|
|
279
|
+
console.log(` Installing to: ${extractDir}`)
|
|
280
|
+
await extractTarGz(filepath, extractDir, 1)
|
|
272
281
|
|
|
273
|
-
|
|
274
|
-
const extractedFolder = entries.find(e => fs.statSync(join(tmpDir, e)).isDirectory())
|
|
282
|
+
rm('-rf', tmpDir)
|
|
275
283
|
|
|
276
|
-
|
|
277
|
-
|
|
284
|
+
const exePath = getElectermExePath()
|
|
285
|
+
if (!fs.existsSync(exePath)) {
|
|
286
|
+
throw new Error(`electerm.exe not found at ${exePath} after extraction. Archive may have an unexpected structure.`)
|
|
278
287
|
}
|
|
279
288
|
|
|
280
|
-
console.log(` Installing to: ${extractDir}`)
|
|
281
|
-
mv(join(tmpDir, extractedFolder), extractDir)
|
|
282
|
-
rm('-rf', tmpDir)
|
|
283
|
-
|
|
284
289
|
showFinalMessage()
|
|
285
290
|
}
|
|
286
291
|
|