Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove electron/remote dep from core #9265

Merged
merged 1 commit into from
Jan 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"npm": ">=6.9.0"
},
"dependencies": {
"@electron/remote": "^2.0.9",
"@kui-shell/client": "file:plugins/plugin-client-default",
"@kui-shell/core": "file:packages/core",
"@kui-shell/plugin-bash-like": "file:plugins/plugin-bash-like",
Expand Down
3 changes: 0 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,15 @@
"@types/yargs-parser": "^21.0.0"
},
"dependencies": {
"@electron/remote": "^2.0.9",
"colors": "^1.4.0",
"columnify": "^1.6.0",
"debug": "^4.3.4",
"fs-extra": "^11.1.0",
"mkdirp": "^1.0.4",
"pretty-ms": "^7.0.1",
"properties-parser": "^0.3.1",
"tmp": "^0.2.1",
"trie-search": "^1.3.6",
"uuid": "^9.0.0",
"word-wrap": "^1.2.3",
"yargs-parser": "^21.1.1"
},
"publishConfig": {
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/main/spawn-electron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,11 @@ export async function createWindow(
}

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

Expand Down
2 changes: 2 additions & 0 deletions plugins/plugin-bash-like/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"devDependencies": {
"@types/cookie": "^0.5.1",
"@types/debug": "^4.1.7",
"@types/properties-parser": "0.3.0",
"@types/shelljs": "^0.8.11",
"@types/tmp": "^0.2.3",
"@types/uuid": "^9.0.0"
Expand All @@ -40,6 +41,7 @@
"debug": "^4.3.4",
"globby": "^11.0.4",
"node-pty": "0.11.0-beta27",
"properties-parser": "0.3.1",
"shelljs": "^0.8.5",
"slash": "^3.0.0",
"speed-date": "^1.0.0",
Expand Down
4 changes: 2 additions & 2 deletions plugins/plugin-bash-like/src/pty/prefetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import Debug from 'debug'
const debug = Debug('plugins/bash-like/pty/prefetch')

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

/**
* Preprocess bash/zsh environment variables
Expand All @@ -37,7 +36,7 @@ function prefetchEnv() {
const shell = await getLoginShell()
debug('prefetchEnv got shell', shell)

exec(`${shell} -l -c printenv`, (err, stdout, stderr) => {
exec(`${shell} -l -c printenv`, async (err, stdout, stderr) => {
try {
if (stderr) {
debug(stderr)
Expand All @@ -46,6 +45,7 @@ function prefetchEnv() {
debug('error in prefetchEnv 1', err)
reject(err)
} else {
const { default: propertiesParser } = await import('properties-parser')
const env = propertiesParser.parse(stdout.toString())
debug('got env', env)
for (const key in env) {
Expand Down