netzo / fresh-netzo

Full-stack Deno Fresh meta-framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
https://netzo.io
MIT License
52 stars 2 forks source link

[plugins] refactor framework setup into fresh plugins (closes #92) #138

Closed miguelrk closed 7 months ago

miguelrk commented 7 months ago

Another take on https://github.com/netzo/netzo/issues/92.

Most importantly, this PR reverts the default project structure back to using the original dev.ts, main.ts and netzo.config.ts (extended fresh.config.ts) files of Fresh. This sacrifices DX in favor of aligning with fresh project structure, since improvements to the default project structure should best be done upstream in Fresh. We should help moving things forward over there instead...

For convenience, this PR introduces a netzo/plugins/mod.ts barrel file to bundle all netzo-specific plugins and allow import * as netzo pattern like bellow. One can always import individually. Standalone plugins like unocss are not in this bundle to make it clear they are netzo-independent.

// netzo.config.ts
import { defineConfig } from "netzo/mod.ts";
import * as netzo from "netzo/plugins/mod.ts";
import { unocss } from "netzo/plugins/unocss/plugin.ts";

export default defineConfig({
  plugins: [
    netzo.environments(),
    netzo.auth({...}),
    netzo.api({...}),
    unocss(),
  ],
});