create-sordo 0.1.0 → 0.4.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/CHANGELOG.md +12 -0
- package/package.json +7 -2
- package/src/index.ts +11 -19
- package/src/ui.ts +7 -63
- package/src/versions.ts +1 -1
- package/templates/_claude/.claude/skills/sordo/SKILL.md +3 -4
- package/templates/_codex/.codex/rules/sordo-patterns.md +3 -4
- package/templates/_shared/sordo-patterns.md +3 -4
- package/templates/default/README-template.md +5 -14
- package/templates/default/gitignore +0 -1
- package/templates/ui-shadcn/demo/index.tsx +0 -4
- package/templates/ui-starter/demo/index.tsx +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# create-sordo
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 10e162a: UI starters use sordo's `css` build entry: the generated `sordo.config.ts` sets `css: "app/styles/app.css"` and `bun-plugin-tailwind` replaces `@tailwindcss/cli`. The `css` / `css:watch` scripts, `app.generated.css`, `css.d.ts`, the `/api/styles` route and `_head.tsx` (plus the `head` re-exports) are gone.
|
|
8
|
+
|
|
9
|
+
## 0.3.0
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- c9b3d98: New apps pin `sordo@^0.3.0`, so they get the optional `css` build entry and a production server that serves client chunks (`bun run start`). `create-sordo` now releases in lockstep with `sordo`, so the version it pins always matches the latest `sordo`.
|
|
14
|
+
|
|
3
15
|
## 0.1.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-sordo",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"type": "module",
|
|
3
|
+
"version": "0.4.0",
|
|
5
4
|
"description": "Scaffolder for new Sordo projects.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/bihaviour/sordo.git",
|
|
8
|
+
"directory": "packages/create-sordo"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
6
11
|
"license": "MIT",
|
|
7
12
|
"bin": {
|
|
8
13
|
"create-sordo": "bin/create-sordo.ts"
|
package/src/index.ts
CHANGED
|
@@ -416,27 +416,12 @@ async function applyProjectType(
|
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
-
function pkgScripts(
|
|
420
|
-
if (!ui) {
|
|
421
|
-
return {
|
|
422
|
-
dev: "sordo dev",
|
|
423
|
-
build: "sordo build",
|
|
424
|
-
start: "sordo start",
|
|
425
|
-
typecheck: "tsc --noEmit",
|
|
426
|
-
};
|
|
427
|
-
}
|
|
428
|
-
// UI projects compile Tailwind themselves (Sordo bundles no CSS). `css`
|
|
429
|
-
// emits the sheet the styles route serves; `dev`/`build` run it first so the
|
|
430
|
-
// app is styled on boot. `css:watch` rebuilds on className changes in dev.
|
|
431
|
-
const css =
|
|
432
|
-
"tailwindcss -i app/styles/app.css -o app/styles/app.generated.css";
|
|
419
|
+
function pkgScripts(): Record<string, string> {
|
|
433
420
|
return {
|
|
434
|
-
dev: "
|
|
435
|
-
build: "
|
|
421
|
+
dev: "sordo dev",
|
|
422
|
+
build: "sordo build",
|
|
436
423
|
start: "sordo start",
|
|
437
424
|
typecheck: "tsc --noEmit",
|
|
438
|
-
css,
|
|
439
|
-
"css:watch": `${css} --watch`,
|
|
440
425
|
};
|
|
441
426
|
}
|
|
442
427
|
|
|
@@ -470,7 +455,7 @@ async function writeAppPackageJson(
|
|
|
470
455
|
version: "0.1.0",
|
|
471
456
|
private: true,
|
|
472
457
|
type: "module",
|
|
473
|
-
scripts: pkgScripts(
|
|
458
|
+
scripts: pkgScripts(),
|
|
474
459
|
dependencies: sorted(dependencies),
|
|
475
460
|
devDependencies: sorted(devDependencies),
|
|
476
461
|
engines: { bun: ">=1.3.0" },
|
|
@@ -560,6 +545,13 @@ async function patchSordoConfig(dir: string, args: Args): Promise<void> {
|
|
|
560
545
|
(m) => `${m.replace(/,?\n$/, ",\n")}\tagentsMd: { path: "AGENTS.md" },\n`,
|
|
561
546
|
);
|
|
562
547
|
}
|
|
548
|
+
// UI starters ship app/styles/app.css; sordo compiles it via `css`.
|
|
549
|
+
if (args.ui && !/\bcss:/.test(nextText)) {
|
|
550
|
+
nextText = nextText.replace(
|
|
551
|
+
/target:\s*"(bun|edge)",?\n/,
|
|
552
|
+
(m) => `${m.replace(/,?\n$/, ",\n")}\tcss: "app/styles/app.css",\n`,
|
|
553
|
+
);
|
|
554
|
+
}
|
|
563
555
|
if (nextText !== current) await Bun.write(path, nextText);
|
|
564
556
|
}
|
|
565
557
|
|
package/src/ui.ts
CHANGED
|
@@ -22,10 +22,10 @@ export const UI_DEPS: Record<string, string> = {
|
|
|
22
22
|
"tailwind-merge": "^2.5.0",
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
// Dev-only: the
|
|
26
|
-
// `css
|
|
25
|
+
// Dev-only: the Bun plugin sordo's `css` build entry loads to compile the
|
|
26
|
+
// Tailwind v4 stylesheet (`css: "app/styles/app.css"` in sordo.config.ts).
|
|
27
27
|
export const UI_DEV_DEPS: Record<string, string> = {
|
|
28
|
-
"
|
|
28
|
+
"bun-plugin-tailwind": "^0.1.2",
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
const STARTER_COMPONENTS = ["button", "card", "input", "label"] as const;
|
|
@@ -99,15 +99,15 @@ async function addAppAlias(appRoot: string): Promise<void> {
|
|
|
99
99
|
await Bun.write(path, `${JSON.stringify(config, null, "\t")}\n`);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
// Tokens
|
|
102
|
+
// Tokens and the Tailwind entry both starters share; sordo.config.ts points its
|
|
103
|
+
// `css` option at app.css.
|
|
103
104
|
async function writeStyling(
|
|
104
105
|
appRoot: string,
|
|
105
106
|
theme: Theme,
|
|
106
107
|
uiStarterDir: string,
|
|
107
108
|
): Promise<void> {
|
|
108
|
-
const componentsDir = `${appRoot}/app/components`;
|
|
109
109
|
const stylesDir = `${appRoot}/app/styles`;
|
|
110
|
-
await Bun.$`mkdir -p ${
|
|
110
|
+
await Bun.$`mkdir -p ${stylesDir}`.quiet();
|
|
111
111
|
|
|
112
112
|
const themeTokens = resolve(uiStarterDir, "themes", theme, "tokens.css");
|
|
113
113
|
const tokens = existsSync(themeTokens)
|
|
@@ -117,26 +117,10 @@ async function writeStyling(
|
|
|
117
117
|
// app.css is written (not vendored) because a committed `@theme` stylesheet
|
|
118
118
|
// would trip this repo's Biome CSS parser, which has Tailwind directives off.
|
|
119
119
|
await Bun.write(`${stylesDir}/app.css`, APP_CSS);
|
|
120
|
-
// Placeholder so the styles route's `type: "text"` import always resolves,
|
|
121
|
-
// even before the first `bun run css`. `dev`/`build` recompile it; it's
|
|
122
|
-
// gitignored so the real output never gets committed.
|
|
123
|
-
await Bun.write(`${stylesDir}/app.generated.css`, GENERATED_CSS_PLACEHOLDER);
|
|
124
|
-
// Type for the `type: "text"` CSS import so `tsc --noEmit` stays clean.
|
|
125
|
-
await Bun.write(`${stylesDir}/css.d.ts`, CSS_DTS);
|
|
126
|
-
|
|
127
|
-
// CSS wiring: Sordo ships no stylesheet link, so the starter serves the
|
|
128
|
-
// compiled Tailwind output from an API route and links it via a shared
|
|
129
|
-
// `head()`. Pages opt in by re-exporting `head` (the demo + every
|
|
130
|
-
// /sordo-init page does).
|
|
131
|
-
await Bun.write(`${componentsDir}/_head.tsx`, HEAD_TSX);
|
|
132
|
-
const apiDir = `${appRoot}/app/routes/api`;
|
|
133
|
-
await Bun.$`mkdir -p ${apiDir}`.quiet();
|
|
134
|
-
await Bun.write(`${apiDir}/styles.ts`, STYLES_ROUTE);
|
|
135
120
|
}
|
|
136
121
|
|
|
137
122
|
// Pre-wired Tailwind v4 + tokens stylesheet (the wiring `sordo ui init`
|
|
138
|
-
// prints).
|
|
139
|
-
// CLI; see the generated README "Styling" section.
|
|
123
|
+
// prints). `sordo build` / `sordo dev` compile it via the `css` config option.
|
|
140
124
|
const APP_CSS = `@import "tailwindcss";
|
|
141
125
|
@import "./tokens.css";
|
|
142
126
|
|
|
@@ -165,43 +149,3 @@ const APP_CSS = `@import "tailwindcss";
|
|
|
165
149
|
--radius-sm: calc(var(--radius) - 4px);
|
|
166
150
|
}
|
|
167
151
|
`;
|
|
168
|
-
|
|
169
|
-
// Written before the first compile so the styles route always imports cleanly.
|
|
170
|
-
const GENERATED_CSS_PLACEHOLDER = `/* Generated by \`bun run css\` from app/styles/app.css — do not edit.
|
|
171
|
-
Empty until the first compile; \`bun run dev\` / \`bun run build\` regenerate it. */
|
|
172
|
-
`;
|
|
173
|
-
|
|
174
|
-
// Lets \`import css from "./app.generated.css" with { type: "text" }\` typecheck.
|
|
175
|
-
const CSS_DTS = `declare module "*.css" {
|
|
176
|
-
const css: string;
|
|
177
|
-
export default css;
|
|
178
|
-
}
|
|
179
|
-
`;
|
|
180
|
-
|
|
181
|
-
// Shared <head> contributions. Pages re-export this as `head` so every route
|
|
182
|
-
// links the compiled stylesheet that app/routes/api/styles.ts serves.
|
|
183
|
-
const HEAD_TSX = `import type * as React from "react";
|
|
184
|
-
|
|
185
|
-
// Sordo links no stylesheet on its own, so the UI starter routes one in here:
|
|
186
|
-
// pages re-export this as \`head\` (\`export { head } from "../components/_head.tsx"\`)
|
|
187
|
-
// and the renderer emits whatever it returns into <head>. The "_" prefix keeps
|
|
188
|
-
// this file out of the route table.
|
|
189
|
-
export function head(): React.ReactNode {
|
|
190
|
-
return <link rel="stylesheet" href="/api/styles" />;
|
|
191
|
-
}
|
|
192
|
-
`;
|
|
193
|
-
|
|
194
|
-
// API route that hands out the compiled Tailwind sheet. The \`type: "text"\`
|
|
195
|
-
// import embeds the CSS into the bundle, so this works in dev and in the
|
|
196
|
-
// compiled production binary alike.
|
|
197
|
-
const STYLES_ROUTE = `import css from "../../styles/app.generated.css" with { type: "text" };
|
|
198
|
-
|
|
199
|
-
// GET /api/styles — the compiled Tailwind stylesheet. Sordo ships no CSS
|
|
200
|
-
// pipeline; the \`css\` script (run by \`dev\`/\`build\`) compiles app/styles/app.css
|
|
201
|
-
// into app.generated.css, and app/components/_head.tsx links this route.
|
|
202
|
-
export function GET(): Response {
|
|
203
|
-
return new Response(css, {
|
|
204
|
-
headers: { "content-type": "text/css; charset=utf-8" },
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
`;
|
package/src/versions.ts
CHANGED
|
@@ -108,10 +108,9 @@ from this skill — that is deferred to a future spec.
|
|
|
108
108
|
- Islands (interactive client components) live under `app/islands/` and are
|
|
109
109
|
wrapped at the use site in `<Island name="…">…</Island>` from `sordo/render`.
|
|
110
110
|
`chart` and `form` are islands (they pull `recharts` / `react-hook-form`).
|
|
111
|
-
- **Styling is
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
classNames; `dev`/`build` compile it for you.
|
|
111
|
+
- **Styling is automatic.** `sordo.config.ts` sets `css: "app/styles/app.css"`;
|
|
112
|
+
`dev`/`build` compile it and link the sheet on every page, so new routes need
|
|
113
|
+
no extra setup.
|
|
115
114
|
- Mock data lives in `app/lib/mock-<entity>.ts`, typed, with the TODO marker.
|
|
116
115
|
- Never re-author component source — stamp from the catalog and import.
|
|
117
116
|
|
|
@@ -109,10 +109,9 @@ from this skill — that is deferred to a future spec.
|
|
|
109
109
|
- Islands (interactive client components) live under `app/islands/` and are
|
|
110
110
|
wrapped at the use site in `<Island name="…">…</Island>` from `sordo/render`.
|
|
111
111
|
`chart` and `form` are islands (they pull `recharts` / `react-hook-form`).
|
|
112
|
-
- **Styling is
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
classNames; `dev`/`build` compile it for you.
|
|
112
|
+
- **Styling is automatic.** `sordo.config.ts` sets `css: "app/styles/app.css"`;
|
|
113
|
+
`dev`/`build` compile it and link the sheet on every page, so new routes need
|
|
114
|
+
no extra setup.
|
|
116
115
|
- Mock data lives in `app/lib/mock-<entity>.ts`, typed, with the TODO marker.
|
|
117
116
|
- Never re-author component source — stamp from the catalog and import.
|
|
118
117
|
|
|
@@ -109,10 +109,9 @@ from this skill — that is deferred to a future spec.
|
|
|
109
109
|
- Islands (interactive client components) live under `app/islands/` and are
|
|
110
110
|
wrapped at the use site in `<Island name="…">…</Island>` from `sordo/render`.
|
|
111
111
|
`chart` and `form` are islands (they pull `recharts` / `react-hook-form`).
|
|
112
|
-
- **Styling is
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
classNames; `dev`/`build` compile it for you.
|
|
112
|
+
- **Styling is automatic.** `sordo.config.ts` sets `css: "app/styles/app.css"`;
|
|
113
|
+
`dev`/`build` compile it and link the sheet on every page, so new routes need
|
|
114
|
+
no extra setup.
|
|
116
115
|
- Mock data lives in `app/lib/mock-<entity>.ts`, typed, with the TODO marker.
|
|
117
116
|
- Never re-author component source — stamp from the catalog and import.
|
|
118
117
|
|
|
@@ -53,21 +53,12 @@ the agent section below.
|
|
|
53
53
|
|
|
54
54
|
### Styling
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
Tailwind is wired through sordo's `css` build entry:
|
|
57
57
|
|
|
58
|
-
- `app/styles/app.css` is pre-wired (`@import "tailwindcss"` + the token mapping)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
-
|
|
62
|
-
links it. Each page re-exports that `head` —
|
|
63
|
-
`export { head } from "../components/_head.tsx";` — so add the line to new pages.
|
|
64
|
-
|
|
65
|
-
While iterating on classNames, run the watcher in a second terminal so the sheet
|
|
66
|
-
rebuilds as you save:
|
|
67
|
-
|
|
68
|
-
```sh
|
|
69
|
-
bun run css:watch
|
|
70
|
-
```
|
|
58
|
+
- `app/styles/app.css` is pre-wired (`@import "tailwindcss"` + the token mapping)
|
|
59
|
+
and `sordo.config.ts` points `css` at it.
|
|
60
|
+
- `sordo dev` and `sordo build` compile it with `bun-plugin-tailwind` into a
|
|
61
|
+
content-hashed sheet that every page links automatically — no per-page setup.
|
|
71
62
|
<!-- /if -->
|
|
72
63
|
|
|
73
64
|
## Project layout
|
|
@@ -11,10 +11,6 @@ import {
|
|
|
11
11
|
DialogTrigger,
|
|
12
12
|
} from "@/components/ui/dialog";
|
|
13
13
|
|
|
14
|
-
// Links the compiled Tailwind sheet (served by app/routes/api/styles.ts). Every
|
|
15
|
-
// page route re-exports this so it renders styled — keep it on new pages too.
|
|
16
|
-
export { head } from "../components/_head.tsx";
|
|
17
|
-
|
|
18
14
|
// Whole-tree hydration: this page's entire React tree hydrates in the browser,
|
|
19
15
|
// so upstream shadcn/ui components work as written — function props, shared
|
|
20
16
|
// context, no island wrappers. Pages without this export ship zero JS.
|
|
@@ -8,10 +8,6 @@ import {
|
|
|
8
8
|
} from "../components/ui/card.tsx";
|
|
9
9
|
import TodoApp from "../islands/TodoApp.tsx";
|
|
10
10
|
|
|
11
|
-
// Links the compiled Tailwind sheet (served by app/routes/api/styles.ts). Every
|
|
12
|
-
// page route re-exports this so it renders styled — keep it on new pages too.
|
|
13
|
-
export { head } from "../components/_head.tsx";
|
|
14
|
-
|
|
15
11
|
export const meta = {
|
|
16
12
|
title: "Welcome to Sordo",
|
|
17
13
|
description: "A Bun-native full-stack meta-framework.",
|