Skip to content

Commit dfa61e7

Browse files
committed
Improve pattern matching and error handling
1 parent 52aafec commit dfa61e7

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

build.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,12 @@ const entryPointsPlugin = {
8787
build.onStart(() => {
8888
const actionFiles = globSync("src/*-action{,-post}.ts");
8989
for (const actionFile of actionFiles) {
90-
const match = actionFile.match(/src\/(.*)-action(-post)?.ts/);
90+
const match = basename(actionFile).match(/(.*)-action(-post)?/);
91+
92+
if (match.length < 2) {
93+
throw new Error(`'${actionFile}' didn't match expected pattern.`);
94+
}
95+
9196
const actionName = match[1];
9297
const isPost = match[2] !== undefined;
9398

0 commit comments

Comments
 (0)