@rebasepro/cli 0.4.0 → 0.5.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/README.md +20 -28
- package/dist/commands/init.d.ts +3 -0
- package/dist/index.cjs +56 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +56 -0
- package/dist/index.es.js.map +1 -1
- package/package.json +5 -5
- package/templates/template/backend/drizzle.config.ts +8 -5
- package/templates/template/config/collections/posts.ts +1 -1
- package/templates/template/config/collections/presets/blank/index.ts +3 -0
- package/templates/template/config/collections/presets/ecommerce/categories.ts +38 -0
- package/templates/template/config/collections/presets/ecommerce/index.ts +6 -0
- package/templates/template/config/collections/presets/ecommerce/orders.ts +54 -0
- package/templates/template/config/collections/presets/ecommerce/products.ts +56 -0
- package/templates/template/docker-compose.yml +1 -1
- package/templates/template/package.json +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Developer tools for Rebase projects",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"execa": "^9.6.1",
|
|
32
32
|
"inquirer": "12.11.1",
|
|
33
33
|
"jiti": "^2.7.0",
|
|
34
|
-
"@rebasepro/sdk-generator": "0.
|
|
35
|
-
"@rebasepro/types": "0.
|
|
36
|
-
"@rebasepro/server-
|
|
37
|
-
"@rebasepro/server-
|
|
34
|
+
"@rebasepro/sdk-generator": "0.5.0",
|
|
35
|
+
"@rebasepro/types": "0.5.0",
|
|
36
|
+
"@rebasepro/server-postgresql": "0.5.0",
|
|
37
|
+
"@rebasepro/server-core": "0.5.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "^20.19.41",
|
|
@@ -16,15 +16,18 @@ if (!process.env.DATABASE_URL) {
|
|
|
16
16
|
throw new Error("DATABASE_URL is not set. Make sure .env file exists in the project root and contains DATABASE_URL");
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
// Extract table names from the generated schema.
|
|
20
|
-
// This ensures drizzle-kit ONLY manages tables defined in the schema
|
|
21
|
-
//
|
|
22
|
-
const tableNames = Object.values(tables)
|
|
19
|
+
// Extract table names from the generated schema, excluding system tables in the 'rebase' schema.
|
|
20
|
+
// This ensures drizzle-kit ONLY manages tables defined in the schema, and ignores the system tables
|
|
21
|
+
// managed by Rebase's own bootstrapper.
|
|
22
|
+
const tableNames = Object.values(tables)
|
|
23
|
+
.filter(table => getTableConfig(table as PgTable).schema !== "rebase")
|
|
24
|
+
.map(table => getTableName(table as PgTable));
|
|
23
25
|
|
|
24
|
-
// Dynamically extract all schemas defined in the generated tables to ensure Drizzle Kit manages them.
|
|
26
|
+
// Dynamically extract all schemas defined in the generated tables (excluding 'rebase') to ensure Drizzle Kit manages them.
|
|
25
27
|
const schemas = Array.from(new Set(
|
|
26
28
|
Object.values(tables)
|
|
27
29
|
.map(table => getTableConfig(table as PgTable).schema || "public")
|
|
30
|
+
.filter(schema => schema !== "rebase")
|
|
28
31
|
));
|
|
29
32
|
|
|
30
33
|
export default defineConfig({
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { EntityCollection } from "@rebasepro/types";
|
|
2
|
+
|
|
3
|
+
const categoriesCollection: EntityCollection = {
|
|
4
|
+
name: "Categories",
|
|
5
|
+
singularName: "Category",
|
|
6
|
+
slug: "categories",
|
|
7
|
+
table: "categories",
|
|
8
|
+
icon: "Category",
|
|
9
|
+
properties: {
|
|
10
|
+
id: {
|
|
11
|
+
name: "ID",
|
|
12
|
+
type: "number",
|
|
13
|
+
isId: "increment"
|
|
14
|
+
},
|
|
15
|
+
name: {
|
|
16
|
+
name: "Name",
|
|
17
|
+
type: "string",
|
|
18
|
+
validation: { required: true }
|
|
19
|
+
},
|
|
20
|
+
slug: {
|
|
21
|
+
name: "Slug",
|
|
22
|
+
type: "string",
|
|
23
|
+
validation: { required: true }
|
|
24
|
+
},
|
|
25
|
+
description: {
|
|
26
|
+
name: "Description",
|
|
27
|
+
type: "string",
|
|
28
|
+
multiline: true
|
|
29
|
+
},
|
|
30
|
+
icon: {
|
|
31
|
+
name: "Icon",
|
|
32
|
+
type: "string"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
propertiesOrder: ["id", "name", "slug", "description", "icon"]
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default categoriesCollection;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import productsCollection from "./products.js";
|
|
2
|
+
import categoriesCollection from "./categories.js";
|
|
3
|
+
import ordersCollection from "./orders.js";
|
|
4
|
+
import usersCollection from "../../users.js";
|
|
5
|
+
|
|
6
|
+
export const collections = [productsCollection, categoriesCollection, ordersCollection, usersCollection];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { EntityCollection } from "@rebasepro/types";
|
|
2
|
+
|
|
3
|
+
const ordersCollection: EntityCollection = {
|
|
4
|
+
name: "Orders",
|
|
5
|
+
singularName: "Order",
|
|
6
|
+
slug: "orders",
|
|
7
|
+
table: "orders",
|
|
8
|
+
icon: "Receipt",
|
|
9
|
+
properties: {
|
|
10
|
+
id: {
|
|
11
|
+
name: "ID",
|
|
12
|
+
type: "number",
|
|
13
|
+
isId: "increment"
|
|
14
|
+
},
|
|
15
|
+
customerEmail: {
|
|
16
|
+
name: "Customer Email",
|
|
17
|
+
type: "string",
|
|
18
|
+
columnName: "customer_email",
|
|
19
|
+
validation: { required: true }
|
|
20
|
+
},
|
|
21
|
+
status: {
|
|
22
|
+
name: "Status",
|
|
23
|
+
type: "string",
|
|
24
|
+
enum: [
|
|
25
|
+
{ id: "pending", label: "Pending", color: "gray" },
|
|
26
|
+
{ id: "processing", label: "Processing", color: "blue" },
|
|
27
|
+
{ id: "shipped", label: "Shipped", color: "orange" },
|
|
28
|
+
{ id: "delivered", label: "Delivered", color: "green" },
|
|
29
|
+
{ id: "cancelled", label: "Cancelled", color: "red" }
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
total: {
|
|
33
|
+
name: "Total",
|
|
34
|
+
type: "number",
|
|
35
|
+
validation: { required: true }
|
|
36
|
+
},
|
|
37
|
+
notes: {
|
|
38
|
+
name: "Notes",
|
|
39
|
+
type: "string",
|
|
40
|
+
multiline: true
|
|
41
|
+
},
|
|
42
|
+
createdAt: {
|
|
43
|
+
name: "Created At",
|
|
44
|
+
type: "date",
|
|
45
|
+
columnName: "created_at",
|
|
46
|
+
autoValue: "on_create",
|
|
47
|
+
ui: {
|
|
48
|
+
readOnly: true
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default ordersCollection;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { EntityCollection } from "@rebasepro/types";
|
|
2
|
+
import categoriesCollection from "./categories.js";
|
|
3
|
+
|
|
4
|
+
const productsCollection: EntityCollection = {
|
|
5
|
+
name: "Products",
|
|
6
|
+
singularName: "Product",
|
|
7
|
+
slug: "products",
|
|
8
|
+
table: "products",
|
|
9
|
+
icon: "ShoppingCart",
|
|
10
|
+
properties: {
|
|
11
|
+
id: {
|
|
12
|
+
name: "ID",
|
|
13
|
+
type: "number",
|
|
14
|
+
isId: "increment"
|
|
15
|
+
},
|
|
16
|
+
name: {
|
|
17
|
+
name: "Name",
|
|
18
|
+
type: "string",
|
|
19
|
+
validation: { required: true }
|
|
20
|
+
},
|
|
21
|
+
description: {
|
|
22
|
+
name: "Description",
|
|
23
|
+
type: "string",
|
|
24
|
+
markdown: true
|
|
25
|
+
},
|
|
26
|
+
price: {
|
|
27
|
+
name: "Price",
|
|
28
|
+
type: "number",
|
|
29
|
+
validation: { required: true }
|
|
30
|
+
},
|
|
31
|
+
image: {
|
|
32
|
+
name: "Image",
|
|
33
|
+
type: "string",
|
|
34
|
+
storage: { storagePath: "product_images/" }
|
|
35
|
+
},
|
|
36
|
+
status: {
|
|
37
|
+
name: "Status",
|
|
38
|
+
type: "string",
|
|
39
|
+
enum: [
|
|
40
|
+
{ id: "draft", label: "Draft", color: "gray" },
|
|
41
|
+
{ id: "active", label: "Active", color: "green" },
|
|
42
|
+
{ id: "archived", label: "Archived", color: "orange" }
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
category: {
|
|
46
|
+
name: "Category",
|
|
47
|
+
type: "relation",
|
|
48
|
+
relationName: "category",
|
|
49
|
+
target: () => categoriesCollection,
|
|
50
|
+
cardinality: "one",
|
|
51
|
+
direction: "owning"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default productsCollection;
|