0.1.6Updated a month ago
import { freshHandler } from "@infinity-beyond/modules/networking/server.ts";
import { getInternalFreshState } from "$fresh/src/server/config.ts";
import { build } from "$fresh/src/dev/build.ts";

export async function buildApplication() {
  console.log(`Building static assets for a live environment...`);

  const [_, config, manifest] = await freshHandler();

  console.log(" --------- PLUGINS --------- ");
  console.log(config.plugins);
  console.log(" ------- ELOG PLUGINS ------- ");

  const state = await getInternalFreshState(
    manifest,
    config ?? {},
  );
  state.config.dev = false;
  state.loadSnapshot = false;
  state.build = true;
  await build(state);

  Deno.exit(0);
}