create-apollo-monorepo 0.5.0 → 0.5.1

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.
Files changed (3) hide show
  1. package/README.md +17 -7
  2. package/index.mjs +4 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -44,19 +44,29 @@ collide:
44
44
  | Browser path | Goes to |
45
45
  | ------------------------------------ | -------------------- |
46
46
  | `/`, your custom routes | `apps/frontend` |
47
- | `/admin/*` | `apps/backend` |
47
+ | `/admin/*` | `apps/backend` (admin pages **and** their JS chunks) |
48
48
  | `/api/auth/*`, `/api/v1/*`, `/api/admin/*`, `/api/email/*`, `/api/cron`, `/api/health`, `/api/mcp`, `/api/editing-presence/*` | `apps/backend` |
49
49
  | `/uploads/*` | `apps/backend` (media) |
50
- | `/cms-assets/*` | `apps/backend` chunks (via `APOLLO_ASSET_PREFIX`) |
51
50
  | `/monitoring` | `apps/backend` (Sentry tunnel, no-op without DSN) |
52
51
 
53
- Apollo CMS picks up `APOLLO_ASSET_PREFIX=/cms-assets` and serves its built JS
54
- under that namespace, sidestepping the `/_next/*` collision. The frontend
55
- **must not** define routes at `/admin`, `/api/auth`, `/api/v1`, etc.
52
+ Apollo CMS reads `APOLLO_ASSET_PREFIX` (default `/admin`) and serves its built
53
+ JS under `<prefix>/_next/static/`. Because the prefix coincides with the admin
54
+ path, a single `/admin/:path*` rewrite covers both pages and chunks — no
55
+ separate asset rewrite is emitted. The frontend **must not** define routes at
56
+ `/admin`, `/api/auth`, `/api/v1`, etc.
57
+
58
+ You can override the prefix:
59
+
60
+ ```bash
61
+ npx create-apollo-monorepo my-app --admin-prefix /cms
62
+ ```
63
+
64
+ When the prefix is anything other than `/admin`, the scaffold also emits a
65
+ matching `<prefix>/:path*` rewrite for backend chunks.
56
66
 
57
67
  ### Separate origins (fallback)
58
68
 
59
- Pass `--asset-prefix none` (or `off`/`false`/`disabled`) to skip the rewrite
69
+ Pass `--admin-prefix none` (or `off`/`false`/`disabled`) to skip the rewrite
60
70
  wiring. The backend runs at `http://localhost:3000` and the frontend at
61
71
  `http://localhost:3001`. Useful when you'd rather deploy them on separate
62
72
  subdomains (e.g. `cms.example.com` + `example.com`).
@@ -71,7 +81,7 @@ subdomains (e.g. `cms.example.com` + `example.com`).
71
81
  | `-d, --db <url>` | _(prompted)_ | `DATABASE_URL` for backend |
72
82
  | `-u, --url <url>` | `:3001` single-origin / `:3000` separate | `NEXT_PUBLIC_SITE_URL` |
73
83
  | `-l, --locale <code>` | `en` | `NEXT_PUBLIC_DEFAULT_LOCALE` |
74
- | `--asset-prefix <path>` | `/cms-assets` | Single-origin asset namespace; `none` to disable |
84
+ | `--admin-prefix <path>` | `/admin` | Single-origin admin/asset namespace; `none` to disable. Alias: `--asset-prefix` |
75
85
  | `--skip-install` | off | Don't run `pnpm install` |
76
86
  | `--skip-submodule` | off | Don't add the git submodule |
77
87
  | `-h, --help` | — | Show help |
package/index.mjs CHANGED
@@ -950,7 +950,7 @@ Two Vercel projects, one repo. Each project picks up its own Root Directory.
950
950
 
951
951
  - **Import** this repo into Vercel as a new project.
952
952
  - **Root Directory**: \`apps/backend\`
953
- - **Build Command**: \`cd ../.. && pnpm install --frozen-lockfile && pnpm --filter ./apps/backend build\`
953
+ - **Build Command**: \`cd ../.. && pnpm install --frozen-lockfile && pnpm cms-plugins:build && cp -r ../cms-plugins/* apps/backend/plugins/ 2>/dev/null || true && pnpm --filter ./apps/backend build\`
954
954
  - **Install Command**: leave empty (handled in build)
955
955
  - **Settings → Git → Include all submodules: ON** (Vercel checks out an empty \`apps/backend\` otherwise)
956
956
  - **Environment variables**:
@@ -959,14 +959,16 @@ Two Vercel projects, one repo. Each project picks up its own Root Directory.
959
959
  APOLLO_SECRET=<openssl rand -hex 32>
960
960
  NEXT_PUBLIC_SITE_URL=https://yourdomain.com # the PUBLIC origin
961
961
  NEXT_PUBLIC_DEFAULT_LOCALE=en
962
- ${singleOrigin ? `APOLLO_ASSET_PREFIX=${adminPrefix}` : "# APOLLO_ASSET_PREFIX=/cms-assets # only when single-origin"}
962
+ ${singleOrigin ? `APOLLO_ASSET_PREFIX=${adminPrefix}` : "# APOLLO_ASSET_PREFIX=/admin # only when single-origin"}
963
963
  CRON_SECRET=<random> # protects /api/cron
964
+ APOLLO_EXTRA_PLUGINS_DIR=./plugins # picks up copied cms-plugins (see Build Command)
964
965
  # Storage on Vercel cannot use local FS — pick one:
965
966
  # Vercel Blob: BLOB_READ_WRITE_TOKEN=…
966
967
  # S3 / R2 / Spaces: S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY, S3_BUCKET, S3_REGION, S3_ENDPOINT
967
968
  APOLLO_DISABLE_LOCAL_STORAGE=1
968
969
  \`\`\`
969
970
  - **Cron**: \`apps/backend/vercel.json\` declares \`/api/cron\` on a 5-minute schedule (from apollo-cms upstream).
971
+ - **About the \`cp\` step**: Turbopack rejects \`outputFileTracingIncludes\` globs that walk above the project root, so the Build Command copies built \`apps/cms-plugins/*/dist\` into \`apps/backend/plugins/\` before \`next build\`. NFT then traces them normally as if they were built-in plugins. Locally this isn't needed because \`APOLLO_EXTRA_PLUGINS_DIR=../cms-plugins\` reads them directly.
970
972
 
971
973
  ### 2) Frontend project
972
974
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-apollo-monorepo",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Scaffold a monorepo with a frontend app and Apollo CMS as a git submodule backend (single-origin via Next.js rewrites + assetPrefix)",
5
5
  "bin": {
6
6
  "create-apollo-monorepo": "index.mjs"