robodev 0.6.0 → 0.7.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/package.json +1 -1
- package/src/collect-files.test.ts +6 -0
- package/src/collect-files.ts +1 -0
- package/src/index.ts +1 -1
- package/templates/auth-chat/package.json +2 -2
- package/templates/space/api/motto.ts +9 -0
- package/templates/space/api/planets/[id].ts +21 -0
- package/templates/space/package.json +2 -2
package/package.json
CHANGED
|
@@ -15,6 +15,10 @@ test("collectFiles includes hosted sources and skips denied paths", async () =>
|
|
|
15
15
|
await writeFile(join(root, "src/main.tsx"), "export {}");
|
|
16
16
|
await mkdir(join(root, "api"), { recursive: true });
|
|
17
17
|
await writeFile(join(root, "api/x.ts"), "export {}");
|
|
18
|
+
await mkdir(join(root, "api/invoices"), { recursive: true });
|
|
19
|
+
await writeFile(join(root, "api/invoices/[id].ts"), "export {}");
|
|
20
|
+
await mkdir(join(root, "jobs"), { recursive: true });
|
|
21
|
+
await writeFile(join(root, "jobs/x.ts"), "export {}");
|
|
18
22
|
await writeFile(join(root, "package.json"), "{}");
|
|
19
23
|
await mkdir(join(root, "node_modules"), { recursive: true });
|
|
20
24
|
await writeFile(join(root, "node_modules/x.js"), "nope");
|
|
@@ -30,6 +34,8 @@ test("collectFiles includes hosted sources and skips denied paths", async () =>
|
|
|
30
34
|
assert.ok(paths.has("src/main.tsx"));
|
|
31
35
|
assert.ok(paths.has("database.ts"));
|
|
32
36
|
assert.ok(paths.has("api/x.ts"));
|
|
37
|
+
assert.ok(paths.has("api/invoices/[id].ts"));
|
|
38
|
+
assert.ok(paths.has("jobs/x.ts"));
|
|
33
39
|
assert.ok(paths.has("package.json"));
|
|
34
40
|
assert.ok(!paths.has("node_modules/x.js"));
|
|
35
41
|
assert.ok(!paths.has("dist/x.js"));
|
package/src/collect-files.ts
CHANGED
|
@@ -96,6 +96,7 @@ function isDenied(path: string): boolean {
|
|
|
96
96
|
function isAllowed(path: string): boolean {
|
|
97
97
|
if (path === "database.ts") return true;
|
|
98
98
|
if (path.startsWith("api/")) return path.endsWith(".ts");
|
|
99
|
+
if (path.startsWith("jobs/")) return path.endsWith(".ts");
|
|
99
100
|
if (path === "index.html") return true;
|
|
100
101
|
if (path.startsWith("src/")) return SRC_EXTENSIONS.has(extname(path));
|
|
101
102
|
if (path.startsWith("public/")) return PUBLIC_EXTENSIONS.has(extname(path));
|
package/src/index.ts
CHANGED
|
@@ -40,7 +40,7 @@ Commands:
|
|
|
40
40
|
projects List your projects
|
|
41
41
|
create [path] [--starter <id>] Create a project, scaffold a starter, and deploy
|
|
42
42
|
link [projectId] Write .robodev in the current folder
|
|
43
|
-
deploy [--force] Deploy
|
|
43
|
+
deploy [--force] Deploy schema, APIs, jobs, and frontend (includes jobs/**/*.ts and api/**/[id].ts)
|
|
44
44
|
`);
|
|
45
45
|
process.exit(1);
|
|
46
46
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"react": "^18.3.1",
|
|
13
13
|
"react-dom": "^18.3.1",
|
|
14
|
-
"@robodev-ai/sdk": "^0.
|
|
14
|
+
"@robodev-ai/sdk": "^0.6.0",
|
|
15
15
|
"@robodev-ai/client": "^0.2.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
"@vitejs/plugin-react": "^4.7.0",
|
|
21
21
|
"typescript": "^5.9.2",
|
|
22
22
|
"vite": "^6.3.5",
|
|
23
|
-
"robodev": "^0.
|
|
23
|
+
"robodev": "^0.7.0"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** GET /planets/:id — one planet by path param. */
|
|
2
|
+
import { defineApi, eq, z } from "@robodev-ai/sdk";
|
|
3
|
+
import { planets } from "../../database";
|
|
4
|
+
|
|
5
|
+
const Planet = z.object({
|
|
6
|
+
id: z.string(),
|
|
7
|
+
name: z.string(),
|
|
8
|
+
climate: z.string(),
|
|
9
|
+
moons: z.coerce.number(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const get = defineApi({
|
|
13
|
+
response: Planet,
|
|
14
|
+
handler: async ({ db, params }) => {
|
|
15
|
+
const [row] = await db.select().from(planets).where(eq(planets.id, params.id)).limit(1);
|
|
16
|
+
if (!row) {
|
|
17
|
+
return { status: 404, body: { error: "not_found" } };
|
|
18
|
+
}
|
|
19
|
+
return Planet.parse(row);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"react": "^18.3.1",
|
|
13
13
|
"react-dom": "^18.3.1",
|
|
14
|
-
"@robodev-ai/sdk": "^0.
|
|
14
|
+
"@robodev-ai/sdk": "^0.6.0",
|
|
15
15
|
"@robodev-ai/client": "^0.2.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
"@vitejs/plugin-react": "^4.7.0",
|
|
21
21
|
"typescript": "^5.9.2",
|
|
22
22
|
"vite": "^6.3.5",
|
|
23
|
-
"robodev": "^0.
|
|
23
|
+
"robodev": "^0.7.0"
|
|
24
24
|
}
|
|
25
25
|
}
|