@pylonsync/create-pylon 0.3.19 → 0.3.21
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/bin/create-pylon.js +30 -4
- package/package.json +1 -1
package/bin/create-pylon.js
CHANGED
|
@@ -25,7 +25,7 @@ import { stdin, stdout, exit, argv, cwd } from "node:process";
|
|
|
25
25
|
// of the pylon stack).
|
|
26
26
|
// ---------------------------------------------------------------------------
|
|
27
27
|
|
|
28
|
-
const PYLON_VERSION = "0.3.
|
|
28
|
+
const PYLON_VERSION = "0.3.21";
|
|
29
29
|
|
|
30
30
|
// ---------------------------------------------------------------------------
|
|
31
31
|
// CLI args + interactive prompt
|
|
@@ -268,8 +268,8 @@ write(
|
|
|
268
268
|
|
|
269
269
|
const Todo = entity("Todo", {
|
|
270
270
|
\ttitle: field.string(),
|
|
271
|
-
\tdone: field.bool()
|
|
272
|
-
\tcreatedAt: field.datetime()
|
|
271
|
+
\tdone: field.bool(),
|
|
272
|
+
\tcreatedAt: field.datetime(),
|
|
273
273
|
});
|
|
274
274
|
|
|
275
275
|
// ---------------------------------------------------------------------------
|
|
@@ -300,7 +300,10 @@ const todoPolicy = policy({
|
|
|
300
300
|
// Manifest — pylon codegen reads this and emits pylon.manifest.json
|
|
301
301
|
// ---------------------------------------------------------------------------
|
|
302
302
|
|
|
303
|
-
|
|
303
|
+
// pylon dev / pylon codegen run \`bun run schema.ts\` and read the
|
|
304
|
+
// manifest off stdout. The framework expects JSON, not the JS object —
|
|
305
|
+
// every Pylon entry file ends with this console.log line.
|
|
306
|
+
const manifest = buildManifest({
|
|
304
307
|
\tname: "${projectName}",
|
|
305
308
|
\tversion: "0.0.1",
|
|
306
309
|
\tentities: [Todo],
|
|
@@ -309,6 +312,8 @@ export default buildManifest({
|
|
|
309
312
|
\tpolicies: [todoPolicy],
|
|
310
313
|
\troutes: [],
|
|
311
314
|
});
|
|
315
|
+
|
|
316
|
+
console.log(JSON.stringify(manifest));
|
|
312
317
|
`,
|
|
313
318
|
);
|
|
314
319
|
|
|
@@ -604,7 +609,20 @@ write(
|
|
|
604
609
|
* Pylon's typed client + functions packages re-export across the
|
|
605
610
|
* server/client boundary AND the workspace UI package ships TSX.
|
|
606
611
|
* \`transpilePackages\` makes Next bundle them cleanly.
|
|
612
|
+
*
|
|
613
|
+
* \`rewrites\` proxies every Pylon-owned path (\`/api/fn/*\`,
|
|
614
|
+
* \`/api/auth/*\`, \`/api/sync/*\`, …) to the Pylon binary running
|
|
615
|
+
* on \`PYLON_API_URL\` (default http://localhost:4321). Without this,
|
|
616
|
+
* Next.js sees \`/api/fn/addTodo\` as a missing route and 404s before
|
|
617
|
+
* the request ever reaches Pylon.
|
|
618
|
+
*
|
|
619
|
+
* In production set \`PYLON_API_URL\` to wherever you've deployed the
|
|
620
|
+
* Pylon binary (Fly, Render, Railway, your own box). The browser
|
|
621
|
+
* still hits same-origin paths under your Next deployment, and Next
|
|
622
|
+
* forwards them server-side — no CORS, no extra DNS.
|
|
607
623
|
*/
|
|
624
|
+
const PYLON_API_URL = process.env.PYLON_API_URL ?? "http://localhost:4321";
|
|
625
|
+
|
|
608
626
|
const config: NextConfig = {
|
|
609
627
|
\ttranspilePackages: [
|
|
610
628
|
\t\t"@${projectName}/ui",
|
|
@@ -614,6 +632,14 @@ const config: NextConfig = {
|
|
|
614
632
|
\t\t"@pylonsync/functions",
|
|
615
633
|
\t\t"@pylonsync/sync",
|
|
616
634
|
\t],
|
|
635
|
+
\tasync rewrites() {
|
|
636
|
+
\t\treturn [
|
|
637
|
+
\t\t\t{ source: "/api/fn/:path*", destination: \`\${PYLON_API_URL}/api/fn/:path*\` },
|
|
638
|
+
\t\t\t{ source: "/api/auth/:path*", destination: \`\${PYLON_API_URL}/api/auth/:path*\` },
|
|
639
|
+
\t\t\t{ source: "/api/sync/:path*", destination: \`\${PYLON_API_URL}/api/sync/:path*\` },
|
|
640
|
+
\t\t\t{ source: "/api/:path*", destination: \`\${PYLON_API_URL}/api/:path*\` },
|
|
641
|
+
\t\t];
|
|
642
|
+
\t},
|
|
617
643
|
};
|
|
618
644
|
|
|
619
645
|
export default config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pylonsync/create-pylon",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
4
4
|
"description": "Scaffold a new Pylon app — realtime backend + Next.js frontend in one command. Run via `npm create @pylonsync/pylon@latest`.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|