From cf23e60c17763123caa77f1194e6efd913692ea1 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Thu, 23 Dec 2021 00:43:55 +0100 Subject: feat: Add shared package for electron ipc --- scripts/watch.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'scripts/watch.js') diff --git a/scripts/watch.js b/scripts/watch.js index 7ec07ff..7f5f42c 100644 --- a/scripts/watch.js +++ b/scripts/watch.js @@ -37,10 +37,10 @@ const stderrFilterPatterns = [ ]; /** - * @param {{name: string; configFile: string; writeBundle: import('rollup').OutputPlugin['writeBundle'] }} config + * @param {{name: string; configFile: string; writeBundle?: import('rollup').OutputPlugin['writeBundle'] }} config * @returns {Promise | import('rollup').RollupWatcher>} */ -function getWatcher({name, configFile, writeBundle}) { +function getWatcher({ name, configFile, writeBundle }) { return build({ ...sharedConfig, configFile, @@ -110,7 +110,7 @@ function setupMainPackageWatcher(viteDevServer) { } /** - * Start or restart App when source files are changed. + * Reload App when source files are changed. * * @param {import('vite').ViteDevServer} viteDevServer * @returns {Promise | import('rollup').RollupWatcher>} @@ -127,10 +127,24 @@ function setupPreloadPackageWatcher(viteDevServer) { }); } +/** + * Rebuild package when source files are changed. + * + * @returns {Promise | import('rollup').RollupWatcher>} + */ +function setupSharedPackageWatcher() { + return getWatcher({ + name: 'rebuild-package-on-shared-package-change', + configFile: 'packages/shared/vite.config.js', + }); +} + /** * @returns Promise */ async function setupDevEnvironment() { + await setupSharedPackageWatcher(); + const viteDevServer = await createServer({ ...sharedConfig, configFile: 'packages/renderer/vite.config.js', -- cgit v1.2.3-70-g09d2