Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit f6e412d

Browse files
committed
chore: add support for new manifest property
1 parent 17e6003 commit f6e412d

File tree

3 files changed

+20
-48
lines changed

3 files changed

+20
-48
lines changed

src/shared/deployments/ManifestModal/ManifestModal.spec.tsx

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,28 +53,6 @@ describe("~/apps/[id]/environments/[env-id]/deployments/_components/ManifestModa
5353
});
5454
});
5555

56-
it("should display a warning when top level index.html is missing and ssr is disabled", async () => {
57-
createWrapper({
58-
manifest: mockManifest({
59-
functionHandler: "",
60-
cdnFiles: [{ fileName: "/static/index.js", headers: {} }],
61-
}),
62-
});
63-
64-
await waitFor(() => {
65-
expect(wrapper.getByText(/Top level/)).toBeTruthy();
66-
expect(wrapper.getByText("/index.html")).toBeTruthy();
67-
expect(
68-
wrapper.getByText(
69-
/is missing and server side rendering is not detected\./
70-
)
71-
).toBeTruthy();
72-
expect(wrapper.getByText("Learn more.").getAttribute("href")).toBe(
73-
"https://www.stormkit.io/docs/other/troubleshooting#index-html-missing"
74-
);
75-
});
76-
});
77-
7856
describe("ui view", () => {
7957
it("should contain the cdn files as the primary view", async () => {
8058
const manifest = mockManifest();

src/shared/deployments/ManifestModal/TabCDNFiles.tsx

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import { useMemo, useState } from "react";
2-
import WarningIcon from "@mui/icons-material/Warning";
32
import ChevronRight from "@mui/icons-material/ChevronRight";
43
import Button from "@mui/material/Button";
54
import Box from "@mui/material/Box";
65
import Link from "@mui/material/Link";
7-
import Alert from "@mui/material/Alert";
8-
import Typography from "@mui/material/Typography";
96

107
interface Props {
118
manifest: Manifest;
@@ -44,6 +41,23 @@ const useTree = ({ manifest }: { manifest: Manifest }) => {
4441
return object;
4542
};
4643

44+
Object.keys(manifest?.staticFiles || {}).forEach(fileName => {
45+
const pieces = fileName.replace(/^\//, "").split("/");
46+
const file = { fileName, headers: manifest.staticFiles![fileName] };
47+
48+
if (pieces.length === 1) {
49+
tree["/"].files.push(file);
50+
} else {
51+
let lastLeaf = tree["/"].folders;
52+
53+
pieces.pop(); // last name is file name
54+
pieces.forEach(path => {
55+
recursiveFolder(lastLeaf, path, file);
56+
lastLeaf = lastLeaf[path].folders;
57+
});
58+
}
59+
});
60+
4761
manifest.cdnFiles?.forEach(file => {
4862
const pieces = file.fileName.replace(/^\//, "").split("/");
4963

@@ -145,27 +159,6 @@ const recursiveRender = (deployment: DeploymentV2, treeNode: TreeNode) => {
145159
};
146160

147161
export default function TabCDNFiles({ manifest, deployment }: Props) {
148-
const ssrEnabled = Boolean(manifest?.functionHandler);
149-
const indexHTMLWarning =
150-
!ssrEnabled &&
151-
!manifest?.cdnFiles?.find(file => file.fileName === "/index.html");
152-
153162
const tree = useTree({ manifest });
154-
155-
return (
156-
<>
157-
{indexHTMLWarning && (
158-
<Alert color="warning" sx={{ mb: 2 }} icon={<WarningIcon />}>
159-
<Typography>
160-
Top level <span className="font-bold">/index.html</span> is missing
161-
and server side rendering is not detected.{" "}
162-
<Link href="https://www.stormkit.io/docs/other/troubleshooting#index-html-missing">
163-
Learn more.
164-
</Link>
165-
</Typography>
166-
</Alert>
167-
)}
168-
<Box>{recursiveRender(deployment, tree["/"])}</Box>
169-
</>
170-
);
163+
return <Box>{recursiveRender(deployment, tree["/"])}</Box>;
171164
}

src/types/deployment.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ interface APIFile {
9696
}
9797

9898
declare type Manifest = {
99-
cdnFiles?: CDNFile[];
99+
staticFiles?: Record<string, Record<string, string>>;
100+
cdnFiles?: CDNFile[]; // @deprecated: use staticFiles
100101
apiFiles?: APIFile[];
101102
redirects?: Redirects[] | null;
102103
functionHandler?: string;

0 commit comments

Comments
 (0)