Skip to content

Full-stack (meta?) framework / CLI #251

@brainkim

Description

@brainkim

The Crank.js documentation website is being built with some hacked-together code which uses ts-node, nodemon, ESBuild’s JavaScript API, a funny little router, etc. It would be nice to package this behind a CLI.

I have been putting this off for a long time because of open questions of API design, not wanting to reinvent the wheel, and the fact that bundling/transpilation continue to evolve... but perhaps it is time, especially as I rewrite the docs to handle stuff like Vite / etc. I think it is possible to do it now, especially with ESBuild. Maybe we could even put the CLI directly in the Crank package. (probably not a good idea)

Naming ideas:

  • scale scale develop (@b9g/scale)
  • captain captain develop (@b9g/captain)
  • capn capn dev (@b9g/capn)
  • something to do with gears? Web spiders?
  • I like the idea of capitalizing on c-based names
  • shovel (I keep hearing “sell shovels” bandied about).

The parts of the framework so far:

  • Basic path-to-regexp based router that doesn’t do much.
  • Client-side bundling/transpilation
    • A way to build client-side code using ESBuild using server-side components, on the fly in development.
    • A way to serve static assets.
    • A way to run the router with an array to create a static build.
  • A janky development server that goes down to new requests any time there’s a change.

Attack plan:

Development should be oriented around commands:

  • x develop (or x serve?)
  • x static
  • x init
    once a pretty and solid directory structure is discovered
  • x build and x prod (maybe rethink the names at this level)

The meta-framework will likely need to provide server-side components like the following:

  • <HTML5 /> Does the weird lil bit where you have to DOCTYPE. Maybe we could pass in our current Storage abstraction here, or it could be a separate component.
  • <Script />, <Style />, <Link /> ESBuild-backed replacements for equivalents. These components automatically build/transpile the referenced files.
  • <Client /> / <Island /> ??? A way to render stuff client-side. Could do stuff like generate renderer.hydrate code directly. May be id-based. I don’t like Island terminology but it fits with the captain nautical theme.
  • <Head />, <Body /> Components to coordinate between user code and HTML5. Could inject critical scripts top bottom head body. Or this could be done other components like <CriticalScripts />. Honestly a lot of ways to design the API.
  • <LiveReloadScript /> for when you want to inject live-reloading or whatever

TODO: Write hypothetical Getting Started docs.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions