diff options
author | Kristóf Marussy <kristof@marussy.com> | 2021-12-23 00:43:55 +0100 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2021-12-23 01:17:18 +0100 |
commit | cf23e60c17763123caa77f1194e6efd913692ea1 (patch) | |
tree | 42266377ac1a65a9b225737c8cbef02c6b1871cd /scripts/watch.js | |
parent | feat: Add mui (diff) | |
download | sophie-cf23e60c17763123caa77f1194e6efd913692ea1.tar.gz sophie-cf23e60c17763123caa77f1194e6efd913692ea1.tar.zst sophie-cf23e60c17763123caa77f1194e6efd913692ea1.zip |
feat: Add shared package for electron ipc
Diffstat (limited to 'scripts/watch.js')
-rw-r--r-- | scripts/watch.js | 20 |
1 files changed, 17 insertions, 3 deletions
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 = [ | |||
37 | ]; | 37 | ]; |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * @param {{name: string; configFile: string; writeBundle: import('rollup').OutputPlugin['writeBundle'] }} config | 40 | * @param {{name: string; configFile: string; writeBundle?: import('rollup').OutputPlugin['writeBundle'] }} config |
41 | * @returns {Promise<import('rollup').RollupOutput | Array<import('rollup').RollupOutput> | import('rollup').RollupWatcher>} | 41 | * @returns {Promise<import('rollup').RollupOutput | Array<import('rollup').RollupOutput> | import('rollup').RollupWatcher>} |
42 | */ | 42 | */ |
43 | function getWatcher({name, configFile, writeBundle}) { | 43 | function getWatcher({ name, configFile, writeBundle }) { |
44 | return build({ | 44 | return build({ |
45 | ...sharedConfig, | 45 | ...sharedConfig, |
46 | configFile, | 46 | configFile, |
@@ -110,7 +110,7 @@ function setupMainPackageWatcher(viteDevServer) { | |||
110 | } | 110 | } |
111 | 111 | ||
112 | /** | 112 | /** |
113 | * Start or restart App when source files are changed. | 113 | * Reload App when source files are changed. |
114 | * | 114 | * |
115 | * @param {import('vite').ViteDevServer} viteDevServer | 115 | * @param {import('vite').ViteDevServer} viteDevServer |
116 | * @returns {Promise<import('rollup').RollupOutput | Array<import('rollup').RollupOutput> | import('rollup').RollupWatcher>} | 116 | * @returns {Promise<import('rollup').RollupOutput | Array<import('rollup').RollupOutput> | import('rollup').RollupWatcher>} |
@@ -128,9 +128,23 @@ function setupPreloadPackageWatcher(viteDevServer) { | |||
128 | } | 128 | } |
129 | 129 | ||
130 | /** | 130 | /** |
131 | * Rebuild package when source files are changed. | ||
132 | * | ||
133 | * @returns {Promise<import('rollup').RollupOutput | Array<import('rollup').RollupOutput> | import('rollup').RollupWatcher>} | ||
134 | */ | ||
135 | function setupSharedPackageWatcher() { | ||
136 | return getWatcher({ | ||
137 | name: 'rebuild-package-on-shared-package-change', | ||
138 | configFile: 'packages/shared/vite.config.js', | ||
139 | }); | ||
140 | } | ||
141 | |||
142 | /** | ||
131 | * @returns Promise<void> | 143 | * @returns Promise<void> |
132 | */ | 144 | */ |
133 | async function setupDevEnvironment() { | 145 | async function setupDevEnvironment() { |
146 | await setupSharedPackageWatcher(); | ||
147 | |||
134 | const viteDevServer = await createServer({ | 148 | const viteDevServer = await createServer({ |
135 | ...sharedConfig, | 149 | ...sharedConfig, |
136 | configFile: 'packages/renderer/vite.config.js', | 150 | configFile: 'packages/renderer/vite.config.js', |