From 2000f5fb1e5cb3b8507213d43ccfc907d22468c2 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Tue, 17 Jan 2023 23:12:26 +0800 Subject: [PATCH] Update blog example env name (#5877) --- examples/docs/src/components/Footer/AvatarList.astro | 6 ++---- examples/docs/src/env.d.ts | 8 ++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/docs/src/components/Footer/AvatarList.astro b/examples/docs/src/components/Footer/AvatarList.astro index b75589f5a..03b1e5bd7 100644 --- a/examples/docs/src/components/Footer/AvatarList.astro +++ b/examples/docs/src/components/Footer/AvatarList.astro @@ -17,11 +17,9 @@ type Commit = { async function getCommits(url: string) { try { - const token = import.meta.env.SNOWPACK_PUBLIC_GITHUB_TOKEN ?? 'hello'; + const token = import.meta.env.GITHUB_TOKEN ?? 'hello'; if (!token) { - throw new Error( - 'Cannot find "SNOWPACK_PUBLIC_GITHUB_TOKEN" used for escaping rate-limiting.' - ); + throw new Error('Cannot find "GITHUB_TOKEN" used for escaping rate-limiting.'); } const auth = `Basic ${Buffer.from(token, 'binary').toString('base64')}`; diff --git a/examples/docs/src/env.d.ts b/examples/docs/src/env.d.ts index f964fe0cf..8e48612f5 100644 --- a/examples/docs/src/env.d.ts +++ b/examples/docs/src/env.d.ts @@ -1 +1,9 @@ /// + +interface ImportMetaEnv { + readonly GITHUB_TOKEN: string | undefined; +} + +interface ImportMeta { + readonly env: ImportMetaEnv; +}