Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
static-site: fix formatting of sst-env.d.ts with Vite env vars (#1042)
Browse files Browse the repository at this point in the history
* static-site: fix formatting of sst-env.d.ts generated for Vite env variables

* chore: add header comments for consistency with other sst-env.d.ts files
  • Loading branch information
paolostyle authored Oct 18, 2024
1 parent 72a4d3d commit 79ede79
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions platform/src/components/base/base-static-site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,18 @@ export function prepare(args: BaseStaticSiteArgs) {

// Create type file
const filePath = path.resolve(path.join(sitePath, typesPath));
const content = `/// <reference types="vite/client" />
interface ImportMetaEnv {
${Object.keys(environment)
.map((key) => ` readonly ${key}: string`)
.join("\n")}
}
interface ImportMeta {
readonly env: ImportMetaEnv
}`;
const content = `/* This file is auto-generated by SST. Do not edit. */
/* tslint:disable */
/* eslint-disable */
/// <reference types="vite/client" />
interface ImportMetaEnv {
${Object.keys(environment)
.map((key) => ` readonly ${key}: string`)
.join("\n")}
}
interface ImportMeta {
readonly env: ImportMetaEnv
}`;

const fileDir = path.dirname(filePath);
fs.mkdirSync(fileDir, { recursive: true });
Expand Down

0 comments on commit 79ede79

Please sign in to comment.