From 1658f3af6e89fff65c6b58ce5ff2dd1ed67174cd Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Sun, 17 Mar 2024 15:38:49 +0100 Subject: [PATCH] chore: restore webui metro cache in ci (#10) * chore: restore webui metro cache in ci * chore: test webui metro cache --- .github/actions/setup-project/action.yml | 10 ++++++++++ webui/metro.config.js | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/.github/actions/setup-project/action.yml b/.github/actions/setup-project/action.yml index 00e0673..ef3ec83 100644 --- a/.github/actions/setup-project/action.yml +++ b/.github/actions/setup-project/action.yml @@ -36,3 +36,13 @@ runs: run: bun install working-directory: webui shell: bash + + - name: ♻️ Restore webui cache + if: ${{ inputs.with-webui == 'true' }} + uses: actions/cache@v4 + with: + key: webui-metro-${{ runner.os }}-${{ github.sha }} + restore-keys: | + webui-metro-${{ runner.os }} + path: | + webui/node_modules/.cache/metro diff --git a/webui/metro.config.js b/webui/metro.config.js index 5ae8cb1..f400074 100644 --- a/webui/metro.config.js +++ b/webui/metro.config.js @@ -1,4 +1,5 @@ const { getDefaultConfig } = require('expo/metro-config'); +const { FileStore } = require('metro-cache'); const { withNativeWind } = require('nativewind/metro'); const path = require('path'); @@ -6,6 +7,12 @@ const config = withNativeWind(getDefaultConfig(__dirname), { input: './src/styles.css', }); +// Allow Metro to access the `~plugin/**` files config.watchFolders = [__dirname, path.resolve(__dirname, '..')]; +// Move the Metro cache to `node_modules/.cache` +config.cacheStores = [ + new FileStore({ root: path.join(__dirname, 'node_modules', '.cache', 'metro') }), +]; + module.exports = config;