From 0fa3b2a510acd45fd8e627f011cc3f64f6347ac4 Mon Sep 17 00:00:00 2001 From: jonambas Date: Sun, 7 Apr 2024 23:51:54 -0400 Subject: [PATCH] fix(codegen): use regex instead --- src/codegen.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/codegen.ts b/src/codegen.ts index b99ba54..7c13a0e 100644 --- a/src/codegen.ts +++ b/src/codegen.ts @@ -16,9 +16,7 @@ export const codegen = ( const cssFn = args.artifacts.find((a) => a.id === 'css-fn'); const index = args.artifacts.find((a) => a.id === 'css-index'); - const indexFile = index?.files.find( - (f) => f.file.includes('index.mjs') || f.file.includes('index.js'), - ); + const indexFile = index?.files.find((f) => f.file.match(/^index\.(mjs|js)/)); const indexDtsFile = index?.files.find((f) => f.file.includes('index.d.')); const ext = indexFile?.file.split('.').at(-1); const dtsExt = indexDtsFile?.file.split('.').at(-1);