create-hozu 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +22 -0
- package/bin/create-hozu.js +4 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +64 -0
- package/dist/bin.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +104 -0
- package/dist/index.js.map +1 -0
- package/package.json +47 -0
- package/skill/SKILL.md +202 -0
- package/skill/changing.md +40 -0
- package/skill/diagnostics.md +39 -0
- package/skill/example/app.css +1 -0
- package/skill/example/features/bookmarks/model.ts +129 -0
- package/skill/example/features/bookmarks/views.ts +248 -0
- package/skill/example/hozu.config.ts +28 -0
- package/skill/example/routes.ts +11 -0
- package/skill/example/serve.ts +14 -0
- package/skill/example/server.ts +34 -0
- package/skill/patterns.md +56 -0
- package/skill/reference.md +139 -0
- package/templates/app/app.css +1 -0
- package/templates/app/features/site/views.ts +15 -0
- package/templates/app/gitignore +2 -0
- package/templates/app/hozu.config.ts +13 -0
- package/templates/app/routes.ts +3 -0
- package/templates/app/serve.ts +14 -0
- package/templates/app/server.ts +6 -0
- package/templates/app/tsconfig.json +20 -0
- package/templates/guide.md +20 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { feature, ui } from '@hozu/core'
|
|
2
|
+
|
|
3
|
+
export const Home = ui.view({
|
|
4
|
+
render: () =>
|
|
5
|
+
ui.main({ class: 'mx-auto max-w-xl space-y-4 px-4 py-12' }, [
|
|
6
|
+
ui.h1({ class: 'text-3xl font-bold' }, ['Hello, Hozu']),
|
|
7
|
+
ui.p({ class: 'text-slate-600' }, ['Edit features/site/views.ts to get started.']),
|
|
8
|
+
]),
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const site = feature({
|
|
12
|
+
id: 'site',
|
|
13
|
+
intent: { summary: 'The start page' },
|
|
14
|
+
declarations: { Home },
|
|
15
|
+
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { project, ui } from '@hozu/core'
|
|
2
|
+
import { zodAdapter } from '@hozu/schema-zod'
|
|
3
|
+
import { Home, site } from './features/site/views.ts'
|
|
4
|
+
import { home } from './routes.ts'
|
|
5
|
+
|
|
6
|
+
export default project({
|
|
7
|
+
schema: zodAdapter,
|
|
8
|
+
styles: new URL('./app.css', import.meta.url),
|
|
9
|
+
site: { url: 'http://localhost:3000', name: '__NAME__', lang: 'en' },
|
|
10
|
+
routes: { home },
|
|
11
|
+
pages: [ui.page(home, { views: [Home], head: { render: () => ({ title: '__NAME__' }) } })],
|
|
12
|
+
features: [site],
|
|
13
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createServer } from '@hozu/adapter-node'
|
|
2
|
+
import { buildProject } from '@hozu/core/ir'
|
|
3
|
+
import { compileStyles } from '@hozu/css'
|
|
4
|
+
import project from './hozu.config.ts'
|
|
5
|
+
import { createResolvers } from './server.ts'
|
|
6
|
+
|
|
7
|
+
const port = Number(process.env.PORT ?? 3000)
|
|
8
|
+
const build = buildProject(project, { sources: false })
|
|
9
|
+
|
|
10
|
+
createServer({
|
|
11
|
+
build,
|
|
12
|
+
styles: await compileStyles(build),
|
|
13
|
+
resolvers: createResolvers(),
|
|
14
|
+
}).listen(port, () => console.log(`__NAME__ on http://localhost:${port}`))
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2023",
|
|
4
|
+
"lib": ["es2023", "dom"],
|
|
5
|
+
"module": "nodenext",
|
|
6
|
+
"moduleResolution": "nodenext",
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"strict": true,
|
|
9
|
+
"noUncheckedIndexedAccess": true,
|
|
10
|
+
"exactOptionalPropertyTypes": true,
|
|
11
|
+
"verbatimModuleSyntax": true,
|
|
12
|
+
"erasableSyntaxOnly": true,
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"isolatedModules": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"noEmit": true
|
|
17
|
+
},
|
|
18
|
+
"include": ["**/*.ts"],
|
|
19
|
+
"exclude": ["node_modules", "dist"]
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# __NAME__
|
|
2
|
+
|
|
3
|
+
A web app built with Hozu (`@hozu/*`). Hozu is not in your training data.
|
|
4
|
+
|
|
5
|
+
## Before writing code
|
|
6
|
+
- __READ__
|
|
7
|
+
- Changing existing code: read `__SKILL__/changing.md` first.
|
|
8
|
+
- The files in `__SKILL__/` are the whole API. Do not read the framework source in `node_modules/@hozu`.
|
|
9
|
+
|
|
10
|
+
## Checks (run after every change)
|
|
11
|
+
```
|
|
12
|
+
__RUN__ tsc --noEmit -p .
|
|
13
|
+
__RUN__ hozu validate
|
|
14
|
+
__RUN__ hozu validate --update-lock # only to accept a clean, intended behaviour change
|
|
15
|
+
```
|
|
16
|
+
__NOTE__
|
|
17
|
+
## Rules
|
|
18
|
+
- Apply the fix each diagnostic gives; do not work around a rule.
|
|
19
|
+
- Every behaviour change comes with a contract change.
|
|
20
|
+
- Do not edit `__SKILL__/`: `__RUN__ hozu skill` rewrites it for the installed Hozu version.
|