Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit cef337e

Browse files
committed
fix: remove electron/remote dep from core
This PR also removes some old unused deps from the core. Doing this identified a missing dep in plugin-bash-like (on properties-parser). This PR thus also adds that dep to plugin-bash-like, and adds the properties-parser types, and then shifts a require to an import.
1 parent 340cce9 commit cef337e

File tree

6 files changed

+33
-12
lines changed

6 files changed

+33
-12
lines changed

package-lock.json

Lines changed: 23 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"npm": ">=6.9.0"
6060
},
6161
"dependencies": {
62+
"@electron/remote": "^2.0.9",
6263
"@kui-shell/client": "file:plugins/plugin-client-default",
6364
"@kui-shell/core": "file:packages/core",
6465
"@kui-shell/plugin-bash-like": "file:plugins/plugin-bash-like",

packages/core/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,15 @@
4343
"@types/yargs-parser": "^21.0.0"
4444
},
4545
"dependencies": {
46-
"@electron/remote": "^2.0.9",
4746
"colors": "^1.4.0",
4847
"columnify": "^1.6.0",
4948
"debug": "^4.3.4",
5049
"fs-extra": "^11.1.0",
5150
"mkdirp": "^1.0.4",
5251
"pretty-ms": "^7.0.1",
53-
"properties-parser": "^0.3.1",
5452
"tmp": "^0.2.1",
5553
"trie-search": "^1.3.6",
5654
"uuid": "^9.0.0",
57-
"word-wrap": "^1.2.3",
5855
"yargs-parser": "^21.1.1"
5956
},
6057
"publishConfig": {

packages/core/src/main/spawn-electron.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,11 @@ export async function createWindow(
264264
}
265265

266266
if (electronRemoteNeedsInit) {
267-
require('@electron/remote/main').initialize()
267+
// some hacks to allow @kui-shell/core to avoid specifying a
268+
// direct dependence on @electron/remote; this dep pulls in
269+
// all of electron, which some clients will not need
270+
const foolWebpackHack = 'index.js'
271+
require('@electron/remote/main/' + foolWebpackHack).initialize()
268272
electronRemoteNeedsInit = false
269273
}
270274

plugins/plugin-bash-like/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"devDependencies": {
3131
"@types/cookie": "^0.5.1",
3232
"@types/debug": "^4.1.7",
33+
"@types/properties-parser": "0.3.0",
3334
"@types/shelljs": "^0.8.11",
3435
"@types/tmp": "^0.2.3",
3536
"@types/uuid": "^9.0.0"
@@ -40,6 +41,7 @@
4041
"debug": "^4.3.4",
4142
"globby": "^11.0.4",
4243
"node-pty": "0.11.0-beta27",
44+
"properties-parser": "0.3.1",
4345
"shelljs": "^0.8.5",
4446
"slash": "^3.0.0",
4547
"speed-date": "^1.0.0",

plugins/plugin-bash-like/src/pty/prefetch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import Debug from 'debug'
1818
const debug = Debug('plugins/bash-like/pty/prefetch')
1919

2020
import { exec } from 'child_process'
21-
import * as propertiesParser from 'properties-parser'
2221

2322
/**
2423
* Preprocess bash/zsh environment variables
@@ -37,7 +36,7 @@ function prefetchEnv() {
3736
const shell = await getLoginShell()
3837
debug('prefetchEnv got shell', shell)
3938

40-
exec(`${shell} -l -c printenv`, (err, stdout, stderr) => {
39+
exec(`${shell} -l -c printenv`, async (err, stdout, stderr) => {
4140
try {
4241
if (stderr) {
4342
debug(stderr)
@@ -46,6 +45,7 @@ function prefetchEnv() {
4645
debug('error in prefetchEnv 1', err)
4746
reject(err)
4847
} else {
48+
const { default: propertiesParser } = await import('properties-parser')
4949
const env = propertiesParser.parse(stdout.toString())
5050
debug('got env', env)
5151
for (const key in env) {

0 commit comments

Comments
 (0)