Fix more phoenix dev issues

This commit is contained in:
KernelDeimos 2024-04-15 14:25:40 -04:00
parent c72e0cb0e0
commit 4d30753958
4 changed files with 15 additions and 4 deletions

View File

@ -27,7 +27,7 @@
"start": "node run-selfhosted.js", "start": "node run-selfhosted.js",
"build": "node ./build.js", "build": "node ./build.js",
"check-translations": "node tools/check-translations.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": [ "workspaces": [
"packages/*" "packages/*"

View File

@ -1,4 +1,5 @@
const { AdvancedBase } = require("puter-js-common"); const { AdvancedBase } = require("puter-js-common");
const config = require("./config");
class SelfhostedModule extends AdvancedBase { class SelfhostedModule extends AdvancedBase {
async install (context) { async install (context) {
@ -26,12 +27,18 @@ class SelfhostedModule extends AdvancedBase {
directory: 'packages/terminal', directory: 'packages/terminal',
command: 'npx', command: 'npx',
args: ['rollup', '-c', 'rollup.config.js', '--watch'], args: ['rollup', '-c', 'rollup.config.js', '--watch'],
env: {
PUTER_JS_URL: config.origin + 'sdk/puter.dev.js',
}
}, },
{ {
name: 'phoenix:rollup-watch', name: 'phoenix:rollup-watch',
directory: 'packages/phoenix', directory: 'packages/phoenix',
command: 'npx', command: 'npx',
args: ['rollup', '-c', 'rollup.config.js', '--watch'], args: ['rollup', '-c', 'rollup.config.js', '--watch'],
env: {
PUTER_JS_URL: config.origin + 'sdk/puter.dev.js',
}
}, },
], ],
}); });

View File

@ -63,11 +63,14 @@ class DevWatcherService extends BaseService {
this.log.info(txt); this.log.info(txt);
} }
async start_ ({ name, fullpath, command, args }) { async start_ ({ name, fullpath, command, args, env }) {
this.log.info(`Starting ${name} in ${fullpath}`); this.log.info(`Starting ${name} in ${fullpath}`);
const proc = this.modules.spawn(command, args, { const proc = this.modules.spawn(command, args, {
shell: true, shell: true,
env: process.env, env: {
...process.env,
...(env ?? {}),
},
cwd: fullpath, cwd: fullpath,
}); });
this.instances.push({ this.instances.push({

View File

@ -38,7 +38,8 @@ export default {
src: 'assets/index.html', src: 'assets/index.html',
dest: 'dist', dest: 'dist',
transform: (contents, name) => { 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' }, { src: 'assets/shell.html', dest: 'dist' },