create-cfast 0.1.0 → 0.2.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/dist/index.js CHANGED
@@ -62,6 +62,7 @@ function resolveFeatureDeps(features) {
62
62
  }
63
63
  if (resolved.auth) {
64
64
  resolved.db = true;
65
+ resolved.ui = true;
65
66
  }
66
67
  return resolved;
67
68
  }
@@ -374,7 +375,7 @@ const dbPlugin = definePlugin<AuthProvides>()({
374
375
  setup(ctx) {
375
376
  const client = createDb({
376
377
  d1: ctx.env.DB as D1Database,
377
- schema: schema as unknown as Record<string, unknown>,
378
+ schema: schema as unknown as Record<string, object>,
378
379
  grants: ctx.auth.grants,
379
380
  user: ctx.auth.user ? { id: ctx.auth.user.id } : null,
380
381
  cache: false,
@@ -389,7 +390,7 @@ const dbPlugin = definePlugin({
389
390
  setup(ctx) {
390
391
  const client = createDb({
391
392
  d1: ctx.env.DB as D1Database,
392
- schema: schema as unknown as Record<string, unknown>,
393
+ schema: schema as unknown as Record<string, object>,
393
394
  grants: [],
394
395
  user: null,
395
396
  cache: false,
@@ -413,7 +414,7 @@ ${appLine}
413
414
  function generateViteConfig(config) {
414
415
  const optimizeDeps = [];
415
416
  if (config.features.ui && config.uiLibrary === "joy") {
416
- optimizeDeps.push(`"@cfast/ui/joy"`);
417
+ optimizeDeps.push(`"@cfast/joy"`);
417
418
  }
418
419
  if (config.features.ui) {
419
420
  optimizeDeps.push(`"@cfast/actions/client"`);
@@ -469,7 +470,7 @@ function generateRootTsx(config) {
469
470
  imports.push(
470
471
  `import { createUIPlugin, UIPluginProvider, ConfirmProvider } from "@cfast/ui";`
471
472
  );
472
- imports.push(`import { ConfirmDialog } from "@cfast/ui/joy";`);
473
+ imports.push(`import { ConfirmDialog } from "@cfast/joy";`);
473
474
  pluginSetup = `
474
475
  const plugin = createUIPlugin({
475
476
  components: { confirmDialog: ConfirmDialog },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cfast",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Scaffold a fully wired Cloudflare Workers + React Router project with cfast",
5
5
  "keywords": [
6
6
  "cfast",
@@ -1,8 +1,10 @@
1
1
  import type { LoaderFunctionArgs, ActionFunctionArgs } from "react-router";
2
- import { useLoaderData } from "react-router";
3
- import { AdminPanel } from "@cfast/admin/client";
4
- import { joyAdminComponents } from "@cfast/ui/joy";
2
+ import { createAdminComponent, introspectSchema } from "@cfast/admin";
5
3
  import { adminLoader, adminAction } from "~/admin.server";
4
+ import * as schema from "~/db/schema";
5
+
6
+ const tableMetas = introspectSchema(schema);
7
+ const AdminComponent = createAdminComponent(tableMetas);
6
8
 
7
9
  export async function loader(args: LoaderFunctionArgs) {
8
10
  return adminLoader(args.request);
@@ -12,7 +14,4 @@ export async function action(args: ActionFunctionArgs) {
12
14
  return adminAction(args.request);
13
15
  }
14
16
 
15
- export default function Admin() {
16
- const data = useLoaderData<typeof loader>();
17
- return <AdminPanel data={data} components={joyAdminComponents} />;
18
- }
17
+ export default AdminComponent;
@@ -53,11 +53,12 @@ export const passkeys = sqliteTable("passkeys", {
53
53
  name: text("name"),
54
54
  userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
55
55
  publicKey: text("public_key").notNull(),
56
- credentialId: text("credential_id").notNull().unique(),
56
+ credentialID: text("credential_id").notNull().unique(),
57
57
  counter: integer("counter").notNull().default(0),
58
- deviceType: text("device_type"),
59
- backedUp: integer("backed_up", { mode: "boolean" }).default(false),
58
+ deviceType: text("device_type").notNull(),
59
+ backedUp: integer("backed_up", { mode: "boolean" }).notNull().default(false),
60
60
  transports: text("transports"),
61
+ aaguid: text("aaguid"),
61
62
  createdAt: integer("created_at", { mode: "timestamp" }).$defaultFn(() => new Date()),
62
63
  });
63
64
 
@@ -1,7 +1,7 @@
1
1
  import type { LoaderFunctionArgs } from "react-router";
2
2
  import { redirect, useLoaderData } from "react-router";
3
3
  import { LoginPage } from "@cfast/auth/client";
4
- import { joyLoginComponents } from "@cfast/ui/joy";
4
+ import { joyLoginComponents } from "@cfast/joy";
5
5
  import { getUser } from "~/auth.helpers.server";
6
6
  import { authClient } from "~/auth.client";
7
7
 
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "dependencies": {
3
3
  "@cfast/actions": "^0.1.0",
4
+ "@cfast/joy": "^0.1.0",
4
5
  "@cfast/ui": "^0.1.0",
5
6
  "@emotion/react": "^11.14.0",
6
7
  "@emotion/styled": "^11.14.0",