mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-16 19:33:11 +02:00
Change frontend .env files to be committed and have .env.*.local overrides (#6207)
This commit is contained in:
@@ -49,30 +49,24 @@ function findViteEnvVars(srcDir: string): Set<string> {
|
||||
|
||||
describe("env vars", () => {
|
||||
it("every VITE_ var used in source is present in an example env file", () => {
|
||||
const baseEnv = readFileSync(
|
||||
join(frontendRoot, "config/.env.example"),
|
||||
"utf-8",
|
||||
);
|
||||
const baseEnv = readFileSync(join(frontendRoot, ".env"), "utf-8");
|
||||
const desktopEnv = readFileSync(
|
||||
join(frontendRoot, "config/.env.desktop.example"),
|
||||
"utf-8",
|
||||
);
|
||||
const saasEnv = readFileSync(
|
||||
join(frontendRoot, "config/.env.saas.example"),
|
||||
join(frontendRoot, ".env.desktop"),
|
||||
"utf-8",
|
||||
);
|
||||
const saasEnv = readFileSync(join(frontendRoot, ".env.saas"), "utf-8");
|
||||
|
||||
const exampleKeys = new Set([
|
||||
const declaredKeys = new Set([
|
||||
...parseEnvKeys(baseEnv),
|
||||
...parseEnvKeys(desktopEnv),
|
||||
...parseEnvKeys(saasEnv),
|
||||
]);
|
||||
const sourceVars = findViteEnvVars(join(frontendRoot, "src"));
|
||||
|
||||
const missing = [...sourceVars].filter((v) => !exampleKeys.has(v));
|
||||
const missing = [...sourceVars].filter((v) => !declaredKeys.has(v));
|
||||
expect(
|
||||
missing,
|
||||
`Missing from 'frontend/config/.env.example' files: ${missing.join(", ")}`,
|
||||
`Missing from 'frontend/.env*' files: ${missing.join(", ")}`,
|
||||
).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user