// @ts-check

const { spawnSync } = require("child_process");

console.log("Running Post build ...");

try {
    /** @type {import('child_process').SpawnSyncOptionsWithStringEncoding} */
    const spawnSyncOptions = {
        stdio: "inherit",
        encoding: "utf-8",
        cwd: process.cwd(),
        env: {
            ...process.env,
            NODE_ENV: "production",
        },
    };

    const generateSitemap = spawnSync(
        "npx",
        ["next-sitemap"],
        spawnSyncOptions
    );
} catch (error) {
    console.log("Post Build Error =>", error);
}