create-backon 0.6.0 → 0.6.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-backon",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "type": "module",
5
5
  "description": "Scaffolds a new backend project on backon — like `bun create vite@latest`, but for a consistent controller/routes/services backend layout.",
6
6
  "license": "MIT",
@@ -159,15 +159,21 @@ ${mounts}
159
159
  // rather than starting the server, so running this doesn't require anything
160
160
  // to be listening — generateOpenApiSpec() only needs the app's routes
161
161
  // registered, which happens at import time.
162
+ //
163
+ // docs.html embeds the spec directly (apiReferenceHtmlInline), rather than
164
+ // pointing at ./openapi.json the way the live serveApiDocs() page does —
165
+ // this file gets opened straight from disk as often as it's served over
166
+ // HTTP, and a browser blocks one file:// URL from fetching another, so a
167
+ // URL-based page would fail exactly there.
162
168
  export function renderGenerateDocsScript(projectName: string, framework: Framework): string {
163
169
  const backonImport = framework === "express" ? "@mednours/backon/express" : "@mednours/backon";
164
170
  return `import { writeFileSync } from "node:fs";
165
- import { generateOpenApiSpec, apiReferenceHtml } from "${backonImport}";
171
+ import { generateOpenApiSpec, apiReferenceHtmlInline } from "${backonImport}";
166
172
  import { app } from "../src/app";
167
173
 
168
174
  const spec = generateOpenApiSpec(app, { title: "${projectName}", version: "0.1.0" });
169
175
  writeFileSync("openapi.json", JSON.stringify(spec, null, 2));
170
- writeFileSync("docs.html", apiReferenceHtml("./openapi.json", "${projectName}"));
176
+ writeFileSync("docs.html", apiReferenceHtmlInline(spec, "${projectName}"));
171
177
 
172
178
  console.log("Wrote openapi.json and docs.html");
173
179
  `;