Scaffold Collection
Scaffold a new collection file with Lucent boilerplate.
Usage
lucent collection <name>
Arguments
| Argument | Description |
|---|---|
name | PascalCase collection name such as Posts or BlogPost |
Behavior
The command:
- writes
<Name>.tsintosrc/collectionswhen that directory exists - otherwise falls back to
collections - creates the directory if needed
- does not currently support extra flags such as
--fields,--auth, or--path
Example
lucent collection Posts
Creates:
import { defineCollection } from "@codesordinatestudio/lucent";
export const Posts = defineCollection({
slug: "posts",
fields: [],
access: {
read: () => true,
create: ({ user }) => !!user,
update: ({ user }) => !!user,
delete: ({ user }) => user?.role === "admin",
},
timestamps: true,
});