Skip to content

Commit

Permalink
Merge branch 'ubiquity:development' into speed-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng authored Feb 21, 2024
2 parents 2adf64b + b592128 commit c0249df
Show file tree
Hide file tree
Showing 6 changed files with 662 additions and 664 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
pull_request:
workflow_dispatch:

env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }}

jobs:
build:
runs-on: ubuntu-22.04
Expand Down
25 changes: 22 additions & 3 deletions build/esbuild-build.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import extraRpcs from "../lib/chainlist/constants/extraRpcs";
import esbuild from "esbuild";
import * as dotenv from "dotenv";
const typescriptEntries = [
"static/scripts/rewards/index.ts",
"static/scripts/audit-report/audit.ts",
Expand Down Expand Up @@ -32,9 +33,7 @@ export const esBuildContext: esbuild.BuildOptions = {
".svg": "dataurl",
},
outdir: "static/out",
define: {
extraRpcs: JSON.stringify(allNetworkUrls),
},
define: createEnvDefines(["SUPABASE_URL", "SUPABASE_ANON_KEY"], { allNetworkUrls }),
};

esbuild
Expand All @@ -46,3 +45,23 @@ esbuild
console.error(err);
process.exit(1);
});

function createEnvDefines(envVarNames: string[], extras: Record<string, unknown>): Record<string, string> {
const defines: Record<string, string> = {};
dotenv.config();
for (const name of envVarNames) {
const envVar = process.env[name];
if (envVar !== undefined) {
defines[name] = JSON.stringify(envVar);
} else {
throw new Error(`Missing environment variable: ${name}`);
}
}
for (const key in extras) {
if (Object.prototype.hasOwnProperty.call(extras, key)) {
defines[key] = JSON.stringify(extras[key]);
}
}
defines["extraRpcs"] = JSON.stringify(extraRpcs);
return defines;
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@octokit/plugin-throttling": "^8.1.3",
"@octokit/rest": "^20.0.2",
"@sinclair/typebox": "^0.32.14",
"@supabase/supabase-js": "2.39.7",
"@types/libsodium-wrappers": "^0.7.13",
"@uniswap/permit2-sdk": "^1.2.0",
"axios": "^1.6.7",
Expand Down
Loading

0 comments on commit c0249df

Please sign in to comment.