Skip to content

Commit

Permalink
Version Packages (#22)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and github-actions[bot] authored Sep 18, 2024
1 parent a5f23e7 commit d13e1b7
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 76 deletions.
69 changes: 0 additions & 69 deletions .changeset/pretty-meals-buy.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/swift-llamas-jam.md

This file was deleted.

6 changes: 6 additions & 0 deletions packages/create-domco/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# create-domco

## 0.2.0

### Minor Changes

- a5f23e7: Updates template to 0.13

## 0.1.14

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/create-domco/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "create-domco",
"description": "Create a new domco project",
"version": "0.1.14",
"version": "0.2.0",
"type": "module",
"types": "./dist/index.d.ts",
"main": "./dist/index.js",
Expand Down
70 changes: 70 additions & 0 deletions packages/domco/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,75 @@
# domco

## 0.13.0

### Minor Changes

- d50685c: Server framework agnostic

This project had a lot of overlap with HonoX, HonoX should be the default if you are wanting all of the features Hono provides like client components. This update removes the dependency on Hono and making the library framework agnostic. Hono can still be easily used with domco (see below).

This makes domco have no dependencies other than Vite. You can now build your app with vanilla JS without any external libraries. You can now use any server framework like Hono that provides a function that handles a web `Request` and returns a `Response`. This update also simplifies domco's API and refactors much of the codebase to make it smaller and builds faster.

## Overview of Changes

- `+server` renamed to `+app`
- `+client` renamed to `+script`
- Instead of exporting the `app` as the default export, you now must export `app.fetch` as a named `handler` export.
- Removes `page`, `client`, and `server` context variables.
- `page` is replaced with the `client:page` virtual module.
- `script` is replaced with the `client:script` virtual module.
- The `server` context variable is removed. This is better handled by the user - perhaps with libraries like `ofetch`.
- The `tags` imported from `client:script` are now just strings, so you'll need to pass them through `hono/html` - `raw` function to pass them into a JSX template if you were using them directly in Hono.
- Multiple `+server` entry points are removed in favor of just one `src/server/+app` entry. Note this is located within `src/server/` now instead of directly in `src/`.
- Removes `+setup` - since domco no longer mounts routes, user can control the entire lifecycle through the `handler`.
- Removes default immutable headers - leave to adapters instead.
- Import `handler` from `dist/server/app.js` instead of the `createApp` export.
- Script entry points are no longer automatically injected into pages in the same directory.
- Static pages must be prerendered, nothing from `src/client/` is included in the app if not imported into the server entry.
- d.ts changes - instead of adding the context variable map, you now just need to add types for the virtual modules from `domco/env`.

```ts
/// <reference types="vite/client" />
/// <reference types="domco/env" />
```

## Examples

### Vanilla

```ts
import { html } from "client:page";
import type { Handler } from "domco";
export const handler: Handler = (req) => {
const { pathname } = new URL(req.url);
if (pathname === "/") {
return new Response(html, {
headers: {
"Content-Type": "text/html",
},
});
}
return new Response("Not found", { status: 404 });
};
```

### Hono - Migrate from 0.12

```ts
// src/server/+app.ts
import { html } from "client:page";
import { Hono } from "hono";
const app = new Hono();
app.use((c) => c.html(html));
export const handler = app.fetch;
```

## 0.12.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/domco/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "domco",
"description": "A Minimal Full-Stack JavaScript Framework",
"version": "0.12.0",
"version": "0.13.0",
"author": {
"name": "Ross Robino",
"url": "https://robino.dev"
Expand Down

0 comments on commit d13e1b7

Please sign in to comment.