@pylonsync/create-pylon 0.3.149 → 0.3.151

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pylonsync/create-pylon",
3
- "version": "0.3.149",
3
+ "version": "0.3.151",
4
4
  "description": "Scaffold a new Pylon app — realtime backend + web/mobile/expo frontends in one command. Run via `npm create @pylonsync/pylon@latest`.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,6 +1,6 @@
1
1
  import type { NextConfig } from "next";
2
2
 
3
- const PYLON_API_URL = process.env.PYLON_API_URL ?? "http://localhost:4321";
3
+ const PYLON_TARGET = process.env.PYLON_TARGET ?? "http://localhost:4321";
4
4
 
5
5
  const config: NextConfig = {
6
6
  transpilePackages: [
@@ -13,10 +13,10 @@ const config: NextConfig = {
13
13
  ],
14
14
  async rewrites() {
15
15
  return [
16
- { source: "/api/fn/:path*", destination: `${PYLON_API_URL}/api/fn/:path*` },
17
- { source: "/api/auth/:path*", destination: `${PYLON_API_URL}/api/auth/:path*` },
18
- { source: "/api/sync/:path*", destination: `${PYLON_API_URL}/api/sync/:path*` },
19
- { source: "/api/:path*", destination: `${PYLON_API_URL}/api/:path*` },
16
+ { source: "/api/fn/:path*", destination: `${PYLON_TARGET}/api/fn/:path*` },
17
+ { source: "/api/auth/:path*", destination: `${PYLON_TARGET}/api/auth/:path*` },
18
+ { source: "/api/sync/:path*", destination: `${PYLON_TARGET}/api/sync/:path*` },
19
+ { source: "/api/:path*", destination: `${PYLON_TARGET}/api/:path*` },
20
20
  ];
21
21
  },
22
22
  };
@@ -7,16 +7,16 @@ import type { NextConfig } from "next";
7
7
  *
8
8
  * `rewrites` proxies every Pylon-owned path (`/api/fn/*`,
9
9
  * `/api/auth/*`, `/api/sync/*`, …) to the Pylon binary running on
10
- * `PYLON_API_URL` (default http://localhost:4321). Without this,
10
+ * `PYLON_TARGET` (default http://localhost:4321). Without this,
11
11
  * Next.js sees `/api/fn/createWidget` as a missing route and 404s
12
12
  * before the request reaches Pylon.
13
13
  *
14
- * In production set `PYLON_API_URL` to wherever you've deployed the
14
+ * In production set `PYLON_TARGET` to wherever you've deployed the
15
15
  * Pylon binary (Fly, Render, Railway, your own box). The browser
16
16
  * still hits same-origin paths under your Next deployment, and Next
17
17
  * forwards them server-side — no CORS, no extra DNS.
18
18
  */
19
- const PYLON_API_URL = process.env.PYLON_API_URL ?? "http://localhost:4321";
19
+ const PYLON_TARGET = process.env.PYLON_TARGET ?? "http://localhost:4321";
20
20
 
21
21
  const config: NextConfig = {
22
22
  transpilePackages: [
@@ -29,10 +29,10 @@ const config: NextConfig = {
29
29
  ],
30
30
  async rewrites() {
31
31
  return [
32
- { source: "/api/fn/:path*", destination: `${PYLON_API_URL}/api/fn/:path*` },
33
- { source: "/api/auth/:path*", destination: `${PYLON_API_URL}/api/auth/:path*` },
34
- { source: "/api/sync/:path*", destination: `${PYLON_API_URL}/api/sync/:path*` },
35
- { source: "/api/:path*", destination: `${PYLON_API_URL}/api/:path*` },
32
+ { source: "/api/fn/:path*", destination: `${PYLON_TARGET}/api/fn/:path*` },
33
+ { source: "/api/auth/:path*", destination: `${PYLON_TARGET}/api/auth/:path*` },
34
+ { source: "/api/sync/:path*", destination: `${PYLON_TARGET}/api/sync/:path*` },
35
+ { source: "/api/:path*", destination: `${PYLON_TARGET}/api/:path*` },
36
36
  ];
37
37
  },
38
38
  };
@@ -1,6 +1,6 @@
1
1
  import type { NextConfig } from "next";
2
2
 
3
- const PYLON_API_URL = process.env.PYLON_API_URL ?? "http://localhost:4321";
3
+ const PYLON_TARGET = process.env.PYLON_TARGET ?? "http://localhost:4321";
4
4
 
5
5
  const config: NextConfig = {
6
6
  transpilePackages: [
@@ -13,10 +13,10 @@ const config: NextConfig = {
13
13
  ],
14
14
  async rewrites() {
15
15
  return [
16
- { source: "/api/fn/:path*", destination: `${PYLON_API_URL}/api/fn/:path*` },
17
- { source: "/api/auth/:path*", destination: `${PYLON_API_URL}/api/auth/:path*` },
18
- { source: "/api/sync/:path*", destination: `${PYLON_API_URL}/api/sync/:path*` },
19
- { source: "/api/:path*", destination: `${PYLON_API_URL}/api/:path*` },
16
+ { source: "/api/fn/:path*", destination: `${PYLON_TARGET}/api/fn/:path*` },
17
+ { source: "/api/auth/:path*", destination: `${PYLON_TARGET}/api/auth/:path*` },
18
+ { source: "/api/sync/:path*", destination: `${PYLON_TARGET}/api/sync/:path*` },
19
+ { source: "/api/:path*", destination: `${PYLON_TARGET}/api/:path*` },
20
20
  ];
21
21
  },
22
22
  };
@@ -10,7 +10,7 @@ import { init } from "@pylonsync/react";
10
10
  * through context.
11
11
  *
12
12
  * `baseUrl` is the same-origin Next path because next.config.ts
13
- * proxies /api/* to the Pylon binary on PYLON_API_URL. Browser →
13
+ * proxies /api/* to the Pylon binary on PYLON_TARGET. Browser →
14
14
  * same-origin → Next server → Pylon: no CORS, no extra DNS, the
15
15
  * cookie travels naturally.
16
16
  */
@@ -1,6 +1,6 @@
1
1
  import type { NextConfig } from "next";
2
2
 
3
- const PYLON_API_URL = process.env.PYLON_API_URL ?? "http://localhost:4321";
3
+ const PYLON_TARGET = process.env.PYLON_TARGET ?? "http://localhost:4321";
4
4
 
5
5
  const config: NextConfig = {
6
6
  transpilePackages: [
@@ -13,10 +13,10 @@ const config: NextConfig = {
13
13
  ],
14
14
  async rewrites() {
15
15
  return [
16
- { source: "/api/fn/:path*", destination: `${PYLON_API_URL}/api/fn/:path*` },
17
- { source: "/api/auth/:path*", destination: `${PYLON_API_URL}/api/auth/:path*` },
18
- { source: "/api/sync/:path*", destination: `${PYLON_API_URL}/api/sync/:path*` },
19
- { source: "/api/:path*", destination: `${PYLON_API_URL}/api/:path*` },
16
+ { source: "/api/fn/:path*", destination: `${PYLON_TARGET}/api/fn/:path*` },
17
+ { source: "/api/auth/:path*", destination: `${PYLON_TARGET}/api/auth/:path*` },
18
+ { source: "/api/sync/:path*", destination: `${PYLON_TARGET}/api/sync/:path*` },
19
+ { source: "/api/:path*", destination: `${PYLON_TARGET}/api/:path*` },
20
20
  ];
21
21
  },
22
22
  };
@@ -10,7 +10,7 @@ import { init } from "@pylonsync/react";
10
10
  * through context.
11
11
  *
12
12
  * `baseUrl` is the same-origin Next path because next.config.ts
13
- * proxies /api/* to the Pylon binary on PYLON_API_URL. Browser →
13
+ * proxies /api/* to the Pylon binary on PYLON_TARGET. Browser →
14
14
  * same-origin → Next server → Pylon: no CORS, no extra DNS, the
15
15
  * cookie travels naturally.
16
16
  */
@@ -1,6 +1,11 @@
1
1
  import type { NextConfig } from "next";
2
2
 
3
- const PYLON_API_URL = process.env.PYLON_API_URL ?? "http://localhost:4321";
3
+ // Backend origin. In dev defaults to the `pylon dev` default port.
4
+ // In production (Vercel etc.), set PYLON_TARGET on your project's env.
5
+ // Matches the env var @pylonsync/next reads on the server side — keeping
6
+ // them aligned means one env var sets the URL for both the rewrite and
7
+ // the server-side fetch helpers.
8
+ const PYLON_TARGET = process.env.PYLON_TARGET ?? "http://localhost:4321";
4
9
 
5
10
  const config: NextConfig = {
6
11
  transpilePackages: [
@@ -12,12 +17,9 @@ const config: NextConfig = {
12
17
  "@pylonsync/sync",
13
18
  ],
14
19
  async rewrites() {
15
- return [
16
- { source: "/api/fn/:path*", destination: `${PYLON_API_URL}/api/fn/:path*` },
17
- { source: "/api/auth/:path*", destination: `${PYLON_API_URL}/api/auth/:path*` },
18
- { source: "/api/sync/:path*", destination: `${PYLON_API_URL}/api/sync/:path*` },
19
- { source: "/api/:path*", destination: `${PYLON_API_URL}/api/:path*` },
20
- ];
20
+ // /api/* → ${PYLON_TARGET}/api/* keeps the browser same-origin
21
+ // (no CORS preflight, session cookie rides natively).
22
+ return [{ source: "/api/:path*", destination: `${PYLON_TARGET}/api/:path*` }];
21
23
  },
22
24
  };
23
25