From c8ecc12f1c81d16f4b6576c3450c41076a16b905 Mon Sep 17 00:00:00 2001 From: Sebastian Scatularo Date: Thu, 11 Jan 2024 21:26:15 -0300 Subject: [PATCH 1/4] add prefix and extra assets from wormhole connect --- apps/connect/vite.config.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/apps/connect/vite.config.ts b/apps/connect/vite.config.ts index 6d9fa05f5..e9acf7329 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/index.js', + dest: 'assets/wormhole-connect/' + }, + { + src: 'node_modules/@wormhole-foundation/wormhole-connect/dist/main.js', dest: 'assets/wormhole-connect/' + }, + { + src: 'node_modules/@wormhole-foundation/wormhole-connect/dist/main.css', + dest: 'assets/wormhole-connect/' + }, + { + src: 'node_modules/@wormhole-foundation/wormhole-connect/dist/assets/*', + dest: 'assets/' } ] }) From ef1665ec5f6bd24dc8ca1c48b0d8e81620df4f32 Mon Sep 17 00:00:00 2001 From: Sebastian Scatularo Date: Fri, 12 Jan 2024 11:36:26 -0300 Subject: [PATCH 2/4] fix build, update connect command to add deployment path --- .github/workflows/build.yml | 2 ++ .github/workflows/testnet.yml | 2 +- apps/connect/vite.config.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e4ac8bf44..569e611f1 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 e9acf7329..3164445a6 100644 --- a/apps/connect/vite.config.ts +++ b/apps/connect/vite.config.ts @@ -60,7 +60,7 @@ export default defineConfig({ }, { src: 'node_modules/@wormhole-foundation/wormhole-connect/dist/assets/*', - dest: 'assets/' + dest: 'assets/wormhole-connect/assets' } ] }) From e16bcdf5524132d260240b21fe4bcc7986458ba1 Mon Sep 17 00:00:00 2001 From: Sebastian Scatularo Date: Fri, 12 Jan 2024 11:51:12 -0300 Subject: [PATCH 3/4] fix sed command --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 569e611f1..2d4bfe27e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -198,7 +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 + 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}" @@ -265,7 +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 + 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}" From 2820d3eac2c51d736eff8d97702330fbc6119b46 Mon Sep 17 00:00:00 2001 From: Sebastian Scatularo Date: Fri, 12 Jan 2024 12:13:26 -0300 Subject: [PATCH 4/4] add wild cards to viteStaticCopy plugin --- apps/connect/vite.config.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/connect/vite.config.ts b/apps/connect/vite.config.ts index 3164445a6..2f7bfec73 100644 --- a/apps/connect/vite.config.ts +++ b/apps/connect/vite.config.ts @@ -47,19 +47,19 @@ export default defineConfig({ viteStaticCopy({ targets: [ { - src: 'node_modules/@wormhole-foundation/wormhole-connect/dist/index.js', + src: 'node_modules/@wormhole-foundation/wormhole-connect/dist/*.js', dest: 'assets/wormhole-connect/' }, { - src: 'node_modules/@wormhole-foundation/wormhole-connect/dist/main.js', + src: 'node_modules/@wormhole-foundation/wormhole-connect/dist/*.css', dest: 'assets/wormhole-connect/' }, { - src: 'node_modules/@wormhole-foundation/wormhole-connect/dist/main.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/*', + src: 'node_modules/@wormhole-foundation/wormhole-connect/dist/assets/*.css', dest: 'assets/wormhole-connect/assets' } ]