create-sordo 0.4.0 → 0.5.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 +6 -0
- package/package.json +1 -1
- package/src/index.ts +30 -0
- package/src/ui.ts +1 -0
- package/src/versions.ts +1 -1
- package/templates/default/README-template.md +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# create-sordo
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5a49288: Fix the gaps found verifying the Cloudflare recipe. The UI starter now installs `tailwindcss`, and `--deploy cloudflare` on edge adds `@sordo/deploy-cloudflare` plus a `plugins` entry to `sordo.config.ts`. Edge builds in the default inline mode now serve `public/` files at `/_sordo/assets/<name>`. Build failures report the bundler's logs instead of a bare "Bundle failed", and a css build that cannot resolve a package names it. The generated edge `fetch` is typed so it passes a strict tsconfig. The README augments `SordoBindings` through `sordo/middleware` and no longer claims the scaffold's `build` script generates CSS.
|
|
8
|
+
|
|
3
9
|
## 0.4.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -145,6 +145,9 @@ export async function run(argv: string[]): Promise<number> {
|
|
|
145
145
|
// Gating (spec 18 §Behavior): backend has no UI surface; only full-stack
|
|
146
146
|
// projects can be a monorepo or use the container target.
|
|
147
147
|
if (args.type === "backend") args.ui = false;
|
|
148
|
+
// Deploy plugins only apply to the edge target; the README and package.json
|
|
149
|
+
// would otherwise describe a plugin that isn't installed.
|
|
150
|
+
if (args.target !== "edge") args.deploy = "none";
|
|
148
151
|
if (args.type !== "fullstack") {
|
|
149
152
|
args.monorepo = false;
|
|
150
153
|
if (args.target === "container") {
|
|
@@ -443,6 +446,9 @@ async function writeAppPackageJson(
|
|
|
443
446
|
"bun-types": "^1.3.0",
|
|
444
447
|
typescript: "^5.5.0",
|
|
445
448
|
};
|
|
449
|
+
if (wantsCloudflarePlugin(args)) {
|
|
450
|
+
devDependencies["@sordo/deploy-cloudflare"] = `^${SORDO_VERSION}`;
|
|
451
|
+
}
|
|
446
452
|
if (args.ui) {
|
|
447
453
|
Object.assign(
|
|
448
454
|
dependencies,
|
|
@@ -529,6 +535,10 @@ function configTarget(target: Target): "bun" | "edge" {
|
|
|
529
535
|
return target === "edge" ? "edge" : "bun";
|
|
530
536
|
}
|
|
531
537
|
|
|
538
|
+
function wantsCloudflarePlugin(args: Args): boolean {
|
|
539
|
+
return args.target === "edge" && args.deploy === "cloudflare";
|
|
540
|
+
}
|
|
541
|
+
|
|
532
542
|
async function patchSordoConfig(dir: string, args: Args): Promise<void> {
|
|
533
543
|
const path = `${dir}/sordo.config.ts`;
|
|
534
544
|
if (!(await Bun.file(path).exists())) return;
|
|
@@ -552,6 +562,26 @@ async function patchSordoConfig(dir: string, args: Args): Promise<void> {
|
|
|
552
562
|
(m) => `${m.replace(/,?\n$/, ",\n")}\tcss: "app/styles/app.css",\n`,
|
|
553
563
|
);
|
|
554
564
|
}
|
|
565
|
+
if (wantsCloudflarePlugin(args) && !/\bplugins:/.test(nextText)) {
|
|
566
|
+
const importRe = /^(import \{ defineConfig \} from "sordo\/config";\n)/;
|
|
567
|
+
const targetRe = /target:\s*"(bun|edge)",?\n/;
|
|
568
|
+
// Patch both or neither: a plugins entry without its import won't load.
|
|
569
|
+
if (!importRe.test(nextText) || !targetRe.test(nextText)) {
|
|
570
|
+
throw new Error(
|
|
571
|
+
"create-sordo: sordo.config.ts template no longer matches the Cloudflare plugin patch",
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
nextText = nextText
|
|
575
|
+
.replace(
|
|
576
|
+
importRe,
|
|
577
|
+
`$1import { cloudflare } from "@sordo/deploy-cloudflare";\n`,
|
|
578
|
+
)
|
|
579
|
+
.replace(
|
|
580
|
+
targetRe,
|
|
581
|
+
(m) =>
|
|
582
|
+
`${m.replace(/,?\n$/, ",\n")}\tplugins: [cloudflare({ name: ${JSON.stringify(args.name)} })],\n`,
|
|
583
|
+
);
|
|
584
|
+
}
|
|
555
585
|
if (nextText !== current) await Bun.write(path, nextText);
|
|
556
586
|
}
|
|
557
587
|
|
package/src/ui.ts
CHANGED
|
@@ -26,6 +26,7 @@ export const UI_DEPS: Record<string, string> = {
|
|
|
26
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
|
+
tailwindcss: "^4.0.0",
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
const STARTER_COMPONENTS = ["button", "card", "input", "label"] as const;
|
package/src/versions.ts
CHANGED
|
@@ -116,8 +116,10 @@ docker run -p 3000:3000 {{name}}
|
|
|
116
116
|
<!-- if:deploy=cloudflare -->
|
|
117
117
|
## Deploy
|
|
118
118
|
|
|
119
|
-
This project is configured for **Cloudflare** deployment
|
|
120
|
-
`@sordo/deploy-cloudflare` plugin
|
|
119
|
+
This project is configured for **Cloudflare** deployment: the
|
|
120
|
+
`@sordo/deploy-cloudflare` plugin is installed and listed in `sordo.config.ts`
|
|
121
|
+
(edge target only). Run `bunx wrangler login`, then `bunx sordo deploy`. See
|
|
122
|
+
the plugin docs for options.
|
|
121
123
|
<!-- /if -->
|
|
122
124
|
<!-- if:deploy=vercel -->
|
|
123
125
|
## Deploy
|