From c9297a4d8f04fc98ef5f6603bf1a4d54a734b4ad Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 30 May 2023 08:31:18 +0200 Subject: [PATCH] fix path --- apps/remixdesktop/src/electronPluginClient.ts | 26 +++++++++++++++++++ apps/remixdesktop/webpack.config.js | 4 +-- package.json | 6 ++--- 3 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 apps/remixdesktop/src/electronPluginClient.ts diff --git a/apps/remixdesktop/src/electronPluginClient.ts b/apps/remixdesktop/src/electronPluginClient.ts new file mode 100644 index 0000000000..f575da99e1 --- /dev/null +++ b/apps/remixdesktop/src/electronPluginClient.ts @@ -0,0 +1,26 @@ +import { ClientConnector, connectClient, applyApi, Client, PluginClient } from '@remixproject/plugin' +import type { Message, Api, ApiMap } from '@remixproject/plugin-utils' +import { IRemixApi } from '@remixproject/plugin-api' + +export class ElectronPluginConnector implements ClientConnector { + + /** Send a message to the engine */ + send(message: Partial) { + window.postMessage(message, '*') + } + + /** Listen to message from the engine */ + on(cb: (message: Partial) => void) { + + } +} + +export const createClient = < + P extends Api, + App extends ApiMap = Readonly +>(client: PluginClient = new PluginClient()): Client => { + const c = client as any + connectClient(new ElectronPluginConnector(), c) + applyApi(c) + return c +} \ No newline at end of file diff --git a/apps/remixdesktop/webpack.config.js b/apps/remixdesktop/webpack.config.js index 9d21f93bb5..bc4622ff7a 100644 --- a/apps/remixdesktop/webpack.config.js +++ b/apps/remixdesktop/webpack.config.js @@ -16,8 +16,8 @@ module.exports = composePlugins(withNx(), (config) => { config.plugins.push( new webpack.DefinePlugin({ - MAIN_WINDOW_WEBPACK_ENTRY:`\`file://$\{require('path').resolve(__dirname, '..', 'renderer', 'remix-ide', 'index.html')}\``, - 'process.env.MAIN_WINDOW_WEBPACK_ENTRY': `\`file://$\{require('path').resolve(__dirname, '..', 'renderer', 'remix-ide', 'index.html')}\``, + MAIN_WINDOW_WEBPACK_ENTRY:`\`file://$\{require('path').resolve(__dirname, '..', 'renderer', 'index.html')}\``, + 'process.env.MAIN_WINDOW_WEBPACK_ENTRY': `\`file://$\{require('path').resolve(__dirname, '..', 'renderer', 'index.html')}\``, }) ) config.module.rules = [ diff --git a/package.json b/package.json index d8d69233fb..2ec3c52e75 100644 --- a/package.json +++ b/package.json @@ -53,9 +53,9 @@ "publish:libs": "yarn run build:libs && lerna publish --skip-git && yarn run bumpVersion:libs", "publishDev:libs": "yarn run build:libs && lerna publish --npm-tag alpha --skip-git && yarn run bumpVersion:libs", "build:e2e": "node apps/remix-ide-e2e/src/buildGroupTests.js && tsc -p apps/remix-ide-e2e/tsconfig.e2e.json", - "serve:desktop:dist": "yarn nx build remixdesktop && NX_DESKTOP_FROM_DIST=true nx build remix-ide --configuration=desktop && cp -r dist/apps/remix-ide apps/remixdesktop/.webpack/renderer && yarn electron apps/remixdesktop/.webpack/main", - "build:desktop": "yarn nx build remixdesktop && NX_DESKTOP_FROM_DIST=true nx build remix-ide --configuration=desktop && cp -r dist/apps/remix-ide apps/remixdesktop/.webpack/renderer && cd apps/remixdesktop/ && yarn package", - "serve:desktop:webpack": "yarn nx build remixdesktop && yarn serve && yarn electron apps/remixdesktop", + "serve:desktop:dist": "rm -rf apps/remixdesktop/.webpack && yarn nx build remixdesktop && NX_DESKTOP_FROM_DIST=true nx build remix-ide --configuration=desktop && cp -r dist/apps/remix-ide apps/remixdesktop/.webpack/renderer && yarn electron apps/remixdesktop/.webpack/main", + "build:desktop": "rm -rf apps/remixdesktop/.webpack && yarn nx build remixdesktop && NX_DESKTOP_FROM_DIST=true nx build remix-ide --configuration=desktop && cp -r dist/apps/remix-ide apps/remixdesktop/.webpack/renderer && cd apps/remixdesktop/ && yarn package", + "serve:desktop:webpack": "rm -rf apps/remixdesktop/.webpack && yarn nx build remixdesktop && yarn serve && yarn electron apps/remixdesktop", "babel": "babel", "watch:e2e": "nodemon", "bumpVersion:libs": "gulp & gulp syncLibVersions;",