From 4d30753958d6eec27265a3771ebea457042c0f01 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Mon, 15 Apr 2024 14:25:40 -0400 Subject: [PATCH] Fix more phoenix dev issues --- package.json | 2 +- packages/backend/src/SelfhostedModule.js | 7 +++++++ packages/backend/src/services/DevWatcherService.js | 7 +++++-- packages/phoenix/rollup.config.js | 3 ++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 2de5346d..b7c67f55 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "start": "node run-selfhosted.js", "build": "node ./build.js", "check-translations": "node tools/check-translations.js", - "postinstall": "cd packages/phoenix/packages/contextlink && npm install" + "postinstall": "cd packages/phoenix && cd packages/contextlink && npm install && cd - && cd packages/strataparse && npm install && cd - && cd packages/pty && npm install" }, "workspaces": [ "packages/*" diff --git a/packages/backend/src/SelfhostedModule.js b/packages/backend/src/SelfhostedModule.js index dbc13e73..81074f42 100644 --- a/packages/backend/src/SelfhostedModule.js +++ b/packages/backend/src/SelfhostedModule.js @@ -1,4 +1,5 @@ const { AdvancedBase } = require("puter-js-common"); +const config = require("./config"); class SelfhostedModule extends AdvancedBase { async install (context) { @@ -26,12 +27,18 @@ class SelfhostedModule extends AdvancedBase { directory: 'packages/terminal', command: 'npx', args: ['rollup', '-c', 'rollup.config.js', '--watch'], + env: { + PUTER_JS_URL: config.origin + 'sdk/puter.dev.js', + } }, { name: 'phoenix:rollup-watch', directory: 'packages/phoenix', command: 'npx', args: ['rollup', '-c', 'rollup.config.js', '--watch'], + env: { + PUTER_JS_URL: config.origin + 'sdk/puter.dev.js', + } }, ], }); diff --git a/packages/backend/src/services/DevWatcherService.js b/packages/backend/src/services/DevWatcherService.js index 8272c3c3..667507db 100644 --- a/packages/backend/src/services/DevWatcherService.js +++ b/packages/backend/src/services/DevWatcherService.js @@ -63,11 +63,14 @@ class DevWatcherService extends BaseService { this.log.info(txt); } - async start_ ({ name, fullpath, command, args }) { + async start_ ({ name, fullpath, command, args, env }) { this.log.info(`Starting ${name} in ${fullpath}`); const proc = this.modules.spawn(command, args, { shell: true, - env: process.env, + env: { + ...process.env, + ...(env ?? {}), + }, cwd: fullpath, }); this.instances.push({ diff --git a/packages/phoenix/rollup.config.js b/packages/phoenix/rollup.config.js index ab826f38..27c80324 100644 --- a/packages/phoenix/rollup.config.js +++ b/packages/phoenix/rollup.config.js @@ -38,7 +38,8 @@ export default { src: 'assets/index.html', dest: 'dist', transform: (contents, name) => { - return contents.toString().replace('__SDK_URL__', globalThis.__CONFIG__.sdk_url); + return contents.toString().replace('__SDK_URL__', + process.env.PUTER_JS_URL ?? globalThis.__CONFIG__.sdk_url); } }, { src: 'assets/shell.html', dest: 'dist' },