[ci] yarn format
This commit is contained in:
parent
39cbe50085
commit
aaa61ff254
3 changed files with 7 additions and 7 deletions
2
examples/env-vars/src/env.d.ts
vendored
2
examples/env-vars/src/env.d.ts
vendored
|
@ -6,5 +6,5 @@ interface ImportMetaEnv {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ImportMeta {
|
interface ImportMeta {
|
||||||
readonly env: ImportMetaEnv
|
readonly env: ImportMetaEnv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,4 @@
|
||||||
|
|
||||||
// PUBLIC_SOME_KEY is available everywhere
|
// PUBLIC_SOME_KEY is available everywhere
|
||||||
console.log({ SSR, PUBLIC_SOME_KEY });
|
console.log({ SSR, PUBLIC_SOME_KEY });
|
||||||
})()
|
})();
|
||||||
|
|
|
@ -14,7 +14,7 @@ function getPrivateEnv(viteConfig: vite.ResolvedConfig, astroConfig: AstroConfig
|
||||||
envPrefixes = Array.isArray(viteConfig.envPrefix) ? viteConfig.envPrefix : [viteConfig.envPrefix];
|
envPrefixes = Array.isArray(viteConfig.envPrefix) ? viteConfig.envPrefix : [viteConfig.envPrefix];
|
||||||
}
|
}
|
||||||
const fullEnv = loadEnv(viteConfig.mode, viteConfig.envDir ?? fileURLToPath(astroConfig.projectRoot), '');
|
const fullEnv = loadEnv(viteConfig.mode, viteConfig.envDir ?? fileURLToPath(astroConfig.projectRoot), '');
|
||||||
const privateKeys = Object.keys(fullEnv).filter(key => {
|
const privateKeys = Object.keys(fullEnv).filter((key) => {
|
||||||
// don't expose any variables also on `process.env`
|
// don't expose any variables also on `process.env`
|
||||||
// note: this filters out `CLI_ARGS=1` passed to node!
|
// note: this filters out `CLI_ARGS=1` passed to node!
|
||||||
if (typeof process.env[key] !== 'undefined') return false;
|
if (typeof process.env[key] !== 'undefined') return false;
|
||||||
|
@ -26,11 +26,11 @@ function getPrivateEnv(viteConfig: vite.ResolvedConfig, astroConfig: AstroConfig
|
||||||
|
|
||||||
// Otherwise, this is a private variable defined in an `.env` file
|
// Otherwise, this is a private variable defined in an `.env` file
|
||||||
return true;
|
return true;
|
||||||
})
|
});
|
||||||
if (privateKeys.length === 0) {
|
if (privateKeys.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return Object.fromEntries(privateKeys.map(key => [key, fullEnv[key]]));
|
return Object.fromEntries(privateKeys.map((key) => [key, fullEnv[key]]));
|
||||||
}
|
}
|
||||||
|
|
||||||
function referencesPrivateKey(source: string, privateEnv: Record<string, any>) {
|
function referencesPrivateKey(source: string, privateEnv: Record<string, any>) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue