Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 committed Feb 28, 2024
2 parents 3a34de6 + 6f9d181 commit 065b1eb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
18 changes: 8 additions & 10 deletions build/esbuild-build.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// @ts-expect-error - Could not find a declaration file for module
import extraRpcs from "../lib/chainlist/constants/extraRpcs";
import esbuild from "esbuild";
import * as dotenv from "dotenv";
import esbuild from "esbuild";
import chainlist from "../lib/chainlist/constants/extraRpcs";
const typescriptEntries = [
"static/scripts/rewards/index.ts",
"static/scripts/audit-report/audit.ts",
Expand All @@ -11,13 +10,13 @@ const typescriptEntries = [
const cssEntries = ["static/styles/rewards/rewards.css", "static/styles/audit-report/audit.css", "static/styles/onboarding/onboarding.css"];
export const entries = [...typescriptEntries, ...cssEntries];

const allNetworkUrls: Record<string, string[]> = {};
const extraRpcs: Record<string, string[]> = {};
// this flattens all the rpcs into a single object, with key names that match the networkIds. The arrays are just of URLs per network ID.

Object.keys(extraRpcs).forEach((networkId) => {
const officialUrls = extraRpcs[networkId].rpcs.filter((rpc) => typeof rpc === "string");
const extraUrls: string[] = extraRpcs[networkId].rpcs.filter((rpc) => rpc.url !== undefined).map((rpc) => rpc.url);
allNetworkUrls[networkId] = [...officialUrls, ...extraUrls];
Object.keys(chainlist).forEach((networkId) => {
const officialUrls = chainlist[networkId].rpcs.filter((rpc) => typeof rpc === "string");
const extraUrls: string[] = chainlist[networkId].rpcs.filter((rpc) => rpc.url !== undefined).map((rpc) => rpc.url);
extraRpcs[networkId] = [...officialUrls, ...extraUrls];
});

export const esBuildContext: esbuild.BuildOptions = {
Expand All @@ -34,7 +33,7 @@ export const esBuildContext: esbuild.BuildOptions = {
".svg": "dataurl",
},
outdir: "static/out",
define: createEnvDefines(["SUPABASE_URL", "SUPABASE_ANON_KEY"], { allNetworkUrls }),
define: createEnvDefines(["SUPABASE_URL", "SUPABASE_ANON_KEY"], { extraRpcs }),
};

esbuild
Expand Down Expand Up @@ -63,6 +62,5 @@ function createEnvDefines(envVarNames: string[], extras: Record<string, unknown>
defines[key] = JSON.stringify(extras[key]);
}
}
defines["extraRpcs"] = JSON.stringify(allNetworkUrls);
return defines;
}
2 changes: 1 addition & 1 deletion lib/ubiquibot
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
/* JavaScript Support */
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
"allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
"checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
/* Emit */
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
Expand Down

0 comments on commit 065b1eb

Please sign in to comment.