chore: pull workers in

This commit is contained in:
Cory Dransfeldt 2024-07-26 18:01:36 -07:00
parent 0bf47f97ad
commit a0f654a1a2
No known key found for this signature in database
15 changed files with 539 additions and 9 deletions

22
scripts/worker-build.mjs Normal file
View file

@ -0,0 +1,22 @@
import fs from 'fs/promises';
import dotenv from 'dotenv-flow';
dotenv.config();
const workerName = process.argv[2];
if (!workerName) {
console.error('Please specify a worker name.');
process.exit(1);
}
const templatePath = `workers/${workerName}/wrangler.template.toml`;
const outputPath = `workers/${workerName}/wrangler.toml`;
const template = await fs.readFile(templatePath, 'utf8');
const output = template
.replace(/\${CF_ACCOUNT_ID}/g, process.env.CF_ACCOUNT_ID)
.replace(/\${CF_ZONE_ID}/g, process.env.CF_ZONE_ID);
await fs.writeFile(outputPath, output);
console.log(`Generated wrangler.toml for ${workerName}`);