@rebasepro/cli 0.0.1-canary.1 → 0.0.1-canary.4d4fb3e

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.
@@ -10,10 +10,8 @@ import {
10
10
  } from "@rebasepro/auth";
11
11
  import {
12
12
  AppBar,
13
- CircularProgressCenter,
14
13
  Drawer,
15
14
  Rebase,
16
- RebaseRoute,
17
15
  ModeControllerProvider,
18
16
  NotFoundPage,
19
17
  Scaffold,
@@ -21,16 +19,17 @@ import {
21
19
  RebaseRoutes,
22
20
  SnackbarProvider,
23
21
  ContentHomePage,
24
- useBackendStorageSource,
25
- useBuildCMSUrlController,
22
+ useBuildUrlController,
26
23
  useBuildCollectionRegistryController,
27
24
  useBuildLocalConfigurationPersistence,
28
25
  useBuildModeController,
29
26
  useBuildNavigationStateController
30
27
  } from "@rebasepro/core";
31
- import { usePostgresClientDataSource } from "@rebasepro/postgresql";
28
+ import { RebaseRoute } from "@rebasepro/cms";
29
+ import { CircularProgressCenter } from "@rebasepro/ui";
32
30
  import { collections } from "virtual:rebase-collections";
33
31
  import { Route, Outlet } from "react-router-dom";
32
+ import { createRebaseClient } from "@rebasepro/client";
34
33
 
35
34
  // Configuration from environment
36
35
  const API_URL = import.meta.env.VITE_API_URL || "http://localhost:3001";
@@ -40,33 +39,27 @@ export function App() {
40
39
  const modeController = useBuildModeController();
41
40
  const userConfigPersistence = useBuildLocalConfigurationPersistence();
42
41
 
42
+ const rebaseClient = React.useMemo(() => createRebaseClient({
43
+ baseUrl: API_URL,
44
+ websocketUrl: API_URL.replace(/^http/, "ws")
45
+ }), [API_URL]);
46
+
43
47
  const authController = useRebaseAuthController({
44
- apiUrl: API_URL,
48
+ client: rebaseClient,
45
49
  googleClientId: GOOGLE_CLIENT_ID
46
50
  });
47
51
 
48
- const storageSource = useBackendStorageSource({
49
- apiUrl: API_URL,
50
- getAuthToken: authController.getAuthToken
51
- });
52
-
53
52
  const userManagement = useBackendUserManagement({
54
- apiUrl: API_URL,
55
- getAuthToken: authController.getAuthToken,
53
+ client: rebaseClient,
56
54
  currentUser: authController.user
57
55
  });
58
56
 
59
- const postgresDelegate = usePostgresClientDataSource({
60
- websocketUrl: API_URL.replace(/^http/, "ws"),
61
- getAuthToken: authController.initialLoading ? undefined : authController.getAuthToken
62
- });
63
-
64
57
  const collectionsBuilder = useCallback(() => {
65
58
  return [...collections];
66
59
  }, []);
67
60
 
68
61
  const collectionRegistryController = useBuildCollectionRegistryController({ userConfigPersistence });
69
- const cmsUrlController = useBuildCMSUrlController({
62
+ const urlController = useBuildUrlController({
70
63
  basePath: "/",
71
64
  baseCollectionPath: "/c",
72
65
  collectionRegistryController
@@ -75,9 +68,9 @@ export function App() {
75
68
  const navigationStateController = useBuildNavigationStateController({
76
69
  collections: collectionsBuilder,
77
70
  authController,
78
- dataSource: postgresDelegate,
71
+ data: rebaseClient.data,
79
72
  collectionRegistryController,
80
- cmsUrlController,
73
+ urlController,
81
74
  userManagement
82
75
  });
83
76
 
@@ -85,13 +78,14 @@ export function App() {
85
78
  <SnackbarProvider>
86
79
  <ModeControllerProvider value={modeController}>
87
80
  <Rebase
81
+ client={rebaseClient}
82
+ apiUrl={API_URL}
88
83
  collectionRegistryController={collectionRegistryController}
89
- cmsUrlController={cmsUrlController}
84
+ urlController={urlController}
90
85
  navigationStateController={navigationStateController}
91
86
  authController={authController}
92
87
  userConfigPersistence={userConfigPersistence}
93
- dataSource={postgresDelegate}
94
- storageSource={storageSource}
88
+ storageSource={rebaseClient.storage}
95
89
  >
96
90
  {({ loading }) => {
97
91
  if (loading || authController.initialLoading) {
@@ -1,2 +1,16 @@
1
1
  @import "tailwindcss";
2
- @import "@rebasepro/ui/index.css";
2
+ @import "@rebasepro/ui/index.css" layer(base);
3
+
4
+ @source "../node_modules/@rebasepro";
5
+
6
+ @custom-variant dark (&:where(.dark, .dark *));
7
+
8
+ @layer utilities {
9
+ body {
10
+ @apply w-full min-h-screen bg-surface-50 dark:bg-surface-900 flex flex-col items-center justify-center;
11
+ }
12
+
13
+ a {
14
+ @apply text-primary dark:text-primary;
15
+ }
16
+ }
@@ -4,25 +4,20 @@
4
4
  "description": "Rebase application with PostgreSQL backend",
5
5
  "private": true,
6
6
  "type": "module",
7
- "workspaces": [
8
- "frontend",
9
- "backend",
10
- "shared"
11
- ],
12
7
  "scripts": {
13
- "dev": "concurrently \"pnpm run dev:backend\" \"pnpm run dev:frontend\"",
14
- "dev:frontend": "cd frontend && pnpm run dev",
15
- "dev:backend": "cd backend && pnpm run dev",
16
- "build": "pnpm run build:shared && pnpm run build:frontend && pnpm run build:backend",
17
- "build:shared": "cd shared && pnpm run build",
18
- "build:frontend": "cd frontend && pnpm run build",
19
- "build:backend": "cd backend && pnpm run build",
20
- "start": "cd backend && pnpm start",
21
- "db:generate": "cd backend && pnpm run db:generate",
22
- "db:migrate": "cd backend && pnpm run db:migrate",
23
- "db:studio": "cd backend && pnpm run db:studio"
8
+ "dev": "rebase dev",
9
+ "build": "pnpm -r run build",
10
+ "start": "pnpm --filter \"*-backend\" start",
11
+ "db:generate": "rebase db generate",
12
+ "db:migrate": "rebase db migrate",
13
+ "db:pull": "rebase db pull",
14
+ "db:push": "rebase db push",
15
+ "db:studio": "rebase db studio",
16
+ "schema:generate": "rebase schema generate",
17
+ "generate:sdk": "rebase generate-sdk"
24
18
  },
25
19
  "devDependencies": {
20
+ "@rebasepro/cli": "workspace:*",
26
21
  "concurrently": "^8.2.2",
27
22
  "typescript": "^5.9.2"
28
23
  },
@@ -0,0 +1,4 @@
1
+ packages:
2
+ - "frontend"
3
+ - "backend"
4
+ - "shared"
@@ -4,7 +4,7 @@ const postsCollection: EntityCollection = {
4
4
  name: "Posts",
5
5
  singularName: "Post",
6
6
  slug: "posts",
7
- dbPath: "posts",
7
+ table: "posts",
8
8
  icon: "Article",
9
9
  properties: {
10
10
  id: {
@@ -1,28 +1,28 @@
1
1
  {
2
- "name": "{{PROJECT_NAME}}-shared",
3
- "version": "1.0.0",
4
- "description": "Shared collections for frontend and backend",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "type": "module",
8
- "private": true,
9
- "scripts": {
10
- "build": "tsc",
11
- "dev": "tsc --watch",
12
- "clean": "rm -rf dist"
13
- },
14
- "dependencies": {
15
- "@rebasepro/types": "^4.0.0"
16
- },
17
- "devDependencies": {
18
- "typescript": "^5.9.2"
19
- },
20
- "exports": {
21
- ".": {
22
- "import": "./dist/index.js",
23
- "types": "./dist/index.d.ts",
24
- "default": "./dist/index.js"
2
+ "name": "{{PROJECT_NAME}}-shared",
3
+ "version": "1.0.0",
4
+ "description": "Shared collections for frontend and backend",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "type": "module",
8
+ "private": true,
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "dev": "tsc --watch",
12
+ "clean": "rm -rf dist"
25
13
  },
26
- "./package.json": "./package.json"
27
- }
14
+ "dependencies": {
15
+ "@rebasepro/types": "workspace:*"
16
+ },
17
+ "devDependencies": {
18
+ "typescript": "^5.9.2"
19
+ },
20
+ "exports": {
21
+ ".": {
22
+ "import": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "default": "./dist/index.js"
25
+ },
26
+ "./package.json": "./package.json"
27
+ }
28
28
  }
@@ -1,60 +0,0 @@
1
- #!/usr/bin/env node
2
- import { spawn } from "child_process";
3
-
4
- // --- Helper Functions ---
5
- const formatTerminalText = (text: string, options: {
6
- bold?: boolean;
7
- backgroundColor?: "blue" | "green" | "red" | "yellow" | "cyan" | "magenta";
8
- textColor?: "white" | "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan";
9
- } = {}): string => {
10
- let codes = "";
11
- if (options.bold) codes += "\x1b[1m";
12
- if (options.backgroundColor) {
13
- const bgColors = {
14
- blue: "\x1b[44m",
15
- green: "\x1b[42m",
16
- red: "\x1b[41m",
17
- yellow: "\x1b[43m",
18
- cyan: "\x1b[46m",
19
- magenta: "\x1b[45m"
20
- } as const;
21
- codes += bgColors[options.backgroundColor];
22
- }
23
- if (options.textColor) {
24
- const textColors = {
25
- white: "\x1b[37m",
26
- black: "\x1b[30m",
27
- red: "\x1b[31m",
28
- green: "\x1b[32m",
29
- yellow: "\x1b[33m",
30
- blue: "\x1b[34m",
31
- magenta: "\x1b[35m",
32
- cyan: "\x1b[36m"
33
- } as const;
34
- codes += textColors[options.textColor];
35
- }
36
- return `${codes}${text}\x1b[0m`;
37
- };
38
-
39
- // Run drizzle-kit generate with the correct env path
40
- const child = spawn("npx", ["drizzle-kit", "generate"], {
41
- stdio: "inherit",
42
- env: {
43
- ...process.env,
44
- DOTENV_CONFIG_PATH: "../.env"
45
- },
46
- shell: true
47
- });
48
-
49
- child.on("close", (code) => {
50
- if (code === 0) {
51
- console.log("");
52
- console.log(`You can now run ${formatTerminalText("pnpm db:migrate", {
53
- bold: true,
54
- backgroundColor: "green",
55
- textColor: "black"
56
- })} to apply the migrations to your database.`);
57
- console.log("");
58
- }
59
- process.exit(code ?? 0);
60
- });