owltide/generate-vapid-keys.mjs
Hornwitser 250ca9a1ac Port application from Next.js to Nuxt
Nuxt is based on Vue.js and I find their building blocks to be much
neater compared to the React based Next.js.
2025-03-05 15:36:50 +01:00

10 lines
283 B
JavaScript

import webPush from "web-push";
import fs from "node:fs/promises";
const vapidKeys = webPush.generateVAPIDKeys();
const envData = `\
NUXT_PUBLIC_VAPID_PUBLIC_KEY=${vapidKeys.publicKey}
NUXT_VAPID_PRIVATE_KEY=${vapidKeys.privateKey}
`;
await fs.writeFile(".env", envData, "utf-8");