mirror of
https://github.com/enso-org/enso.git
synced 2024-11-27 18:12:31 +03:00
ee981d2052
This PR changes build script's `ide watch` and `ide start` commands, so they don't use `electron-builder` to package. Instead, they invoke `electron` directly, significantly reducing time overhead. `ide watch` will now start Electron process, while continuously rebuilding gui and the client in the background. Changes can be puilled by reloading within the electron, or closing the electron and letting it start once again. To stop, the script should be interrupted with `Ctrl+C`.
27 lines
842 B
TypeScript
27 lines
842 B
TypeScript
/** Helper module for running esbuild in watch mode. */
|
|
|
|
import * as esbuild from 'esbuild'
|
|
|
|
/** Transform a given esbuild bundle option configuration into a watch configuration.
|
|
* @param config - Configuration for the esbuild command.
|
|
* @param onRebuild - Callback to be called after each rebuild.
|
|
* @param inject - See [esbuild docs](https://esbuild.github.io/api/#inject).
|
|
*
|
|
**/
|
|
export function toWatchOptions(
|
|
config: esbuild.BuildOptions,
|
|
onRebuild?: () => void,
|
|
inject?: esbuild.BuildOptions['inject']
|
|
): esbuild.BuildOptions {
|
|
return {
|
|
...config,
|
|
inject: [...(config.inject ?? []), ...(inject ?? [])],
|
|
watch: {
|
|
onRebuild(error, result) {
|
|
if (error) console.error('watch build failed:', error)
|
|
else onRebuild?.()
|
|
},
|
|
},
|
|
}
|
|
}
|