Skip to content

Commit 811a217

Browse files
authored
Update patches.ts
1 parent 4d1ab0f commit 811a217

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/build/patches.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ function handleEnum(node: any, enums: Record<string, Enum>) {
3939
const values: string[] = [];
4040

4141
for (const child of node.children ?? []) {
42-
if (child.name !== "value" || typeof child.values[0] !== "string") {
43-
throw new Error("enum values should be in the form of `value {name}`");
44-
}
45-
values.push(child.values[0]);
42+
values.push(child.name);
4643
}
4744

4845
enums[name] = { name, value: values };
@@ -51,7 +48,7 @@ function handleEnum(node: any, enums: Record<string, Enum>) {
5148
/**
5249
* Collect all file URLs in a directory.
5350
*/
54-
async function getAllKDLFileURLs(folder: URL): Promise<URL[]> {
51+
async function getAllFileURLs(folder: URL): Promise<URL[]> {
5552
const entries = await readdir(folder, { withFileTypes: true });
5653
return entries.map((entry) => new URL(entry.name, folder));
5754
}
@@ -69,7 +66,7 @@ export async function readPatch(fileUrl: URL): Promise<any> {
6966
*/
7067
export default async function readPatches(): Promise<any> {
7168
const patchDirectory = new URL("../../inputfiles/patches/", import.meta.url);
72-
const fileUrls = await getAllKDLFileURLs(patchDirectory);
69+
const fileUrls = await getAllFileURLs(patchDirectory);
7370

7471
const parsedContents = await Promise.all(fileUrls.map(readPatch));
7572

0 commit comments

Comments
 (0)