diff --git a/frontend/.env b/frontend/.env new file mode 100644 index 0000000000..9d768f91d4 --- /dev/null +++ b/frontend/.env @@ -0,0 +1 @@ +VITE_DEFAULT_WEBHOOK_TYPE=async \ No newline at end of file diff --git a/frontend/README_DEV.md b/frontend/README_DEV.md index efb2d4a277..2f05668435 100644 --- a/frontend/README_DEV.md +++ b/frontend/README_DEV.md @@ -17,7 +17,7 @@ In the root folder: ```bash docker build . -t windmill -docker-compose up db windmill_server windmill_worker +docker compose up db windmill_server windmill_worker ``` ### 2. Backend is run by cargo @@ -145,3 +145,22 @@ Recommended config for VS Code: ``` - turn _format on save_ on + + +## Building + +The project is built with [SvelteKit](https://kit.svelte.dev/) and uses as output static files. +There are others adapters for sveltekit, but we use the static adapter. + +To build the frontend as static assets, use: +``` +npm run build +``` + +The default build assume you serve every non static files as the 200.html file which is catchall. If you prefer a normal layout, you can use the : +``` +NOTCATCHALL=true npm run build +``` + +Env variables used for build are set in .env file. See [https://vitejs.dev/guide/env-and-mode.html#env-files](https://vitejs.dev/guide/env-and-mode.html#env-files) for more details. + diff --git a/frontend/src/lib/consts.ts b/frontend/src/lib/consts.ts index 9cb292f1e9..8b272a92e1 100644 --- a/frontend/src/lib/consts.ts +++ b/frontend/src/lib/consts.ts @@ -1 +1,2 @@ -export const DEFAULT_WEBHOOK_TYPE: 'async' | 'sync' = 'async' \ No newline at end of file +export const DEFAULT_WEBHOOK_TYPE: 'async' | 'sync' = + import.meta.env.VITE_DEFAULT_WEBHOOK_TYPE || 'async' diff --git a/frontend/svelte.config.js b/frontend/svelte.config.js index 4f23266118..075593bc50 100644 --- a/frontend/svelte.config.js +++ b/frontend/svelte.config.js @@ -12,14 +12,15 @@ const config = { ], kit: { - adapter: process.env.CLOUDFLARE - ? adapter({ pages: 'build', assets: 'build', fallback: 'index.html', precompress: false }) - : adapter({ - // default options are shown - pages: 'build', - assets: 'build', - fallback: '200.html' - }), + adapter: + process.env.CLOUDFLARE || process.env.NOCATCHALL + ? adapter({ pages: 'build', assets: 'build', fallback: 'index.html', precompress: false }) + : adapter({ + // default options are shown + pages: 'build', + assets: 'build', + fallback: '200.html' + }), prerender: { entries: [] } } }