Skip to content

Commit

Permalink
feat: support react developer tools
Browse files Browse the repository at this point in the history
  • Loading branch information
yantze committed May 20, 2022
1 parent 18c5d0d commit 139b2ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
"css-loader": "^2.1.1",
"electron": "18.0.3",
"electron-builder": "^23.0.3",
"electron-devtools-installer": "^3.2.0",
"electron-rebuild": "^3.2.7",
"eslint": "^8.11.0",
"eslint-config-prettier": "^8.5.0",
Expand Down
9 changes: 9 additions & 0 deletions src/main/launch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { isOSX, URI } from '@opensumi/ide-core-common';
import { MainModule } from './services';
import { OpenSumiDesktopMainModule } from './module';
import { WebviewElectronMainModule } from '@opensumi/ide-webview/lib/electron-main';
import installExtension, { REACT_DEVELOPER_TOOLS } from 'electron-devtools-installer';

const getResourcesPath = () => {
const appPath = app.getAppPath();
Expand Down Expand Up @@ -42,6 +43,14 @@ export async function launch(workspace?: string) {

await Promise.all([electronApp.init(), app.whenReady(), ensureDir(getExtensionDir())]);

await installExtension(REACT_DEVELOPER_TOOLS, {
loadExtensionOptions: { allowFileAccess: true },
forceDownload: true,
})
.then((name) => console.log(`Added Extension: ${name}`))
.then(() => {})
.catch((err) => console.error('An error occurred: ', err));

if (!workspace || !existsSync(workspace)) {
if (electronApp.getCodeWindows().length === 0) {
electronApp.loadWorkspace(undefined, undefined);
Expand Down

0 comments on commit 139b2ed

Please sign in to comment.