From 11dc1c95865539b987acbec7d230c20cdc152fbe Mon Sep 17 00:00:00 2001 From: Sujai Kumar Gupta Date: Wed, 20 Mar 2024 17:43:34 +0530 Subject: [PATCH 1/2] add write to disk options --- packages/kolibri-tools/lib/cli.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/kolibri-tools/lib/cli.js b/packages/kolibri-tools/lib/cli.js index 5b0a78403f8..76f602b5d80 100755 --- a/packages/kolibri-tools/lib/cli.js +++ b/packages/kolibri-tools/lib/cli.js @@ -235,6 +235,7 @@ program false ) .option('--kds-path ', 'Full path to local kds directory', String, '') + .option('--write-to-disk', 'Write files to disk instead of using webpack devserver', false) .action(function(mode, options) { if (options.requireKdsPath) { if (!options.kdsPath) { @@ -320,7 +321,19 @@ program }); } } - runWebpackBuild(mode, bundleData, mode === modes.DEV, options); + + if (options.writeToDisk && mode === modes.DEV) { + cliLogging.warn( + 'Enabling write-to-disk mode may fill up your developer machine with lots of different built files if frequent changes are made.' + ); + runWebpackBuild(mode, bundleData, false, { + ...options, + cache: false, + hot: false, + }); + } else { + runWebpackBuild(mode, bundleData, mode === modes.DEV, options); + } }); const ignoreDefaults = ['**/node_modules/**', '**/static/**']; From b8d129308bc05825c0d89d8797e31d886c5b6754 Mon Sep 17 00:00:00 2001 From: Sujai Kumar Gupta Date: Thu, 21 Mar 2024 22:15:31 +0530 Subject: [PATCH 2/2] improve readability and remove cache/hot override --- packages/kolibri-tools/lib/cli.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/kolibri-tools/lib/cli.js b/packages/kolibri-tools/lib/cli.js index 76f602b5d80..67788c24eb0 100755 --- a/packages/kolibri-tools/lib/cli.js +++ b/packages/kolibri-tools/lib/cli.js @@ -326,14 +326,9 @@ program cliLogging.warn( 'Enabling write-to-disk mode may fill up your developer machine with lots of different built files if frequent changes are made.' ); - runWebpackBuild(mode, bundleData, false, { - ...options, - cache: false, - hot: false, - }); - } else { - runWebpackBuild(mode, bundleData, mode === modes.DEV, options); } + + runWebpackBuild(mode, bundleData, !options.writeToDisk && mode === modes.DEV, options); }); const ignoreDefaults = ['**/node_modules/**', '**/static/**'];