chore: normalize formatting

This commit is contained in:
Cory Dransfeldt 2024-10-19 19:50:10 -07:00
parent 01ed2ac3b3
commit 2f6cfbe7ae
No known key found for this signature in database
61 changed files with 921 additions and 743 deletions

View file

@ -1,33 +1,36 @@
import fs from 'fs/promises'
import dotenv from 'dotenv-flow'
import fs from "fs/promises";
import dotenv from "dotenv-flow";
dotenv.config()
dotenv.config();
const workerName = process.argv[2]
const workerName = process.argv[2];
if (!workerName) {
console.error('Please specify a worker name.')
process.exit(1)
console.error("Please specify a worker name.");
process.exit(1);
}
const templatePath = `workers/${workerName}/wrangler.template.toml`
const outputPath = `workers/${workerName}/wrangler.toml`
const templatePath = `workers/${workerName}/wrangler.template.toml`;
const outputPath = `workers/${workerName}/wrangler.toml`;
async function generateToml() {
try {
const template = await fs.readFile(templatePath, 'utf8')
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)
.replace(/\${RSS_TO_MASTODON_KV_NAMESPACE_ID}/g, process.env.RSS_TO_MASTODON_KV_NAMESPACE_ID)
.replace(
/\${RSS_TO_MASTODON_KV_NAMESPACE_ID}/g,
process.env.RSS_TO_MASTODON_KV_NAMESPACE_ID
);
await fs.writeFile(outputPath, output)
await fs.writeFile(outputPath, output);
console.log(`Generated wrangler.toml for ${workerName}`)
console.log(`Generated wrangler.toml for ${workerName}`);
} catch (error) {
console.error('Error generating wrangler.toml:', error)
process.exit(1)
console.error("Error generating wrangler.toml:", error);
process.exit(1);
}
}
generateToml()
generateToml();