@rebasepro/cli 0.7.0 → 0.8.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/dist/index.es.js +65 -1
- package/dist/index.es.js.map +1 -1
- package/dist/utils/project.d.ts +15 -0
- package/package.json +13 -19
- package/templates/template/backend/Dockerfile +4 -3
- package/templates/template/backend/functions/hello.ts +32 -32
- package/templates/template/backend/package.json +1 -0
- package/templates/template/backend/src/index.ts +0 -1
- package/templates/template/config/collections/posts.ts +3 -1
- package/templates/template/config/collections/presets/ecommerce/categories.ts +3 -1
- package/templates/template/config/collections/presets/ecommerce/orders.ts +3 -1
- package/templates/template/config/collections/presets/ecommerce/products.ts +3 -1
- package/templates/template/config/collections/users.ts +3 -1
- package/templates/template/frontend/Dockerfile +5 -3
- package/templates/template/package.json +3 -1
- package/templates/template/pnpm-workspace.yaml +2 -0
- package/templates/template/scripts/example.ts +1 -1
package/dist/utils/project.d.ts
CHANGED
|
@@ -35,6 +35,21 @@ export declare function resolveLocalBin(projectRoot: string, binName: string): s
|
|
|
35
35
|
* Resolve the tsx binary. Checks backend node_modules first, then root.
|
|
36
36
|
*/
|
|
37
37
|
export declare function resolveTsx(projectRoot: string): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Validate that a resolved tsx binary actually has an intact installation.
|
|
40
|
+
*
|
|
41
|
+
* `resolveLocalBin` only checks whether `node_modules/.bin/tsx` (a symlink)
|
|
42
|
+
* exists. If the pnpm content-addressable store was cleaned or a previous
|
|
43
|
+
* install was interrupted, the symlink can exist while critical files inside
|
|
44
|
+
* the tsx package (e.g. `dist/preflight.cjs`) are missing — causing a
|
|
45
|
+
* confusing MODULE_NOT_FOUND error at runtime.
|
|
46
|
+
*
|
|
47
|
+
* This function follows the symlink, walks up to find the tsx package root
|
|
48
|
+
* (`package.json` with `name: "tsx"`), and verifies that `dist/preflight.cjs`
|
|
49
|
+
* is present. Returns `null` when the installation looks healthy, or an
|
|
50
|
+
* error description string when it appears corrupted.
|
|
51
|
+
*/
|
|
52
|
+
export declare function validateTsxInstallation(tsxBinPath: string): string | null;
|
|
38
53
|
/**
|
|
39
54
|
* Require the project root or exit with a helpful error.
|
|
40
55
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Developer tools for Rebase projects",
|
|
5
5
|
"main": "./dist/index.es.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
@@ -13,12 +13,6 @@
|
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
|
-
"scripts": {
|
|
17
|
-
"test": "vitest run",
|
|
18
|
-
"test:e2e": "vitest run --config vitest.e2e.config.ts",
|
|
19
|
-
"build": "vite build && tsc --emitDeclarationOnly -p tsconfig.json",
|
|
20
|
-
"clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f"
|
|
21
|
-
},
|
|
22
16
|
"keywords": [
|
|
23
17
|
"cli",
|
|
24
18
|
"create-rebase-app",
|
|
@@ -31,17 +25,17 @@
|
|
|
31
25
|
"author": "rebase.pro",
|
|
32
26
|
"license": "MIT",
|
|
33
27
|
"dependencies": {
|
|
34
|
-
"@rebasepro/agent-skills": "workspace:*",
|
|
35
|
-
"@rebasepro/sdk-generator": "workspace:*",
|
|
36
|
-
"@rebasepro/server-core": "workspace:*",
|
|
37
|
-
"@rebasepro/server-postgresql": "workspace:*",
|
|
38
|
-
"@rebasepro/types": "workspace:*",
|
|
39
28
|
"arg": "^5.0.2",
|
|
40
29
|
"chalk": "^5.6.2",
|
|
41
30
|
"dotenv": "^17.4.2",
|
|
42
31
|
"execa": "^9.6.1",
|
|
43
32
|
"inquirer": "14.0.2",
|
|
44
|
-
"jiti": "^2.7.0"
|
|
33
|
+
"jiti": "^2.7.0",
|
|
34
|
+
"@rebasepro/agent-skills": "0.8.0",
|
|
35
|
+
"@rebasepro/sdk-generator": "0.8.0",
|
|
36
|
+
"@rebasepro/server-postgresql": "0.8.0",
|
|
37
|
+
"@rebasepro/types": "0.8.0",
|
|
38
|
+
"@rebasepro/server-core": "0.8.0"
|
|
45
39
|
},
|
|
46
40
|
"devDependencies": {
|
|
47
41
|
"@types/node": "^25.9.3",
|
|
@@ -67,10 +61,10 @@
|
|
|
67
61
|
"url": "https://github.com/rebasepro/rebase.git",
|
|
68
62
|
"directory": "packages/cli"
|
|
69
63
|
},
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
"scripts": {
|
|
65
|
+
"test": "vitest run",
|
|
66
|
+
"test:e2e": "vitest run --config vitest.e2e.config.ts",
|
|
67
|
+
"build": "vite build && tsc --emitDeclarationOnly -p tsconfig.json",
|
|
68
|
+
"clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f"
|
|
75
69
|
}
|
|
76
|
-
}
|
|
70
|
+
}
|
|
@@ -14,12 +14,12 @@ ENV PATH="$PNPM_HOME:$PATH"
|
|
|
14
14
|
RUN corepack enable
|
|
15
15
|
|
|
16
16
|
# Native dependencies for bcrypt, pg, etc.
|
|
17
|
-
RUN apk add --no-cache python3 make g++
|
|
17
|
+
RUN apk add --no-cache python3 make g++ curl ca-certificates
|
|
18
18
|
|
|
19
19
|
WORKDIR /app
|
|
20
20
|
|
|
21
21
|
# Copy workspace root files first (cache-friendly layer)
|
|
22
|
-
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
|
22
|
+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
|
|
23
23
|
|
|
24
24
|
# Copy workspace packages
|
|
25
25
|
COPY backend ./backend
|
|
@@ -41,6 +41,7 @@ FROM node:22-alpine AS runtime
|
|
|
41
41
|
ENV PNPM_HOME="/pnpm"
|
|
42
42
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
43
43
|
ENV NODE_ENV=production
|
|
44
|
+
ENV CI=true
|
|
44
45
|
|
|
45
46
|
RUN corepack enable
|
|
46
47
|
|
|
@@ -50,7 +51,7 @@ RUN addgroup -g 1001 rebase && adduser -u 1001 -G rebase -s /bin/sh -D rebase
|
|
|
50
51
|
WORKDIR /app
|
|
51
52
|
|
|
52
53
|
# Copy only production artifacts
|
|
53
|
-
COPY --from=builder /app/package.json /app/pnpm-lock.yaml /app/pnpm-workspace.yaml ./
|
|
54
|
+
COPY --from=builder /app/package.json /app/pnpm-lock.yaml /app/pnpm-workspace.yaml /app/.npmrc ./
|
|
54
55
|
COPY --from=builder /app/node_modules ./node_modules
|
|
55
56
|
COPY --from=builder /app/backend ./backend
|
|
56
57
|
COPY --from=builder /app/config ./config
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { HonoEnv } from "@rebasepro/server-core";
|
|
3
|
-
import { rebase } from "@rebasepro/server-core";
|
|
1
|
+
import { defineFunction } from "@rebasepro/server-core";
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
* Example custom function route.
|
|
@@ -12,41 +10,43 @@ import { rebase } from "@rebasepro/server-core";
|
|
|
12
10
|
* Call from the client SDK:
|
|
13
11
|
* const result = await client.call("functions/hello", { name: "World" });
|
|
14
12
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* Authored with `defineFunction`, which hands you a pre-typed Hono app
|
|
14
|
+
* (so `c.get("user")` / `c.get("driver")` are typed) and the `rebase`
|
|
15
|
+
* singleton via the injected context — use any Hono middleware, define any
|
|
16
|
+
* HTTP methods, access the request/response directly.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* `rebase` gives you admin-level access to all app-scoped services
|
|
19
|
+
* (data, auth, storage, email). For request-scoped / RLS-scoped access,
|
|
20
|
+
* use c.get("user") and c.get("driver").
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
export default defineFunction((app, { rebase }) => {
|
|
23
|
+
void rebase; // available for data/auth/storage/email — see commented usage below
|
|
23
24
|
|
|
24
|
-
app.post("/", async (c) => {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
app.post("/", async (c) => {
|
|
26
|
+
const body = await c.req.json().catch(() => ({}));
|
|
27
|
+
const user = c.get("user");
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const userId = (user && typeof user === "object" && "userId" in user)
|
|
30
|
+
? user.userId
|
|
31
|
+
: "anonymous";
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
// Access any Rebase service via the injected `rebase`:
|
|
34
|
+
// await rebase.email?.send({
|
|
35
|
+
// to: "admin@example.com",
|
|
36
|
+
// subject: "Function called",
|
|
37
|
+
// html: `<p>Hello from ${userId}!</p>`,
|
|
38
|
+
// });
|
|
39
|
+
//
|
|
40
|
+
// const authors = await rebase.data.authors.find({ limit: 5 });
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
return c.json({
|
|
43
|
+
message: `Hello, ${body.name || "World"}!`,
|
|
44
|
+
user: userId
|
|
45
|
+
});
|
|
44
46
|
});
|
|
45
|
-
});
|
|
46
47
|
|
|
47
|
-
app.get("/", (c) => {
|
|
48
|
-
|
|
49
|
-
endpoint: "hello" });
|
|
48
|
+
app.get("/", (c) => {
|
|
49
|
+
return c.json({ status: "ok",
|
|
50
|
+
endpoint: "hello" });
|
|
51
|
+
});
|
|
50
52
|
});
|
|
51
|
-
|
|
52
|
-
export default app;
|
|
@@ -17,14 +17,16 @@ RUN apk add --no-cache python3 make g++
|
|
|
17
17
|
WORKDIR /app
|
|
18
18
|
|
|
19
19
|
# Copy workspace root files
|
|
20
|
-
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
|
20
|
+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
|
|
21
21
|
|
|
22
22
|
# Copy workspace packages
|
|
23
23
|
COPY frontend ./frontend
|
|
24
24
|
COPY config ./config
|
|
25
25
|
|
|
26
|
-
# Install dependencies
|
|
27
|
-
|
|
26
|
+
# Install dependencies (skip scripts to avoid @ariga/atlas binary download,
|
|
27
|
+
# which is a backend-only dependency that may fail on certain platforms)
|
|
28
|
+
RUN pnpm install --frozen-lockfile --ignore-scripts
|
|
29
|
+
RUN pnpm rebuild esbuild
|
|
28
30
|
|
|
29
31
|
# Build config first, then frontend
|
|
30
32
|
RUN pnpm --filter "*-config" run build
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@rebasepro/cli": "workspace:*",
|
|
27
|
+
"@rebasepro/types": "workspace:*",
|
|
27
28
|
"concurrently": "^8.2.2",
|
|
28
29
|
"typescript": "^5.9.2"
|
|
29
30
|
},
|
|
@@ -33,7 +34,8 @@
|
|
|
33
34
|
"pnpm": {
|
|
34
35
|
"onlyBuiltDependencies": [
|
|
35
36
|
"esbuild",
|
|
36
|
-
"sharp"
|
|
37
|
+
"sharp",
|
|
38
|
+
"@ariga/atlas"
|
|
37
39
|
]
|
|
38
40
|
}
|
|
39
41
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Scripts run OUTSIDE the server and need explicit authentication.
|
|
5
5
|
* Use a Service Key (set in .env as REBASE_SERVICE_KEY) to get admin
|
|
6
|
-
* access — similar to a
|
|
6
|
+
* access — similar to a Service Account credential.
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
9
|
* # With local dev server running (`pnpm dev` in another terminal):
|