From 1c16730c71837f0decbd0ae1da16bfec04bdb4e7 Mon Sep 17 00:00:00 2001 From: Juan Cazala Date: Fri, 9 Aug 2024 12:18:55 -0300 Subject: [PATCH] fix: use binaries from editor node_modules in case they are not installed in the scene (#65) * fix: use binaries from editor node_modules in case they are not installed in the scene * chore: improve logs --- packages/main/src/index.ts | 4 ++-- packages/main/src/modules/bin.ts | 4 ++-- packages/main/src/modules/cli.ts | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/main/src/index.ts b/packages/main/src/index.ts index 94e9f96b..941dee16 100644 --- a/packages/main/src/index.ts +++ b/packages/main/src/index.ts @@ -81,11 +81,11 @@ if (import.meta.env.PROD) { log.info('[AutoUpdater] Update not available'); }); updater.autoUpdater.on('update-downloaded', async info => { - log.info('[AutoUpdater] Update downloaded'); + log.info(`[AutoUpdater] Update downloaded (v${info.version})`); await track('Auto Update Editor', { version: info.version }); }); updater.autoUpdater.on('download-progress', info => { - log.info(`[AutoUpdater] Download progress ${info.percent}%`); + log.info(`[AutoUpdater] Download progress ${info.percent.toFixed(2)}%`); }); updater.autoUpdater.on('error', err => { log.error('[AutoUpdater] Error in auto-updater', err); diff --git a/packages/main/src/modules/bin.ts b/packages/main/src/modules/bin.ts index 1b16bcab..9f3faee9 100644 --- a/packages/main/src/modules/bin.ts +++ b/packages/main/src/modules/bin.ts @@ -132,7 +132,7 @@ export async function install() { // install dependencies using npm log.info('[Install] Installing node_modules...'); const npmInstall = run('npm', 'npm', { - args: ['install'], + args: ['install', '--loglevel', 'error'], cwd: APP_UNPACKED_PATH, workspace, }); @@ -229,7 +229,7 @@ export function run(pkg: string, bin: string, options: RunOptions = {}): Child { const ready = future(); - const name = `${pkg} ${args.join(' ')}`.trim(); + const name = `${bin} ${args.join(' ')}`.trim(); forked.on('spawn', () => { log.info( `[UtilityProcess] Running "${name}" using bin=${binPath} with pid=${forked.pid} in ${cwd}`, diff --git a/packages/main/src/modules/cli.ts b/packages/main/src/modules/cli.ts index b6c12ec1..235ea761 100644 --- a/packages/main/src/modules/cli.ts +++ b/packages/main/src/modules/cli.ts @@ -15,13 +15,12 @@ export async function start(path: string) { if (previewServer) { await previewServer.kill(); } - const installCommand = run('npm', 'npm', { args: ['install'], cwd: path }); + const installCommand = run('npm', 'npm', { args: ['install', '--loglevel', 'error'], cwd: path }); await installCommand.wait(); const port = await getAvailablePort(); previewServer = run('@dcl/sdk-commands', 'sdk-commands', { args: ['start', '--port', port.toString(), '--no-browser'], cwd: path, - workspace: path, }); await previewServer.waitFor(/available/i); return port; @@ -42,7 +41,6 @@ export async function deploy({ path, target, targetContent }: DeployOptions) { ...(targetContent ? ['--target-content', targetContent] : []), ], cwd: path, - workspace: path, }); // App ready at