create-lumibase 0.6.0 → 0.11.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-present LumiBase Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-lumibase",
3
- "version": "0.6.0",
3
+ "version": "0.11.0",
4
4
  "description": "Scaffold a new LumiBase project — Edge-native Headless CMS",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,13 +11,6 @@
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
14
- "scripts": {
15
- "build": "tsup src/index.ts --format esm --dts --clean && node scripts/postbuild.mjs",
16
- "dev": "tsup src/index.ts --format esm --watch",
17
- "test": "vitest --run",
18
- "typecheck": "tsc --noEmit",
19
- "clean": "rm -rf .turbo dist"
20
- },
21
14
  "dependencies": {
22
15
  "handlebars": "^4.7.8",
23
16
  "picocolors": "^1.1.1",
@@ -33,8 +26,7 @@
33
26
  },
34
27
  "files": [
35
28
  "dist",
36
- "bin",
37
- "templates"
29
+ "bin"
38
30
  ],
39
31
  "engines": {
40
32
  "node": ">=20"
@@ -48,7 +40,14 @@
48
40
  ],
49
41
  "repository": {
50
42
  "type": "git",
51
- "url": "https://github.com/lumibase/lumibase.git",
43
+ "url": "git+https://github.com/khuepm/lumibase.git",
52
44
  "directory": "packages/create-lumibase"
45
+ },
46
+ "scripts": {
47
+ "build": "tsup src/index.ts --format esm --dts --clean && node scripts/postbuild.mjs",
48
+ "dev": "tsup src/index.ts --format esm --watch",
49
+ "test": "vitest --run",
50
+ "typecheck": "tsc --noEmit",
51
+ "clean": "rm -rf .turbo dist"
53
52
  }
