From 8a8be85f834d0a24b057a2a09524fe20ed93a524 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 12 Jan 2024 12:31:30 -0300 Subject: [PATCH] add prefix and extra assets from wormhole connect (#668) * add prefix and extra assets from wormhole connect * fix build, update connect command to add deployment path * fix sed command * add wild cards to viteStaticCopy plugin --- .github/workflows/build.yml | 2 ++ .github/workflows/testnet.yml | 2 +- apps/connect/vite.config.ts | 22 +++++++++++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e4ac8bf44..2d4bfe27e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -198,6 +198,7 @@ jobs: npm install -g husky pushd wormhole-connect npm ci --workspaces --if-present + sed -i -e 's|vite build",|vite build --base=${{inputs.public-url}}/assets/wormhole-connect/",|g' wormhole-connect/package.json npm run build echo "_JS_SHA_384=$(shasum -b -a 384 wormhole-connect-loader/dist/main.js | awk '{ print $1 }' | xxd -r -p | base64)" >> "${GITHUB_OUTPUT}" echo "_CSS_SHA_384=$(shasum -b -a 384 wormhole-connect-loader/dist/main.css | awk '{ print $1 }' | xxd -r -p | base64)" >> "${GITHUB_OUTPUT}" @@ -264,6 +265,7 @@ jobs: npm install -g husky pushd wormhole-connect npm ci --workspaces --if-present + sed -i -e 's|vite build",|vite build --base=${{inputs.public-url}}/assets/wormhole-connect/",|g' wormhole-connect/package.json npm run build echo "_JS_SHA_384=$(shasum -b -a 384 wormhole-connect-loader/dist/main.js | awk '{ print $1 }' | xxd -r -p | base64)" >> "${GITHUB_OUTPUT}" echo "_CSS_SHA_384=$(shasum -b -a 384 wormhole-connect-loader/dist/main.css | awk '{ print $1 }' | xxd -r -p | base64)" >> "${GITHUB_OUTPUT}" diff --git a/.github/workflows/testnet.yml b/.github/workflows/testnet.yml index 5fc23922d..d446e8f1a 100644 --- a/.github/workflows/testnet.yml +++ b/.github/workflows/testnet.yml @@ -20,7 +20,7 @@ jobs: with: name: testnet separator: T - connect-branch: portal-bridge + connect-branch: development advanced-tools-branch: advanced-tools environment: Cloudflare-Testnet public-url: "/${{ needs.branch-sha.outputs.value }}" diff --git a/apps/connect/vite.config.ts b/apps/connect/vite.config.ts index 6d9fa05f5..2f7bfec73 100644 --- a/apps/connect/vite.config.ts +++ b/apps/connect/vite.config.ts @@ -18,6 +18,14 @@ const MAINNET_RPCS = { // https://vitejs.dev/config/ export default defineConfig({ base: process.env.PUBLIC_URL || '', + build: { + rollupOptions: { + output: { + entryFileNames: 'pb-[name].js', + assetFileNames: 'pb-[name]-[hash][extname]', + }, + }, + }, define: { redirects: {}, wormholeConnectConfig: { @@ -39,8 +47,20 @@ export default defineConfig({ viteStaticCopy({ targets: [ { - src: 'node_modules/@wormhole-foundation/wormhole-connect/dist/*', + src: 'node_modules/@wormhole-foundation/wormhole-connect/dist/*.js', + dest: 'assets/wormhole-connect/' + }, + { + src: 'node_modules/@wormhole-foundation/wormhole-connect/dist/*.css', dest: 'assets/wormhole-connect/' + }, + { + src: 'node_modules/@wormhole-foundation/wormhole-connect/dist/assets/*.js', + dest: 'assets/wormhole-connect/assets' + }, + { + src: 'node_modules/@wormhole-foundation/wormhole-connect/dist/assets/*.css', + dest: 'assets/wormhole-connect/assets' } ] })