Nuxt is based on Vue.js and I find their building blocks to be much neater compared to the React based Next.js.
10 lines
283 B
JavaScript
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");
|