From 1dfc9cecb454ab6c174626c61cfe13f51cd46ab2 Mon Sep 17 00:00:00 2001 From: "Shahid N. Shah" Date: Tue, 24 Sep 2024 14:39:58 -0400 Subject: [PATCH] chore: add comments to explain functionality #5 --- src/pages/lib/[...slug].js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pages/lib/[...slug].js b/src/pages/lib/[...slug].js index 5be7c294b..d825cccf5 100644 --- a/src/pages/lib/[...slug].js +++ b/src/pages/lib/[...slug].js @@ -98,6 +98,7 @@ export async function getStaticPaths() { // Check if the slug ends with `.sql.*` and add another endpoint which is the generic or Deno execution result of the sql.ts file if (/\.sql\..*$/.test(relativePath)) { const slug = `/${relativePath.replace(/\.sql\..*$/, '.sql')}`; + // if the file is executable, capture the output as SQL if(stat.mode & fsConsts.S_IXUSR) { endpoints.push({ params: { slug }, @@ -108,6 +109,8 @@ export async function getStaticPaths() { }, }) } else if (relativePath.endsWith('.ts')) { + // if the file is not executable but is a `.sql.ts` file, use Deno to execute it + // and capture the output as SQL endpoints.push({ params: { slug }, props: {