From 9b4e0d397dce2161a59034532b9b293b279ccbb1 Mon Sep 17 00:00:00 2001 From: Aditya Mathur <57684218+MathurAditya724@users.noreply.github.com> Date: Fri, 12 Jul 2024 08:01:31 +0530 Subject: [PATCH] chore: renamed regex variable --- src/hooks/after-create.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/hooks/after-create.ts b/src/hooks/after-create.ts index 67d4c60..28d20f7 100644 --- a/src/hooks/after-create.ts +++ b/src/hooks/after-create.ts @@ -17,18 +17,16 @@ afterCreateHook.addHook( }, ) -const regex = /compatibility_date\s*=\s*"\d{4}-\d{2}-\d{2}"/ +const compatibilityDateRegex = /compatibility_date\s*=\s*"\d{4}-\d{2}-\d{2}"/ afterCreateHook.addHook(['cloudflare-workers'], ({ directoryPath }) => { const wranglerPath = path.join(directoryPath, 'wrangler.toml') const wrangler = readFileSync(wranglerPath, 'utf-8') - - const currentDate = new Date().toISOString().split('T')[0] // Get current date in YYYY-MM-DD format - + // Get current date in YYYY-MM-DD format + const currentDate = new Date().toISOString().split('T')[0] const rewritten = wrangler.replace( - regex, + compatibilityDateRegex, `compatibility_date = "${currentDate}"`, ) - writeFileSync(wranglerPath, rewritten) })