mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
add cloudflare workers support for all frontends (#366)
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
ORMSchema,
|
||||
PackageManagerSchema,
|
||||
RuntimeSchema,
|
||||
WebDeploySchema,
|
||||
} from "../../cli/src/types";
|
||||
|
||||
const DATABASE_VALUES = DatabaseSchema.options;
|
||||
@@ -23,91 +24,97 @@ const EXAMPLES_VALUES = ExamplesSchema.options;
|
||||
const PACKAGE_MANAGER_VALUES = PackageManagerSchema.options;
|
||||
const DATABASE_SETUP_VALUES = DatabaseSetupSchema.options;
|
||||
const API_VALUES = APISchema.options;
|
||||
const WEB_DEPLOY_VALUES = WebDeploySchema.options;
|
||||
|
||||
const schema = {
|
||||
const configSchema = {
|
||||
$schema: "http://json-schema.org/draft-07/schema#",
|
||||
$id: "https://better-t-stack.dev/schema.json",
|
||||
title: "Better-T-Stack Configuration",
|
||||
description: "Configuration file for Better-T-Stack projects",
|
||||
type: "object" as const,
|
||||
type: "object",
|
||||
properties: {
|
||||
$schema: {
|
||||
type: "string" as const,
|
||||
type: "string",
|
||||
description: "JSON Schema reference for validation",
|
||||
},
|
||||
version: {
|
||||
type: "string" as const,
|
||||
type: "string",
|
||||
description: "CLI version used to create this project",
|
||||
pattern: "^\\d+\\.\\d+\\.\\d+$",
|
||||
},
|
||||
createdAt: {
|
||||
type: "string" as const,
|
||||
format: "date-time" as const,
|
||||
type: "string",
|
||||
format: "date-time",
|
||||
description: "Timestamp when the project was created",
|
||||
},
|
||||
database: {
|
||||
type: "string" as const,
|
||||
type: "string",
|
||||
enum: DATABASE_VALUES,
|
||||
description: DatabaseSchema.description,
|
||||
},
|
||||
orm: {
|
||||
type: "string" as const,
|
||||
type: "string",
|
||||
enum: ORM_VALUES,
|
||||
description: ORMSchema.description,
|
||||
},
|
||||
backend: {
|
||||
type: "string" as const,
|
||||
type: "string",
|
||||
enum: BACKEND_VALUES,
|
||||
description: BackendSchema.description,
|
||||
},
|
||||
runtime: {
|
||||
type: "string" as const,
|
||||
type: "string",
|
||||
enum: RUNTIME_VALUES,
|
||||
description: RuntimeSchema.description,
|
||||
},
|
||||
frontend: {
|
||||
type: "array" as const,
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string" as const,
|
||||
type: "string",
|
||||
enum: FRONTEND_VALUES,
|
||||
},
|
||||
description: FrontendSchema.description,
|
||||
},
|
||||
addons: {
|
||||
type: "array" as const,
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string" as const,
|
||||
type: "string",
|
||||
enum: ADDONS_VALUES,
|
||||
},
|
||||
description: AddonsSchema.description,
|
||||
},
|
||||
examples: {
|
||||
type: "array" as const,
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string" as const,
|
||||
type: "string",
|
||||
enum: EXAMPLES_VALUES,
|
||||
},
|
||||
description: ExamplesSchema.description,
|
||||
},
|
||||
auth: {
|
||||
type: "boolean" as const,
|
||||
type: "boolean",
|
||||
description: "Whether authentication is enabled",
|
||||
},
|
||||
packageManager: {
|
||||
type: "string" as const,
|
||||
type: "string",
|
||||
enum: PACKAGE_MANAGER_VALUES,
|
||||
description: PackageManagerSchema.description,
|
||||
},
|
||||
dbSetup: {
|
||||
type: "string" as const,
|
||||
type: "string",
|
||||
enum: DATABASE_SETUP_VALUES,
|
||||
description: DatabaseSetupSchema.description,
|
||||
},
|
||||
api: {
|
||||
type: "string" as const,
|
||||
type: "string",
|
||||
enum: API_VALUES,
|
||||
description: APISchema.description,
|
||||
},
|
||||
webDeploy: {
|
||||
type: "string",
|
||||
enum: WEB_DEPLOY_VALUES,
|
||||
description: WebDeploySchema.description,
|
||||
},
|
||||
},
|
||||
required: [
|
||||
"version",
|
||||
@@ -123,6 +130,7 @@ const schema = {
|
||||
"packageManager",
|
||||
"dbSetup",
|
||||
"api",
|
||||
"webDeploy",
|
||||
],
|
||||
additionalProperties: false,
|
||||
};
|
||||
@@ -130,7 +138,11 @@ const schema = {
|
||||
async function generateSchema() {
|
||||
const schemaPath = path.join(process.cwd(), "public", "schema.json");
|
||||
await fs.ensureDir(path.dirname(schemaPath));
|
||||
await fs.writeFile(schemaPath, JSON.stringify(schema, null, 2), "utf-8");
|
||||
await fs.writeFile(
|
||||
schemaPath,
|
||||
JSON.stringify(configSchema, null, 2),
|
||||
"utf-8",
|
||||
);
|
||||
console.log("✅ Generated schema.json from shared types package");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user