Skip to content

Commit

Permalink
chore: updated variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
MathurAditya724 committed Jul 12, 2024
1 parent 4b240ff commit 9f95fbb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hooks/after-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ afterCreateHook.addHook(
},
)

const compatibilityDateRegex = /compatibility_date\s*=\s*"\d{4}-\d{2}-\d{2}"/
const COMPATIBILITY_DATE = /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')
// Get current date in YYYY-MM-DD format
const currentDate = new Date().toISOString().split('T')[0]
const rewritten = wrangler.replace(
compatibilityDateRegex,
COMPATIBILITY_DATE,
`compatibility_date = "${currentDate}"`,
)
writeFileSync(wranglerPath, rewritten)
Expand Down

0 comments on commit 9f95fbb

Please sign in to comment.