@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.
- package/dist/commands/auth.d.ts +1 -0
- package/dist/commands/db.d.ts +1 -0
- package/dist/commands/dev.d.ts +1 -0
- package/dist/commands/generate_sdk.d.ts +18 -0
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/schema.d.ts +1 -0
- package/dist/index.cjs +828 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.es.js +830 -20
- package/dist/index.es.js.map +1 -1
- package/dist/utils/project.d.ts +45 -0
- package/package.json +65 -57
- package/templates/template/.dockerignore +28 -0
- package/templates/template/.env.template +21 -11
- package/templates/template/README.md +73 -16
- package/templates/template/backend/Dockerfile +54 -9
- package/templates/template/backend/functions/hello.ts +34 -0
- package/templates/template/backend/package.json +30 -34
- package/templates/template/backend/src/index.ts +48 -86
- package/templates/template/docker-compose.yml +65 -16
- package/templates/template/frontend/Dockerfile +35 -13
- package/templates/template/frontend/nginx.conf +40 -0
- package/templates/template/frontend/package.json +9 -10
- package/templates/template/frontend/src/App.tsx +18 -24
- package/templates/template/frontend/src/index.css +15 -1
- package/templates/template/package.json +11 -16
- package/templates/template/pnpm-workspace.yaml +4 -0
- package/templates/template/shared/collections/posts.ts +1 -1
- package/templates/template/shared/package.json +25 -25
- package/templates/template/backend/scripts/db-generate.ts +0 -60
|
@@ -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
|
-
|
|
25
|
-
useBuildCMSUrlController,
|
|
22
|
+
useBuildUrlController,
|
|
26
23
|
useBuildCollectionRegistryController,
|
|
27
24
|
useBuildLocalConfigurationPersistence,
|
|
28
25
|
useBuildModeController,
|
|
29
26
|
useBuildNavigationStateController
|
|
30
27
|
} from "@rebasepro/core";
|
|
31
|
-
import {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
71
|
+
data: rebaseClient.data,
|
|
79
72
|
collectionRegistryController,
|
|
80
|
-
|
|
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
|
-
|
|
84
|
+
urlController={urlController}
|
|
90
85
|
navigationStateController={navigationStateController}
|
|
91
86
|
authController={authController}
|
|
92
87
|
userConfigPersistence={userConfigPersistence}
|
|
93
|
-
|
|
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": "
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
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
|
},
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
"
|
|
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
|
-
});
|