Showing the changes to scripts (2 of 34 files). Show all
Unified · Split
| @@ -21,6 +21,9 @@ describe("loadRepoEnv", () => { · 20 unmodified lines | ||
| 21 | 21 | expect(env.T3CODE_CLERK_PUBLISHABLE_KEY).toBeUndefined(); |
| 22 | 22 | expect(env.VITE_CLERK_PUBLISHABLE_KEY).toBeUndefined(); |
| 23 | 23 | expect(env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY).toBeUndefined(); |
| 24 | + expect(env.T3CODE_CLERK_JWT_TEMPLATE).toBeUndefined(); | |
| 25 | + expect(env.VITE_CLERK_JWT_TEMPLATE).toBeUndefined(); | |
| 26 | + expect(env.EXPO_PUBLIC_CLERK_JWT_TEMPLATE).toBeUndefined(); | |
| 24 | 27 | expect(env.T3CODE_RELAY_URL).toBeUndefined(); |
| 25 | 28 | expect(env.VITE_T3CODE_RELAY_URL).toBeUndefined(); |
| 26 | 29 | }); |
| @@ -29,11 +32,11 @@ describe("loadRepoEnv", () => { · 2 unmodified lines | ||
| 29 | 32 | const repoRoot = makeTemporaryDirectory(); |
| 30 | 33 | writeFileSync( |
| 31 | 34 | join(repoRoot, ".env"), |
| 32 | − "T3CODE_CLERK_PUBLISHABLE_KEY=pk_root\nT3CODE_RELAY_URL=https://root.example.test\n", | |
| 35 | + "T3CODE_CLERK_PUBLISHABLE_KEY=pk_root\nT3CODE_CLERK_JWT_TEMPLATE=template_root\nT3CODE_RELAY_URL=https://root.example.test\n", | |
| 33 | 36 | ); |
| 34 | 37 | writeFileSync( |
| 35 | 38 | join(repoRoot, ".env.local"), |
| 36 | − "T3CODE_CLERK_PUBLISHABLE_KEY=pk_local\nT3CODE_RELAY_URL=https://local.example.test\n", | |
| 39 | + "T3CODE_CLERK_PUBLISHABLE_KEY=pk_local\nT3CODE_CLERK_JWT_TEMPLATE=template_local\nT3CODE_RELAY_URL=https://local.example.test\n", | |
| 37 | 40 | ); |
| 38 | 41 | |
| 39 | 42 | expect(loadRepoEnv({ baseEnv: {}, repoRoot }).T3CODE_RELAY_URL).toBe( |
| @@ -43,6 +46,7 @@ describe("loadRepoEnv", () => { · 3 unmodified lines | ||
| 43 | 46 | loadRepoEnv({ |
| 44 | 47 | baseEnv: { |
| 45 | 48 | T3CODE_CLERK_PUBLISHABLE_KEY: "pk_ci", |
| 49 | + T3CODE_CLERK_JWT_TEMPLATE: "template_ci", | |
| 46 | 50 | T3CODE_RELAY_URL: "https://ci.example.test", |
| 47 | 51 | }, |
| 48 | 52 | repoRoot, |
| @@ -51,6 +55,9 @@ describe("loadRepoEnv", () => { · 2 unmodified lines | ||
| 51 | 55 | T3CODE_CLERK_PUBLISHABLE_KEY: "pk_ci", |
| 52 | 56 | VITE_CLERK_PUBLISHABLE_KEY: "pk_ci", |
| 53 | 57 | EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY: "pk_ci", |
| 58 | + T3CODE_CLERK_JWT_TEMPLATE: "template_ci", | |
| 59 | + VITE_CLERK_JWT_TEMPLATE: "template_ci", | |
| 60 | + EXPO_PUBLIC_CLERK_JWT_TEMPLATE: "template_ci", | |
| 54 | 61 | T3CODE_RELAY_URL: "https://ci.example.test", |
| 55 | 62 | VITE_T3CODE_RELAY_URL: "https://ci.example.test", |
| 56 | 63 | }); |
| @@ -60,10 +67,12 @@ describe("loadRepoEnv", () => { · 3 unmodified lines | ||
| 60 | 67 | expect( |
| 61 | 68 | resolvePublicConfig({ |
| 62 | 69 | VITE_CLERK_PUBLISHABLE_KEY: "pk_legacy", |
| 70 | + VITE_CLERK_JWT_TEMPLATE: "template_legacy", | |
| 63 | 71 | VITE_T3CODE_RELAY_URL: "https://legacy.example.test", |
| 64 | 72 | }), |
| 65 | 73 | ).toEqual({ |
| 66 | 74 | clerkPublishableKey: "pk_legacy", |
| 75 | + clerkJwtTemplate: "template_legacy", | |
| 67 | 76 | relayUrl: "https://legacy.example.test", |
| 68 | 77 | }); |
| 69 | 78 | }); |
| @@ -6,6 +6,7 @@ import * as NodeUtil from "node:util"; · 5 unmodified lines | ||
| 6 | 6 | |
| 7 | 7 | export interface T3CodePublicConfig { |
| 8 | 8 | readonly clerkPublishableKey: string | undefined; |
| 9 | + readonly clerkJwtTemplate: string | undefined; | |
| 9 | 10 | readonly relayUrl: string | undefined; |
| 10 | 11 | } |
| 11 | 12 | |
| @@ -37,6 +38,13 @@ export function loadRepoEnv({ · 25 unmodified lines | ||
| 37 | 38 | EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY: config.clerkPublishableKey, |
| 38 | 39 | } |
| 39 | 40 | : {}), |
| 41 | + ...(config.clerkJwtTemplate | |
| 42 | + ? { | |
| 43 | + T3CODE_CLERK_JWT_TEMPLATE: config.clerkJwtTemplate, | |
| 44 | + VITE_CLERK_JWT_TEMPLATE: config.clerkJwtTemplate, | |
| 45 | + EXPO_PUBLIC_CLERK_JWT_TEMPLATE: config.clerkJwtTemplate, | |
| 46 | + } | |
| 47 | + : {}), | |
| 40 | 48 | ...(config.relayUrl |
| 41 | 49 | ? { |
| 42 | 50 | T3CODE_RELAY_URL: config.relayUrl, |
| @@ -54,6 +62,12 @@ export function resolvePublicConfig(...sources: readonly Environment[]): T3CodeP · 11 unmodified lines | ||
| 54 | 62 | "VITE_CLERK_PUBLISHABLE_KEY", |
| 55 | 63 | "EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY", |
| 56 | 64 | ), |
| 65 | + clerkJwtTemplate: firstNonEmpty( | |
| 66 | + sources, | |
| 67 | + "T3CODE_CLERK_JWT_TEMPLATE", | |
| 68 | + "VITE_CLERK_JWT_TEMPLATE", | |
| 69 | + "EXPO_PUBLIC_CLERK_JWT_TEMPLATE", | |
| 70 | + ), | |
| 57 | 71 | relayUrl: firstNonEmpty(sources, "T3CODE_RELAY_URL", "VITE_T3CODE_RELAY_URL"), |
| 58 | 72 | }; |
| 59 | 73 | } |