54
- }
53
+ }
@@ -1,4 +0,0 @@
1
- # Wrangler dev secrets (not committed — use `wrangler secret put` for production)
2
- JWT_SECRET=change-me-in-production
3
- ADMIN_EMAIL=admin@example.com
4
- ADMIN_PASSWORD=change-me
@@ -1,7 +0,0 @@
1
- node_modules
2
- dist
3
- .env
4
- .dev.vars
5
- *.log
6
- .DS_Store
7
- .wrangler
@@ -1,27 +0,0 @@
1
- {
2
- "name": "{{projectName}}",
3
- "version": "0.1.0",
4
- "private": true,
5
- "type": "module",
6
- "scripts": {
7
- "dev": "wrangler dev",
8
- "deploy": "wrangler deploy",
9
- "db:migrate": "wrangler d1 migrations apply lumibase-db",
10
- "db:migrate:remote": "wrangler d1 migrations apply lumibase-db --remote",
11
- "typecheck": "tsc --noEmit"
12
- },
13
- "dependencies": {
14
- "hono": "^4.0.0",
15
- "drizzle-orm": "^0.44.0",
16
- "nanoid": "^5.1.5",
17
- "uuidv7": "^1.0.2",
18
- "zod": "^3.25.51"
19
- },
20
- "devDependencies": {
21
- "@cloudflare/workers-types": "^4.0.0",
22
- "@types/node": "^22.0.0",
23
- "drizzle-kit": "^0.31.0",
24
- "typescript": "^5.6.2",
25
- "wrangler": "^4.0.0"
26
- }
27
- }
@@ -1,16 +0,0 @@
1
- import { Hono } from 'hono';
2
- import { logger } from 'hono/logger';
3
-
4
- export interface Env {
5
- DB: D1Database;
6
- JWT_SECRET: string;
7
- ADMIN_EMAIL: string;
8
- }
9
-
10
- const app = new Hono<{ Bindings: Env }>();
11
-
12
- app.use('*', logger());
13
-
14
- app.get('/', (c) => c.json({ name: '{{projectName}}', status: 'ok' }));
15
-
16
- export default app;
@@ -1,13 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ESNext",
5
- "moduleResolution": "Bundler",
6
- "strict": true,
7
- "esModuleInterop": true,
8
- "skipLibCheck": true,
9
- "resolveJsonModule": true,
10
- "types": ["@cloudflare/workers-types"]
11
- },
12
- "include": ["src", "worker-configuration.d.ts"]
13
- }
@@ -1,13 +0,0 @@
1
- name = "{{projectName}}"
2
- main = "src/index.ts"
3
- compatibility_date = "2025-01-01"
4
- compatibility_flags = ["nodejs_compat"]
5
-
6
- [[d1_databases]]
7
- binding = "DB"
8
- database_name = "lumibase-db"
9
- database_id = "REPLACE_WITH_YOUR_D1_ID"
10
-
11
- [vars]
12
- JWT_SECRET = "change-me-in-production"
13
- ADMIN_EMAIL = "admin@example.com"
@@ -1,14 +0,0 @@
1
- # Database
2
- DATABASE_URL=postgresql://lumibase:lumibase@localhost:5432/lumibase
3
-
4
- # Redis (optional — for queue/cache)
5
- REDIS_URL=redis://localhost:6379
6
-
7
- # Auth
8
- JWT_SECRET=change-me-in-production
9
- ADMIN_EMAIL=admin@example.com
10
- ADMIN_PASSWORD=change-me
11
-
12
- # App
13
- PORT=8787
14
- NODE_ENV=development
@@ -1,5 +0,0 @@
1
- node_modules
2
- dist
3
- .env
4
- *.log
5
- .DS_Store
@@ -1,21 +0,0 @@
1
- services:
2
- postgres:
3
- image: postgres:16-alpine
4
- restart: unless-stopped
5
- environment:
6
- POSTGRES_USER: lumibase
7
- POSTGRES_PASSWORD: lumibase
8
- POSTGRES_DB: lumibase
9
- ports:
10
- - "5432:5432"
11
- volumes:
12
- - postgres_data:/var/lib/postgresql/data
13
-
14
- redis:
15
- image: redis:7-alpine
16
- restart: unless-stopped
17
- ports:
18
- - "6379:6379"
19
-
20
- volumes:
21
- postgres_data:
@@ -1,18 +0,0 @@
1
- import { defineConfig } from 'drizzle-kit';
2
-
3
- const databaseUrl = process.env['DATABASE_URL'];
4
-
5
- if (!databaseUrl) {
6
- throw new Error('DATABASE_URL is required to run drizzle-kit commands.');
7
- }
8
-
9
- export default defineConfig({
10
- schema: './src/db/schema.ts',
11
- out: './drizzle',
12
- dialect: 'postgresql',
13
- dbCredentials: {
14
- url: databaseUrl,
15
- },
16
- strict: true,
17
- verbose: true,
18
- });
@@ -1,30 +0,0 @@
1
- {
2
- "name": "{{projectName}}",
3
- "version": "0.1.0",
4
- "private": true,
5
- "type": "module",
6
- "scripts": {
7
- "dev": "tsx watch --env-file=.env src/server.ts",
8
- "build": "tsc",
9
- "start": "node --env-file=.env dist/server.js",
10
- "db:generate": "drizzle-kit generate",
11
- "db:migrate": "tsx --env-file=.env src/db/migrate.ts",
12
- "db:studio": "drizzle-kit studio",
13
- "typecheck": "tsc --noEmit"
14
- },
15
- "dependencies": {
16
- "@hono/node-server": "^1.12.0",
17
- "hono": "^4.0.0",
18
- "drizzle-orm": "^0.44.0",
19
- "postgres": "^3.4.7",
20
- "nanoid": "^5.1.5",
21
- "uuidv7": "^1.0.2",
22
- "zod": "^3.25.51"
23
- },
24
- "devDependencies": {
25
- "@types/node": "^22.0.0",
26
- "drizzle-kit": "^0.31.0",
27
- "tsx": "^4.19.4",
28
- "typescript": "^5.6.2"
29
- }
30
- }
@@ -1,14 +0,0 @@
1
- import { drizzle } from 'drizzle-orm/postgres-js';
2
- import postgres from 'postgres';
3
- import * as schema from './schema.js';
4
-
5
- const databaseUrl = process.env['DATABASE_URL'];
6
-
7
- if (!databaseUrl) {
8
- throw new Error('DATABASE_URL is required. Copy .env.example to .env first.');
9
- }
10
-
11
- const queryClient = postgres(databaseUrl);
12
-
13
- export const db = drizzle(queryClient, { schema });
14
- export { schema };
@@ -1,24 +0,0 @@
1
- import { drizzle } from 'drizzle-orm/postgres-js';
2
- import { migrate } from 'drizzle-orm/postgres-js/migrator';
3
- import postgres from 'postgres';
4
-
5
- const databaseUrl = process.env['DATABASE_URL'];
6
-
7
- if (!databaseUrl) {
8
- throw new Error('DATABASE_URL is required. Copy .env.example to .env first.');
9
- }
10
-
11
- // `max: 1` — migrations must run on a single connection.
12
- const migrationClient = postgres(databaseUrl, { max: 1 });
13
-
14
- async function main() {
15
- console.log('Running migrations...');
16
- await migrate(drizzle(migrationClient), { migrationsFolder: './drizzle' });
17
- console.log('Migrations complete.');
18
- await migrationClient.end();
19
- }
20
-
21
- main().catch((err) => {
22
- console.error('Migration failed:', err);
23
- process.exit(1);
24
- });
@@ -1,34 +0,0 @@
1
- import { index, pgTable, text, timestamp } from 'drizzle-orm/pg-core';
2
- import { nanoid } from 'nanoid';
3
-
4
- /**
5
- * LumiBase convention helpers.
6
- * - IDs: nanoid() for domain tables (never serial/auto-increment).
7
- * - Multi-tenancy: every domain table carries a `site_id`.
8
- */
9
- const id = () =>
10
- text('id')
11
- .$defaultFn(() => nanoid())
12
- .primaryKey();
13
- const createdAt = () => timestamp('created_at').defaultNow().notNull();
14
- const updatedAt = () => timestamp('updated_at').defaultNow().notNull();
15
-
16
- export const posts = pgTable(
17
- 'posts',
18
- {
19
- id: id(),
20
- siteId: text('site_id').notNull(),
21
- title: text('title').notNull(),
22
- slug: text('slug').notNull(),
23
- body: text('body').notNull().default(''),
24
- status: text('status').notNull().default('draft'),
25
- createdAt: createdAt(),
26
- updatedAt: updatedAt(),
27
- },
28
- (t) => ({
29
- siteSlugIdx: index('posts_site_slug_idx').on(t.siteId, t.slug),
30
- }),
31
- );
32
-
33
- export type Post = typeof posts.$inferSelect;
34
- export type NewPost = typeof posts.$inferInsert;
@@ -1,48 +0,0 @@
1
- import { serve } from '@hono/node-server';
2
- import { Hono } from 'hono';
3
- import { logger } from 'hono/logger';
4
- import { eq } from 'drizzle-orm';
5
- import { z } from 'zod';
6
- import { db } from './db/client.js';
7
- import { posts } from './db/schema.js';
8
-
9
- const app = new Hono();
10
-
11
- app.use('*', logger());
12
-
13
- app.get('/', (c) => c.json({ name: '{{projectName}}', status: 'ok' }));
14
-
15
- // Demo CMS resource — every query is scoped by site_id (multi-tenant rule).
16
- const DEMO_SITE_ID = 'default';
17
-
18
- app.get('/posts', async (c) => {
19
- const data = await db
20
- .select()
21
- .from(posts)
22
- .where(eq(posts.siteId, DEMO_SITE_ID));
23
- return c.json({ data });
24
- });
25
-
26
- const createPost = z.object({
27
- title: z.string().min(1),
28
- slug: z.string().min(1),
29
- body: z.string().optional(),
30
- });
31
-
32
- app.post('/posts', async (c) => {
33
- const parsed = createPost.safeParse(await c.req.json());
34
- if (!parsed.success) {
35
- return c.json({ errors: parsed.error.issues }, 400);
36
- }
37
- const [created] = await db
38
- .insert(posts)
39
- .values({ ...parsed.data, siteId: DEMO_SITE_ID })
40
- .returning();
41
- return c.json({ data: created }, 201);
42
- });
43
-
44
- const port = Number(process.env['PORT'] ?? 8787);
45
-
46
- serve({ fetch: app.fetch, port }, () => {
47
- console.log(`🚀 LumiBase listening on http://localhost:${port}`);
48
- });
@@ -1,14 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ESNext",
5
- "moduleResolution": "Bundler",
6
- "strict": true,
7
- "esModuleInterop": true,
8
- "skipLibCheck": true,
9
- "outDir": "dist",
10
- "rootDir": "src",
11
- "resolveJsonModule": true
12
- },
13
- "include": ["src"]
14
- }