flarecms 0.2.1 → 0.2.3
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/dist/api/lib/cache.d.ts +18 -0
- package/dist/api/lib/response.d.ts +44 -0
- package/dist/api/middlewares/auth.d.ts +10 -0
- package/dist/api/middlewares/cors.d.ts +1 -0
- package/dist/api/middlewares/rbac.d.ts +21 -0
- package/dist/api/routes/auth.d.ts +6 -0
- package/dist/api/routes/collections.d.ts +6 -0
- package/dist/api/routes/content.d.ts +6 -0
- package/dist/api/routes/device.d.ts +6 -0
- package/dist/api/routes/magic.d.ts +6 -0
- package/dist/api/routes/mcp.d.ts +6 -0
- package/dist/api/routes/oauth.d.ts +6 -0
- package/dist/api/routes/plugins.d.ts +6 -0
- package/dist/api/routes/settings.d.ts +6 -0
- package/dist/api/routes/setup.d.ts +6 -0
- package/dist/api/routes/tokens.d.ts +6 -0
- package/dist/api/schemas/auth.d.ts +12 -0
- package/dist/api/schemas/index.d.ts +43 -0
- package/dist/api/schemas/tokens.d.ts +20 -0
- package/dist/auth/index.d.ts +11 -0
- package/dist/cli/commands.d.ts +3 -0
- package/dist/cli/commands.js +50 -28
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +50 -28
- package/dist/cli/mcp.d.ts +9 -0
- package/dist/cli/tests/cli.test.d.ts +1 -0
- package/dist/cli/tests/create-plugin-template.test.d.ts +1 -0
- package/dist/cli/tests/create.test.d.ts +1 -0
- package/dist/cli/tests/plugin.test.d.ts +1 -0
- package/dist/cli/tests/publish.test.d.ts +1 -0
- package/dist/client/FlareAdminRouter.d.ts +20 -0
- package/dist/client/app.d.ts +1 -0
- package/dist/client/components/app-sidebar.d.ts +5 -0
- package/dist/client/components/blocks/block-card.d.ts +7 -0
- package/dist/client/components/blocks/block-form.d.ts +7 -0
- package/dist/client/components/blocks/block-renderer.d.ts +10 -0
- package/dist/client/components/blocks/block-table.d.ts +7 -0
- package/dist/client/components/collection-modal.d.ts +6 -0
- package/dist/client/components/content-list.d.ts +3 -0
- package/dist/client/components/dynamic-form.d.ts +9 -0
- package/dist/client/components/field-modal.d.ts +8 -0
- package/dist/client/components/plugin-widget.d.ts +6 -0
- package/dist/client/components/settings/api-token-section.d.ts +1 -0
- package/dist/client/components/settings/general-section.d.ts +1 -0
- package/dist/client/components/settings/security-section.d.ts +1 -0
- package/dist/client/components/settings/seo-section.d.ts +1 -0
- package/dist/client/components/settings/signup-section.d.ts +1 -0
- package/dist/client/components/ui/accordion.d.ts +6 -0
- package/dist/client/components/ui/avatar.d.ts +11 -0
- package/dist/client/components/ui/badge.d.ts +7 -0
- package/dist/client/components/ui/button.d.ts +11 -0
- package/dist/client/components/ui/card.d.ts +11 -0
- package/dist/client/components/ui/checkbox.d.ts +3 -0
- package/dist/client/components/ui/collapsible.d.ts +5 -0
- package/dist/client/components/ui/dialog.d.ts +17 -0
- package/dist/client/components/ui/icon-picker.d.ts +27 -0
- package/dist/client/components/ui/icons-data.d.ts +5 -0
- package/dist/client/components/ui/input.d.ts +3 -0
- package/dist/client/components/ui/label.d.ts +3 -0
- package/dist/client/components/ui/popover.d.ts +10 -0
- package/dist/client/components/ui/select.d.ts +15 -0
- package/dist/client/components/ui/separator.d.ts +3 -0
- package/dist/client/components/ui/sheet.d.ts +14 -0
- package/dist/client/components/ui/sidebar.d.ts +63 -0
- package/dist/client/components/ui/skeleton.d.ts +2 -0
- package/dist/client/components/ui/sonner.d.ts +3 -0
- package/dist/client/components/ui/switch.d.ts +5 -0
- package/dist/client/components/ui/table.d.ts +10 -0
- package/dist/client/components/ui/tabs.d.ts +10 -0
- package/dist/client/components/ui/textarea.d.ts +3 -0
- package/dist/client/components/ui/tooltip.d.ts +6 -0
- package/dist/client/hooks/use-mobile.d.ts +1 -0
- package/dist/client/index.d.ts +8 -0
- package/dist/client/layouts/admin-layout.d.ts +6 -0
- package/dist/client/layouts/settings-layout.d.ts +6 -0
- package/dist/client/lib/api.d.ts +18 -0
- package/dist/client/lib/block-registry.d.ts +24 -0
- package/dist/client/lib/block-types.d.ts +132 -0
- package/dist/client/lib/utils.d.ts +2 -0
- package/dist/client/main.d.ts +1 -0
- package/dist/client/pages/collection-detail.d.ts +7 -0
- package/dist/client/pages/collections.d.ts +1 -0
- package/dist/client/pages/dashboard.d.ts +1 -0
- package/dist/client/pages/device.d.ts +1 -0
- package/dist/client/pages/document-detail-page.d.ts +1 -0
- package/dist/client/pages/documents-page.d.ts +1 -0
- package/dist/client/pages/login.d.ts +1 -0
- package/dist/client/pages/plugin-manager.d.ts +1 -0
- package/dist/client/pages/plugin-page.d.ts +6 -0
- package/dist/client/pages/settings.d.ts +1 -0
- package/dist/client/pages/setup.d.ts +1 -0
- package/dist/client/pages/signup.d.ts +1 -0
- package/dist/client/store/auth.d.ts +10 -0
- package/dist/client/store/collections.d.ts +3 -0
- package/dist/client/store/config.d.ts +4 -0
- package/dist/client/store/fetcher.d.ts +4 -0
- package/dist/client/store/plugins.d.ts +21 -0
- package/dist/client/store/router.d.ts +84 -0
- package/dist/client/store/schema.d.ts +7 -0
- package/dist/client/store/settings.d.ts +7 -0
- package/dist/client/types.d.ts +31 -0
- package/dist/db/dynamic.d.ts +5 -0
- package/dist/db/index.d.ts +8 -0
- package/dist/db/migrations/001_initial_schema.d.ts +3 -0
- package/dist/db/migrations/002_auth_tables.d.ts +3 -0
- package/dist/db/migrations/003_plugins.d.ts +3 -0
- package/dist/db/migrator.d.ts +10 -0
- package/dist/db/schema.d.ts +151 -0
- package/dist/index.d.ts +11 -0
- package/dist/plugins/adapt-entry.d.ts +5 -0
- package/dist/plugins/context.d.ts +21 -0
- package/dist/plugins/define-plugin.d.ts +22 -0
- package/dist/plugins/hooks.d.ts +37 -0
- package/dist/plugins/index.d.ts +7 -0
- package/dist/plugins/manager.d.ts +41 -0
- package/dist/plugins/middleware.d.ts +8 -0
- package/dist/plugins/noop-sandbox.d.ts +18 -0
- package/dist/plugins/routes.d.ts +32 -0
- package/dist/plugins/sandbox/bridge.d.ts +45 -0
- package/dist/plugins/sandbox/runner.d.ts +14 -0
- package/dist/plugins/sandbox/types.d.ts +71 -0
- package/dist/plugins/sandbox/wrapper.d.ts +6 -0
- package/dist/plugins/types.d.ts +725 -0
- package/dist/server/index.d.ts +18 -0
- package/dist/types.d.ts +19 -0
- package/package.json +34 -10
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { KVNamespace } from "@cloudflare/workers-types";
|
|
2
|
+
export interface SchemaCache {
|
|
3
|
+
id: string;
|
|
4
|
+
slug: string;
|
|
5
|
+
label: string;
|
|
6
|
+
is_public: number;
|
|
7
|
+
features: string[];
|
|
8
|
+
url_pattern: string | null;
|
|
9
|
+
fields: any[];
|
|
10
|
+
}
|
|
11
|
+
export declare const cache: {
|
|
12
|
+
getSchema(kv: KVNamespace, slug: string): Promise<SchemaCache | null>;
|
|
13
|
+
setSchema(kv: KVNamespace, slug: string, schema: SchemaCache): Promise<void>;
|
|
14
|
+
invalidateSchema(kv: KVNamespace, slug: string): Promise<void>;
|
|
15
|
+
getCollectionList(kv: KVNamespace): Promise<any[] | null>;
|
|
16
|
+
setCollectionList(kv: KVNamespace, collections: any[]): Promise<void>;
|
|
17
|
+
invalidateCollectionList(kv: KVNamespace): Promise<void>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Context } from 'hono';
|
|
2
|
+
export interface PaginationMeta {
|
|
3
|
+
page: number;
|
|
4
|
+
limit: number;
|
|
5
|
+
total: number;
|
|
6
|
+
totalPages: number;
|
|
7
|
+
hasNextPage: boolean;
|
|
8
|
+
hasPrevPage: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const apiResponse: {
|
|
11
|
+
/**
|
|
12
|
+
* Send a successful response with data and optional metadata
|
|
13
|
+
*/
|
|
14
|
+
ok: (c: Context, data: any, meta?: any, status?: number) => Response & import("hono").TypedResponse<{
|
|
15
|
+
data: any;
|
|
16
|
+
meta: any;
|
|
17
|
+
}, any, "json">;
|
|
18
|
+
/**
|
|
19
|
+
* Send a paginated response
|
|
20
|
+
*/
|
|
21
|
+
paginated: (c: Context, data: any[], meta: PaginationMeta, status?: number) => Response & import("hono").TypedResponse<{
|
|
22
|
+
data: any[];
|
|
23
|
+
meta: {
|
|
24
|
+
page: number;
|
|
25
|
+
limit: number;
|
|
26
|
+
total: number;
|
|
27
|
+
totalPages: number;
|
|
28
|
+
hasNextPage: boolean;
|
|
29
|
+
hasPrevPage: boolean;
|
|
30
|
+
};
|
|
31
|
+
}, any, "json">;
|
|
32
|
+
/**
|
|
33
|
+
* Send an error response
|
|
34
|
+
*/
|
|
35
|
+
error: (c: Context, message: string | any, status?: number) => Response & import("hono").TypedResponse<{
|
|
36
|
+
error: any;
|
|
37
|
+
}, any, "json">;
|
|
38
|
+
/**
|
|
39
|
+
* Specialized success response for creations
|
|
40
|
+
*/
|
|
41
|
+
created: (c: Context, data: any) => Response & import("hono").TypedResponse<{
|
|
42
|
+
data: any;
|
|
43
|
+
}, 201, "json">;
|
|
44
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Context, Next } from 'hono';
|
|
2
|
+
export declare const authMiddleware: (c: Context, next: Next) => Promise<void | (Response & import("hono").TypedResponse<{
|
|
3
|
+
error: string;
|
|
4
|
+
}, 401, "json">) | (Response & import("hono").TypedResponse<{
|
|
5
|
+
error: string;
|
|
6
|
+
}, 403, "json">)>;
|
|
7
|
+
export declare const setupMiddleware: (c: Context, next: Next) => Promise<void | (Response & import("hono").TypedResponse<{
|
|
8
|
+
error: string;
|
|
9
|
+
code: string;
|
|
10
|
+
}, 403, "json">)>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const corsMiddleware: import("hono").MiddlewareHandler;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Context, Next } from 'hono';
|
|
2
|
+
/**
|
|
3
|
+
* Ensures the authenticated user has one of the allowed roles.
|
|
4
|
+
* Must be used AFTER authMiddleware.
|
|
5
|
+
*/
|
|
6
|
+
export declare const requireRole: (allowedRoles: string[]) => (c: Context, next: Next) => Promise<void | (Response & import("hono").TypedResponse<{
|
|
7
|
+
error: string;
|
|
8
|
+
}, 401, "json">) | (Response & import("hono").TypedResponse<{
|
|
9
|
+
error: string;
|
|
10
|
+
requiredRoles: string[];
|
|
11
|
+
}, 403, "json">)>;
|
|
12
|
+
export declare const requireScope: (action: string, resourceOrParamName?: string) => (c: Context, next: Next) => Promise<void | (Response & import("hono").TypedResponse<{
|
|
13
|
+
error: string;
|
|
14
|
+
code: string;
|
|
15
|
+
}, 401, "json">) | (Response & import("hono").TypedResponse<{
|
|
16
|
+
error: string;
|
|
17
|
+
required: {
|
|
18
|
+
action: string;
|
|
19
|
+
resource: string | undefined;
|
|
20
|
+
};
|
|
21
|
+
}, 403, "json">)>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const magicLinkRequestSchema: z.ZodObject<{
|
|
3
|
+
email: z.ZodString;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export declare const magicLinkVerifySchema: z.ZodObject<{
|
|
6
|
+
email: z.ZodString;
|
|
7
|
+
token: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const oauthCallbackSchema: z.ZodObject<{
|
|
10
|
+
code: z.ZodString;
|
|
11
|
+
state: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const loginSchema: z.ZodObject<{
|
|
3
|
+
email: z.ZodEmail;
|
|
4
|
+
password: z.ZodString;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export declare const signupSchema: z.ZodObject<{
|
|
7
|
+
email: z.ZodEmail;
|
|
8
|
+
password: z.ZodString;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export declare const collectionSchema: z.ZodObject<{
|
|
11
|
+
slug: z.ZodString;
|
|
12
|
+
label: z.ZodString;
|
|
13
|
+
labelSingular: z.ZodOptional<z.ZodString>;
|
|
14
|
+
description: z.ZodOptional<z.ZodString>;
|
|
15
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
16
|
+
isPublic: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
features: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
18
|
+
urlPattern: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const fieldSchema: z.ZodObject<{
|
|
21
|
+
slug: z.ZodString;
|
|
22
|
+
label: z.ZodString;
|
|
23
|
+
type: z.ZodString;
|
|
24
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export declare const setupSchema: z.ZodObject<{
|
|
27
|
+
title: z.ZodString;
|
|
28
|
+
email: z.ZodEmail;
|
|
29
|
+
password: z.ZodString;
|
|
30
|
+
name: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
export declare const dynamicContentSchema: z.ZodObject<{
|
|
33
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
34
|
+
status: z.ZodOptional<z.ZodString>;
|
|
35
|
+
title: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, z.core.$loose>;
|
|
37
|
+
export declare const webauthnOptionsSchema: z.ZodObject<{
|
|
38
|
+
email: z.ZodString;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
export declare const webauthnVerifySchema: z.ZodObject<{
|
|
41
|
+
email: z.ZodString;
|
|
42
|
+
response: z.ZodAny;
|
|
43
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const tokenCreateSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
scopes: z.ZodArray<z.ZodObject<{
|
|
5
|
+
resource: z.ZodString;
|
|
6
|
+
actions: z.ZodArray<z.ZodString>;
|
|
7
|
+
}, z.core.$strip>>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const deviceCodeRequestSchema: z.ZodObject<{
|
|
10
|
+
client_id: z.ZodString;
|
|
11
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export declare const deviceTokenRequestSchema: z.ZodObject<{
|
|
14
|
+
client_id: z.ZodString;
|
|
15
|
+
device_code: z.ZodString;
|
|
16
|
+
grant_type: z.ZodLiteral<"urn:ietf:params:oauth:grant-type:device_code">;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export declare const deviceApproveSchema: z.ZodObject<{
|
|
19
|
+
user_code: z.ZodString;
|
|
20
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate a random token for sessions
|
|
3
|
+
*/
|
|
4
|
+
export declare function generateSessionToken(): string;
|
|
5
|
+
/**
|
|
6
|
+
* Hash a password using SHA-256 (for ultra-lightweight worker usage)
|
|
7
|
+
* Note: In a real production app, you might want Scrypt or Argon2id,
|
|
8
|
+
* but those can be slow on the Edge. SHA-256 + Salt is a light starting point.
|
|
9
|
+
*/
|
|
10
|
+
export declare function hashPassword(password: string): Promise<string>;
|
|
11
|
+
export declare function verifyPassword(password: string, hash: string): Promise<boolean>;
|
package/dist/cli/commands.js
CHANGED
|
@@ -6490,32 +6490,52 @@ async function createProjectCommand() {
|
|
|
6490
6490
|
}
|
|
6491
6491
|
s3.start("Injecting FlareCMS configuration...");
|
|
6492
6492
|
}
|
|
6493
|
-
const template = TEMPLATES[templateKey];
|
|
6494
6493
|
const currentFilePath = fileURLToPath(import.meta.url);
|
|
6495
6494
|
const cliDir = resolve(currentFilePath, "..");
|
|
6496
6495
|
const localTemplatesRoot = resolve(cliDir, "..", "..", "..", "..", "templates");
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6496
|
+
if (templateKey === "plugin-development") {
|
|
6497
|
+
const pkgPath = resolve(projectDir, "package.json");
|
|
6498
|
+
const rootPkg = {
|
|
6499
|
+
name: projectName,
|
|
6500
|
+
version: "0.1.0",
|
|
6501
|
+
private: true,
|
|
6502
|
+
workspaces: ["plugins/*", "apps/*"],
|
|
6503
|
+
scripts: {
|
|
6504
|
+
dev: "bun --cwd apps/playground dev"
|
|
6505
|
+
}
|
|
6506
|
+
};
|
|
6507
|
+
mkdirSync(resolve(projectDir, "plugins"), { recursive: true });
|
|
6508
|
+
mkdirSync(resolve(projectDir, "apps"), { recursive: true });
|
|
6509
|
+
cpSync(resolve(localTemplatesRoot, "plugin-development", "starter-plugin"), resolve(projectDir, "plugins", "starter-plugin"), { recursive: true });
|
|
6510
|
+
cpSync(resolve(localTemplatesRoot, "plugin-development", "starter-playground"), resolve(projectDir, "apps", "playground"), { recursive: true });
|
|
6511
|
+
writeFileSync(pkgPath, JSON.stringify(rootPkg, null, 2));
|
|
6512
|
+
} else {
|
|
6513
|
+
const template = TEMPLATES[templateKey];
|
|
6514
|
+
const localTemplatePath = resolve(localTemplatesRoot, template.dir.split("/").pop() || "");
|
|
6515
|
+
if (existsSync2(localTemplatePath)) {
|
|
6516
|
+
if (!existsSync2(projectDir)) {
|
|
6517
|
+
mkdirSync(projectDir, { recursive: true });
|
|
6518
|
+
}
|
|
6519
|
+
cpSync(localTemplatePath, projectDir, { recursive: true });
|
|
6520
|
+
} else if (templateKey !== "nextjs") {
|
|
6521
|
+
const remoteSource = `github:fhorray/flarecms/${template.dir}`;
|
|
6522
|
+
await downloadTemplate(remoteSource, {
|
|
6523
|
+
dir: projectDir,
|
|
6524
|
+
force: true
|
|
6525
|
+
});
|
|
6501
6526
|
}
|
|
6502
|
-
cpSync(localTemplatePath, projectDir, { recursive: true });
|
|
6503
|
-
} else if (templateKey !== "nextjs") {
|
|
6504
|
-
const remoteSource = `github:fhorray/flarecms/${template.dir}`;
|
|
6505
|
-
await downloadTemplate(remoteSource, {
|
|
6506
|
-
dir: projectDir,
|
|
6507
|
-
force: true
|
|
6508
|
-
});
|
|
6509
6527
|
}
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6528
|
+
if (templateKey !== "plugin-development") {
|
|
6529
|
+
const pkgPath = resolve(projectDir, "package.json");
|
|
6530
|
+
if (existsSync2(pkgPath)) {
|
|
6531
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
6532
|
+
pkg.name = projectName;
|
|
6533
|
+
pkg.version = "0.1.0";
|
|
6534
|
+
pkg.dependencies = pkg.dependencies || {};
|
|
6535
|
+
pkg.dependencies["flarecms"] = "latest";
|
|
6536
|
+
pkg.dependencies["hono"] = "latest";
|
|
6537
|
+
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
|
|
6538
|
+
}
|
|
6519
6539
|
}
|
|
6520
6540
|
const wranglerPath = resolve(projectDir, "wrangler.jsonc");
|
|
6521
6541
|
if (existsSync2(wranglerPath)) {
|
|
@@ -6530,16 +6550,18 @@ async function createProjectCommand() {
|
|
|
6530
6550
|
try {
|
|
6531
6551
|
await execAsync("bun install", { cwd: projectDir });
|
|
6532
6552
|
s3.stop("Dependencies installed!");
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6553
|
+
if (templateKey !== "plugin-development") {
|
|
6554
|
+
s3.start("Generating TypeScript bindings...");
|
|
6555
|
+
try {
|
|
6556
|
+
await execAsync("bun wrangler types", { cwd: projectDir });
|
|
6557
|
+
s3.stop("TypeScript bindings generated!");
|
|
6558
|
+
} catch (err) {
|
|
6559
|
+
s3.stop("Failed to generate bindings (this is normal if wrangler.jsonc is incomplete)");
|
|
6560
|
+
}
|
|
6539
6561
|
}
|
|
6540
6562
|
} catch (err) {
|
|
6541
6563
|
s3.stop("Failed to install dependencies");
|
|
6542
|
-
O2.warn(`Run ${import_picocolors.default.cyan(`cd ${projectName} && bun install
|
|
6564
|
+
O2.warn(`Run ${import_picocolors.default.cyan(`cd ${projectName} && bun install`)} manually`);
|
|
6543
6565
|
}
|
|
6544
6566
|
}
|
|
6545
6567
|
const steps = [`cd ${projectName}`, "bun run dev"];
|
package/dist/cli/index.js
CHANGED
|
@@ -6491,32 +6491,52 @@ async function createProjectCommand() {
|
|
|
6491
6491
|
}
|
|
6492
6492
|
s3.start("Injecting FlareCMS configuration...");
|
|
6493
6493
|
}
|
|
6494
|
-
const template = TEMPLATES[templateKey];
|
|
6495
6494
|
const currentFilePath = fileURLToPath(import.meta.url);
|
|
6496
6495
|
const cliDir = resolve(currentFilePath, "..");
|
|
6497
6496
|
const localTemplatesRoot = resolve(cliDir, "..", "..", "..", "..", "templates");
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6497
|
+
if (templateKey === "plugin-development") {
|
|
6498
|
+
const pkgPath = resolve(projectDir, "package.json");
|
|
6499
|
+
const rootPkg = {
|
|
6500
|
+
name: projectName,
|
|
6501
|
+
version: "0.1.0",
|
|
6502
|
+
private: true,
|
|
6503
|
+
workspaces: ["plugins/*", "apps/*"],
|
|
6504
|
+
scripts: {
|
|
6505
|
+
dev: "bun --cwd apps/playground dev"
|
|
6506
|
+
}
|
|
6507
|
+
};
|
|
6508
|
+
mkdirSync(resolve(projectDir, "plugins"), { recursive: true });
|
|
6509
|
+
mkdirSync(resolve(projectDir, "apps"), { recursive: true });
|
|
6510
|
+
cpSync(resolve(localTemplatesRoot, "plugin-development", "starter-plugin"), resolve(projectDir, "plugins", "starter-plugin"), { recursive: true });
|
|
6511
|
+
cpSync(resolve(localTemplatesRoot, "plugin-development", "starter-playground"), resolve(projectDir, "apps", "playground"), { recursive: true });
|
|
6512
|
+
writeFileSync(pkgPath, JSON.stringify(rootPkg, null, 2));
|
|
6513
|
+
} else {
|
|
6514
|
+
const template = TEMPLATES[templateKey];
|
|
6515
|
+
const localTemplatePath = resolve(localTemplatesRoot, template.dir.split("/").pop() || "");
|
|
6516
|
+
if (existsSync2(localTemplatePath)) {
|
|
6517
|
+
if (!existsSync2(projectDir)) {
|
|
6518
|
+
mkdirSync(projectDir, { recursive: true });
|
|
6519
|
+
}
|
|
6520
|
+
cpSync(localTemplatePath, projectDir, { recursive: true });
|
|
6521
|
+
} else if (templateKey !== "nextjs") {
|
|
6522
|
+
const remoteSource = `github:fhorray/flarecms/${template.dir}`;
|
|
6523
|
+
await downloadTemplate(remoteSource, {
|
|
6524
|
+
dir: projectDir,
|
|
6525
|
+
force: true
|
|
6526
|
+
});
|
|
6502
6527
|
}
|
|
6503
|
-
cpSync(localTemplatePath, projectDir, { recursive: true });
|
|
6504
|
-
} else if (templateKey !== "nextjs") {
|
|
6505
|
-
const remoteSource = `github:fhorray/flarecms/${template.dir}`;
|
|
6506
|
-
await downloadTemplate(remoteSource, {
|
|
6507
|
-
dir: projectDir,
|
|
6508
|
-
force: true
|
|
6509
|
-
});
|
|
6510
6528
|
}
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6529
|
+
if (templateKey !== "plugin-development") {
|
|
6530
|
+
const pkgPath = resolve(projectDir, "package.json");
|
|
6531
|
+
if (existsSync2(pkgPath)) {
|
|
6532
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
6533
|
+
pkg.name = projectName;
|
|
6534
|
+
pkg.version = "0.1.0";
|
|
6535
|
+
pkg.dependencies = pkg.dependencies || {};
|
|
6536
|
+
pkg.dependencies["flarecms"] = "latest";
|
|
6537
|
+
pkg.dependencies["hono"] = "latest";
|
|
6538
|
+
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
|
|
6539
|
+
}
|
|
6520
6540
|
}
|
|
6521
6541
|
const wranglerPath = resolve(projectDir, "wrangler.jsonc");
|
|
6522
6542
|
if (existsSync2(wranglerPath)) {
|
|
@@ -6531,16 +6551,18 @@ async function createProjectCommand() {
|
|
|
6531
6551
|
try {
|
|
6532
6552
|
await execAsync("bun install", { cwd: projectDir });
|
|
6533
6553
|
s3.stop("Dependencies installed!");
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6554
|
+
if (templateKey !== "plugin-development") {
|
|
6555
|
+
s3.start("Generating TypeScript bindings...");
|
|
6556
|
+
try {
|
|
6557
|
+
await execAsync("bun wrangler types", { cwd: projectDir });
|
|
6558
|
+
s3.stop("TypeScript bindings generated!");
|
|
6559
|
+
} catch (err) {
|
|
6560
|
+
s3.stop("Failed to generate bindings (this is normal if wrangler.jsonc is incomplete)");
|
|
6561
|
+
}
|
|
6540
6562
|
}
|
|
6541
6563
|
} catch (err) {
|
|
6542
6564
|
s3.stop("Failed to install dependencies");
|
|
6543
|
-
O2.warn(`Run ${import_picocolors.default.cyan(`cd ${projectName} && bun install
|
|
6565
|
+
O2.warn(`Run ${import_picocolors.default.cyan(`cd ${projectName} && bun install`)} manually`);
|
|
6544
6566
|
}
|
|
6545
6567
|
}
|
|
6546
6568
|
const steps = [`cd ${projectName}`, "bun run dev"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface FlareAdminProps {
|
|
2
|
+
/**
|
|
3
|
+
* The base path where the admin UI is mounted.
|
|
4
|
+
* @default "/admin"
|
|
5
|
+
*/
|
|
6
|
+
basePath?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The base URL for FlareCMS API calls.
|
|
9
|
+
* @default "/api"
|
|
10
|
+
*/
|
|
11
|
+
apiBaseUrl?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* FlareAdminRouter is the main entry point for the FlareCMS Admin UI.
|
|
15
|
+
* It manages the routing and state for the entire administrative dashboard.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <FlareAdminRouter basePath="/admin" apiBaseUrl="/api/flarecms" />
|
|
19
|
+
*/
|
|
20
|
+
export declare function FlareAdminRouter({ basePath, apiBaseUrl }: FlareAdminProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function App(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CardBlock } from '../../lib/block-types';
|
|
2
|
+
interface BlockCardProps {
|
|
3
|
+
block: CardBlock;
|
|
4
|
+
onAction: (interaction: any) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function BlockCard({ block, onAction }: BlockCardProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FormBlock, BlockInteraction } from '../../lib/block-types';
|
|
2
|
+
interface BlockFormProps {
|
|
3
|
+
block: FormBlock;
|
|
4
|
+
onAction: (interaction: BlockInteraction) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function BlockForm({ block, onAction }: BlockFormProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Block, BlockInteraction } from '../../lib/block-types';
|
|
2
|
+
interface BlockRendererProps {
|
|
3
|
+
blocks: Block[];
|
|
4
|
+
onAction: (interaction: BlockInteraction) => void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Renders a list of blocks.
|
|
8
|
+
*/
|
|
9
|
+
export declare function BlockRenderer({ blocks, onAction }: BlockRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BlockInteraction, TableBlock } from '../../lib/block-types';
|
|
2
|
+
interface BlockTableProps {
|
|
3
|
+
block: TableBlock;
|
|
4
|
+
onAction: (interaction: BlockInteraction) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function BlockTable({ block, onAction }: BlockTableProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface DynamicFormProps {
|
|
2
|
+
slug: string;
|
|
3
|
+
onSubmit: (data: Record<string, any>) => void;
|
|
4
|
+
onCancel: () => void;
|
|
5
|
+
initialData?: Record<string, any> | null;
|
|
6
|
+
isSubmitting?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function DynamicForm({ slug, onSubmit, onCancel, initialData, isSubmitting, }: DynamicFormProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface FieldModalProps {
|
|
3
|
+
children: React.ReactElement;
|
|
4
|
+
collectionId: string;
|
|
5
|
+
collectionSlug: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function FieldModal({ children, collectionId, collectionSlug, }: FieldModalProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function APITokenSection(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function GeneralSection(): import("react/jsx-runtime").JSX.Element;
|