fix: electron cannot be started in Windows (#2784)

This commit is contained in:
JimmFly
2023-06-15 06:16:27 +00:00
committed by GitHub
parent 9fd4818d81
commit 7eaff644e3
5 changed files with 8 additions and 5 deletions
+1
View File
@@ -57,6 +57,7 @@
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"undici": "^5.22.1", "undici": "^5.22.1",
"uuid": "^9.0.0", "uuid": "^9.0.0",
"which": "^3.0.1",
"zx": "^7.2.2" "zx": "^7.2.2"
}, },
"dependencies": { "dependencies": {
+3 -2
View File
@@ -5,6 +5,7 @@ import path, { resolve } from 'node:path';
import electronPath from 'electron'; import electronPath from 'electron';
import * as esbuild from 'esbuild'; import * as esbuild from 'esbuild';
import which from 'which';
import { config, electronDir, rootDir } from './common.mjs'; import { config, electronDir, rootDir } from './common.mjs';
@@ -67,9 +68,9 @@ function spawnOrReloadElectron() {
} }
const common = config(); const common = config();
const yarnPath = which.sync('yarn');
async function watchPlugins() { async function watchPlugins() {
spawn('yarn', ['dev'], { spawn(yarnPath, ['dev'], {
stdio: 'inherit', stdio: 'inherit',
cwd: resolve(rootDir, './packages/plugin-infra'), cwd: resolve(rootDir, './packages/plugin-infra'),
}); });
+1 -1
View File
@@ -38,7 +38,7 @@ export function registerPlugin() {
'./bookmark-block/index.mjs' './bookmark-block/index.mjs'
); );
logger.info('bookmark plugin path:', bookmarkPluginPath); logger.info('bookmark plugin path:', bookmarkPluginPath);
import(bookmarkPluginPath); import('file://' + bookmarkPluginPath);
let dispose: () => void = () => { let dispose: () => void = () => {
// noop // noop
}; };
@@ -34,7 +34,7 @@ import('@toeverything/plugin-infra/manager')
console.log('import bookmark plugin', bookmarkPluginPath); console.log('import bookmark plugin', bookmarkPluginPath);
import(bookmarkPluginPath).catch(console.log); import('file://' + bookmarkPluginPath).catch(console.log);
rootStore.sub(affinePluginsAtom, () => { rootStore.sub(affinePluginsAtom, () => {
const plugins = rootStore.get(affinePluginsAtom); const plugins = rootStore.get(affinePluginsAtom);
Object.values(plugins).forEach(plugin => { Object.values(plugins).forEach(plugin => {
+2 -1
View File
@@ -193,6 +193,7 @@ __metadata:
ts-node: ^10.9.1 ts-node: ^10.9.1
undici: ^5.22.1 undici: ^5.22.1
uuid: ^9.0.0 uuid: ^9.0.0
which: ^3.0.1
yjs: ^13.6.1 yjs: ^13.6.1
zx: ^7.2.2 zx: ^7.2.2
peerDependencies: peerDependencies:
@@ -28301,7 +28302,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"which@npm:^3.0.0": "which@npm:^3.0.0, which@npm:^3.0.1":
version: 3.0.1 version: 3.0.1
resolution: "which@npm:3.0.1" resolution: "which@npm:3.0.1"
dependencies: dependencies: