resFactory / factory

Resource Factory is a universal approach to originating, refining, and rendering Markdown, HTML, type-safe SQL, or other assets that could comprise static sites or engineering artifacts.
GNU Affero General Public License v3.0
0 stars 3 forks source link
static-site static-site-generator

Resource Factory

Resource Factory

codecov

Resource Factory is a universal approach to generating and assembling code, HTML, or other assets that could comprise static sites or engineering artifacts. Resource Factory is a different way to generate static "sites" where the concept of a site is an arbitrary construct. A site could be any target group of generated files/products/artifacts and not just HTML assets.

Resource Factory's design goals include:

Resource Factory's purpose is to take raw materials called resources from file systems, databases, or other sources and create finished products such as HTML, SQL, or arbitrary artifact. The products can be persisted to file systems or other destinations or futher processed by other systems.

Resource Factory works with reasonable type-safety using three key concepts:

 Sources             Acquired data          Mutatable resources         Terminal resources
┌──────────────┐    ┌───────────────┐ 1:1  ┌──────────────────┐  1:1   ┌──────────────────┐
│ File Systems ├───►│  Origination  ├─────►│    Refinement    ├───────►│       Render     │
│ Databases    │    │ ("factories") │ 1:n  │  ("middleware")  │  1:n   │   ("renderers")  │
│ URLs         │    └───────────────┘   ┌─►└──────┬───────┬───┘  n:n   └─────────┬────────┘
│ ...          │            ▲           │         │       │            Immutable │ Design Systems,
└──────────────┘            │           └─────────┘       │           Refineries │ Persisters, etc.
                            │            recursive        │                      │
                            │            middleware       │                      │ Destinations
                            └─────────────────────────────┘              ┌───────▼──────┐
                             recursive originators                       │ File Systems │
                             can "fan out" additional                    │ ...          │
                             resources in middleware                     └──────────────┘

SSG Caveats

This framework is not about the ease of local edits of a rendering strategy such as an HTML design system ("DS") but enfocing consistency to a specific chosen rendering strategy. Because Resource Factory is geared not for small sites but large publications, type-safety, observability, performance, and enforcement of design patterns is the main concern.

Flexibility from an engineering perspective is important but flexiblity of changes to any single resource is not a goal. For example, some static site generators (SSGs) allow easy changes to HTML output on a per-page basis but if Resource Factory is used as an SSG we would be more focused on enforcing HTML pages to adhere to a design system, not optimize for making local changes.

We do not want to encourage the use of anything other than HTML, Web Components, JavaScript (with strong type-safety using Typescript or other governance tools). This means staying away from all templating tools and using plain Typescript and JavaScript is best.

Instead of building templates in custom languages, we'll just rely on Javascript and v8.

Contributing

PRs are welcome. If you're making changes directly (without a PR), after updating and before pushing code, tag the release:

# <git commit ...>
git-chglog --output CHANGELOG.md
git commit -m "auto generate content" CHANGELOG.md
git-semtag final && git push
# or git-semtag final -v "vN.N.N" && git push