create-apollo-suite-monorepo 1.0.974 → 1.0.975

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 +1 -1
  2. package/index.mjs +44 -44
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -184,7 +184,7 @@ does not install). Patch an existing scaffold with:
184
184
  # pnpm-workspace.yaml
185
185
  packages:
186
186
  - 'apps/*'
187
- - 'apps/cms-plugins/*'
187
+ - 'apps/extensions/*'
188
188
  - 'apps/backend/plugins/*' # add this
189
189
  ```
190
190
 
package/index.mjs CHANGED
@@ -340,32 +340,32 @@ function writeRootPackageJson(targetDir, dirName) {
340
340
  // `next dev` directly. Nothing extra to start for scheduled jobs — the
341
341
  // backend drives its scheduler queue in-process (dev and production).
342
342
  "predev:setup":
343
- "pnpm cms-plugins:build && pnpm --filter ./apps/backend exec bun run plugins:build",
343
+ "pnpm extensions:build && pnpm --filter ./apps/backend exec bun run plugins:build",
344
344
  // `pnpm dev` runs FE + BE Next.js dev servers (which watch their own
345
- // src/) plus a parallel cms-plugins watcher, so editing
346
- // apps/cms-plugins/<slug>/index.ts triggers an esbuild incremental
345
+ // src/) plus a parallel extensions watcher, so editing
346
+ // apps/extensions/<slug>/index.ts triggers an esbuild incremental
347
347
  // rebuild and the backend's plugin loader picks up the fresh
348
348
  // dist/server.mjs on next request.
349
349
  dev:
350
- "pnpm predev:setup && concurrently -k -n FE,BE,PL -c blue,magenta,yellow \"pnpm dev:frontend\" \"pnpm dev:backend\" \"pnpm cms-plugins:dev\"",
350
+ "pnpm predev:setup && concurrently -k -n FE,BE,PL -c blue,magenta,yellow \"pnpm dev:frontend\" \"pnpm dev:backend\" \"pnpm extensions:dev\"",
351
351
  // Optional single-origin dev: same as `pnpm dev` but adds a Node.js
352
352
  // reverse proxy on :3030 (PROXY_PORT) that fronts FE :3001 (FRONTEND_PORT)
353
353
  // + BE :3002 (BACKEND_PORT). Ports come from .env.local; override there.
354
354
  "dev:rp":
355
- "pnpm predev:setup && concurrently -k -n FE,BE,PL,PX -c blue,magenta,yellow,cyan \"pnpm dev:frontend\" \"pnpm dev:backend\" \"pnpm cms-plugins:dev\" \"pnpm dev:proxy\"",
355
+ "pnpm predev:setup && concurrently -k -n FE,BE,PL,PX -c blue,magenta,yellow,cyan \"pnpm dev:frontend\" \"pnpm dev:backend\" \"pnpm extensions:dev\" \"pnpm dev:proxy\"",
356
356
  "dev:proxy": "node scripts/with-env.mjs node apps/proxy/server.mjs",
357
357
  "dev:frontend":
358
358
  "node scripts/with-env.mjs --port=FRONTEND_PORT pnpm --filter ./apps/frontend exec next dev",
359
359
  "dev:backend":
360
360
  "pnpm predev:setup && node scripts/with-env.mjs --port=BACKEND_PORT pnpm --filter ./apps/backend exec next dev",
361
- // Build pipeline: cms-plugins → apollo-cms's own plugins → backend → frontend.
361
+ // Build pipeline: extensions → apollo-cms's own plugins → backend → frontend.
362
362
  // `prebuild` runs first (npm/pnpm convention) and fails fast if the
363
363
  // backend's required env vars are missing.
364
364
  prebuild: "node scripts/check-env.mjs",
365
365
  build:
366
- "pnpm cms-plugins:build && pnpm --filter ./apps/backend exec bun run plugins:build && pnpm --filter ./apps/backend build && pnpm --filter ./apps/frontend build",
366
+ "pnpm extensions:build && pnpm --filter ./apps/backend exec bun run plugins:build && pnpm --filter ./apps/backend build && pnpm --filter ./apps/frontend build",
367
367
  "build:backend":
368
- "pnpm cms-plugins:build && pnpm --filter ./apps/backend exec bun run plugins:build && pnpm --filter ./apps/backend build",
368
+ "pnpm extensions:build && pnpm --filter ./apps/backend exec bun run plugins:build && pnpm --filter ./apps/backend build",
369
369
  "build:frontend": "pnpm --filter ./apps/frontend build",
370
370
  // Production start. Runs FE :FRONTEND_PORT + BE :BACKEND_PORT (defaults
371
371
  // 3001 + 3002 from .env.local). Run \`pnpm backend:upgrade\` BEFORE this —
@@ -380,11 +380,11 @@ function writeRootPackageJson(targetDir, dirName) {
380
380
  "node scripts/with-env.mjs --port=FRONTEND_PORT pnpm --filter ./apps/frontend exec next start",
381
381
  "start:backend":
382
382
  "node scripts/with-env.mjs --port=BACKEND_PORT pnpm --filter ./apps/backend exec next start",
383
- "cms-plugins:build":
384
- "pnpm --filter './apps/cms-plugins/*' --parallel --if-present build",
385
- "cms-plugins:dev":
386
- "pnpm --filter './apps/cms-plugins/*' --parallel --if-present dev",
387
- "cms-plugin:new": "node scripts/new-cms-plugin.mjs",
383
+ "extensions:build":
384
+ "pnpm --filter './apps/extensions/*' --parallel --if-present build",
385
+ "extensions:dev":
386
+ "pnpm --filter './apps/extensions/*' --parallel --if-present dev",
387
+ "extension:new": "node scripts/new-extension.mjs",
388
388
  lint: "pnpm -r lint",
389
389
  typecheck: "pnpm -r typecheck",
390
390
  // Stash any local changes inside the submodule so the fast-forward
@@ -480,7 +480,7 @@ function writePnpmWorkspace(targetDir) {
480
480
  const yaml = [
481
481
  "packages:",
482
482
  " - 'apps/*'",
483
- " - 'apps/cms-plugins/*'",
483
+ " - 'apps/extensions/*'",
484
484
  // apollo-cms declares `plugins/*` in its own pnpm-workspace.yaml, but a
485
485
  // nested workspace file is ignored once the submodule is itself a package
486
486
  // of an outer workspace. Without this glob pnpm never installs the
@@ -981,7 +981,7 @@ function writeRootEnv(targetDir, { dbUrl, siteUrl, locale, authSecret, cronSecre
981
981
  }
982
982
  lines.push(
983
983
  "# Project-specific plugins — keeps the apollo-cms submodule clean.",
984
- `APOLLO_EXTRA_PLUGINS_DIR=../cms-plugins`,
984
+ `APOLLO_EXTRA_PLUGINS_DIR=../extensions`,
985
985
  "# PM2 namespace — groups this project's processes so you can",
986
986
  "# `pm2 stop <namespace>` / `pm2 restart <namespace>` independently of",
987
987
  "# other projects on the same host. Consumed by ecosystem.config.cjs.",
@@ -1165,7 +1165,7 @@ export default config;
1165
1165
  function writeExampleCmsPlugin(targetDir, dirName) {
1166
1166
  const slug = "example-plugin";
1167
1167
  const pkgName = `@${dirName}/cms-${slug}`;
1168
- const pluginDir = resolve(targetDir, "apps/cms-plugins", slug);
1168
+ const pluginDir = resolve(targetDir, "apps/extensions", slug);
1169
1169
  mkdirSync(pluginDir, { recursive: true });
1170
1170
 
1171
1171
  const manifest = {
@@ -1188,7 +1188,7 @@ function writeExampleCmsPlugin(targetDir, dirName) {
1188
1188
  scripts: {
1189
1189
  build: "node ./build.mjs",
1190
1190
  // `dev` is the watcher entry — `pnpm dev` from the monorepo root fans
1191
- // out to it via `cms-plugins:dev`, so editing index.ts triggers an
1191
+ // out to it via `extensions:dev`, so editing index.ts triggers an
1192
1192
  // incremental rebuild and the backend's plugin loader picks up the new
1193
1193
  // dist/server.mjs on the next request.
1194
1194
  dev: "node ./build.mjs --watch",
@@ -1221,7 +1221,7 @@ const options = {
1221
1221
  if (watch) {
1222
1222
  const ctx = await context(options);
1223
1223
  await ctx.watch();
1224
- console.log("[cms-plugin] watching index.ts → dist/server.mjs");
1224
+ console.log("[extension] watching index.ts → dist/server.mjs");
1225
1225
  } else {
1226
1226
  await build(options);
1227
1227
  }
@@ -1251,7 +1251,7 @@ if (watch) {
1251
1251
  const indexTs = `// Example Apollo CMS plugin — runs inside apps/backend at boot.
1252
1252
  //
1253
1253
  // The plugin loader picks up this file via package.json#exports["./server"]
1254
- // → dist/server.mjs (built by \`pnpm cms-plugins:build\`).
1254
+ // → dist/server.mjs (built by \`pnpm extensions:build\`).
1255
1255
  //
1256
1256
  // In dev under Bun the loader can also import index.ts directly (with a
1257
1257
  // warning); in production (next start) the dist file is required.
@@ -1293,7 +1293,7 @@ Run from the **monorepo root** (not this folder):
1293
1293
 
1294
1294
  \`\`\`bash
1295
1295
  pnpm dev # builds plugins + starts backend & frontend
1296
- pnpm cms-plugins:build # rebuild after editing
1296
+ pnpm extensions:build # rebuild after editing
1297
1297
  \`\`\`
1298
1298
 
1299
1299
  ## Author a new hook
@@ -1304,7 +1304,7 @@ Open \`index.ts\` and add to \`registerHooks\`. The full hook surface lives in
1304
1304
  ## Add another plugin
1305
1305
 
1306
1306
  \`\`\`bash
1307
- pnpm cms-plugin:new my-plugin
1307
+ pnpm extension:new my-plugin
1308
1308
  \`\`\`
1309
1309
  `;
1310
1310
  writeFileSync(resolve(pluginDir, "README.md"), readme);
@@ -1315,8 +1315,8 @@ function writeNewCmsPluginScript(targetDir) {
1315
1315
  mkdirSync(scriptsDir, { recursive: true });
1316
1316
 
1317
1317
  const script = `#!/usr/bin/env node
1318
- // Scaffold a new project-specific apollo-cms plugin under apps/cms-plugins/<slug>.
1319
- // Usage: pnpm cms-plugin:new <slug>
1318
+ // Scaffold a new project-specific apollo-cms plugin under apps/extensions/<slug>.
1319
+ // Usage: pnpm extension:new <slug>
1320
1320
 
1321
1321
  import { cpSync, existsSync, readFileSync, writeFileSync } from "node:fs";
1322
1322
  import { dirname, resolve } from "node:path";
@@ -1324,12 +1324,12 @@ import { fileURLToPath } from "node:url";
1324
1324
 
1325
1325
  const __dirname = dirname(fileURLToPath(import.meta.url));
1326
1326
  const monorepoRoot = resolve(__dirname, "..");
1327
- const pluginsRoot = resolve(monorepoRoot, "apps/cms-plugins");
1327
+ const pluginsRoot = resolve(monorepoRoot, "apps/extensions");
1328
1328
  const template = resolve(pluginsRoot, "example-plugin");
1329
1329
 
1330
1330
  const slug = (process.argv[2] ?? "").trim();
1331
1331
  if (!slug) {
1332
- console.error("Usage: pnpm cms-plugin:new <slug>");
1332
+ console.error("Usage: pnpm extension:new <slug>");
1333
1333
  process.exit(1);
1334
1334
  }
1335
1335
  if (!/^[a-z][a-z0-9-]*$/.test(slug)) {
@@ -1337,7 +1337,7 @@ if (!/^[a-z][a-z0-9-]*$/.test(slug)) {
1337
1337
  process.exit(1);
1338
1338
  }
1339
1339
  if (!existsSync(template)) {
1340
- console.error(\`Template not found: \${template}\\nRecreate apps/cms-plugins/example-plugin or restore from a fresh \\\`npx create-apollo-suite-monorepo\\\` scaffold.\`);
1340
+ console.error(\`Template not found: \${template}\\nRecreate apps/extensions/example-plugin or restore from a fresh \\\`npx create-apollo-suite-monorepo\\\` scaffold.\`);
1341
1341
  process.exit(1);
1342
1342
  }
1343
1343
 
@@ -1364,10 +1364,10 @@ const rootPkg = JSON.parse(readFileSync(resolve(monorepoRoot, "package.json"), "
1364
1364
  pkg.name = \`@\${rootPkg.name}/cms-\${slug}\`;
1365
1365
  writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\\n");
1366
1366
 
1367
- console.log(\`Created apps/cms-plugins/\${slug}\`);
1368
- console.log(\`Run: pnpm install && pnpm cms-plugins:build && pnpm dev:backend\`);
1367
+ console.log(\`Created apps/extensions/\${slug}\`);
1368
+ console.log(\`Run: pnpm install && pnpm extensions:build && pnpm dev:backend\`);
1369
1369
  `;
1370
- writeFileSync(resolve(scriptsDir, "new-cms-plugin.mjs"), script);
1370
+ writeFileSync(resolve(scriptsDir, "new-extension.mjs"), script);
1371
1371
  }
1372
1372
 
1373
1373
  // Small launcher that loads root .env.local, applies port defaults
@@ -1646,11 +1646,11 @@ pnpm workspace monorepo. Three workspaces under \`apps/\`:
1646
1646
 
1647
1647
  - \`apps/frontend\` — public Next.js site${singleOrigin ? " (the public origin in single-origin mode)" : ""}.
1648
1648
  - \`apps/backend\` — **git submodule** pointing at \`apollo-cms\`. Treat as read-only; do not edit files in here. Open PRs upstream.
1649
- - \`apps/cms-plugins/<slug>\` — project-specific Apollo CMS plugins. Loaded by the backend via \`APOLLO_EXTRA_PLUGINS_DIR=../cms-plugins\`. Each plugin is built with esbuild to \`dist/server.mjs\` before the backend builds.
1649
+ - \`apps/extensions/<slug>\` — project-specific Apollo CMS plugins. Loaded by the backend via \`APOLLO_EXTRA_PLUGINS_DIR=../extensions\`. Each plugin is built with esbuild to \`dist/server.mjs\` before the backend builds.
1650
1650
  - \`apps/proxy/server.mjs\` — zero-dep Node reverse proxy used for single-origin dev and self-hosted deploys.
1651
1651
  - \`${APPS_FILE_NAME}\` — the suite apps this project installs besides the mandatory ones. Change it with \`pnpm apl install\` / \`pnpm apl uninstall\`, which run the upgrade. \`APOLLO_APPS_FILE\` in \`.env.local\` points at it, so deleting it stops the backend.
1652
1652
 
1653
- Built-in plugins in \`apps/backend/plugins/\` always win on slug collisions with \`apps/cms-plugins/\`.
1653
+ Built-in plugins in \`apps/backend/plugins/\` always win on slug collisions with \`apps/extensions/\`.
1654
1654
 
1655
1655
  ${singleOriginSection}
1656
1656
  ## Common commands
@@ -1671,7 +1671,7 @@ pnpm dev:rp # same + reverse proxy on :3030 (single origin, shar
1671
1671
  pnpm dev:frontend # FE only
1672
1672
  pnpm dev:backend # BE only (runs predev:setup to build plugins first)
1673
1673
 
1674
- pnpm build # cms-plugins → backend plugins → backend → frontend
1674
+ pnpm build # extensions → backend plugins → backend → frontend
1675
1675
  pnpm build:backend
1676
1676
  pnpm build:frontend
1677
1677
 
@@ -1681,10 +1681,10 @@ pnpm start:rp # FE + BE + proxy
1681
1681
  pnpm lint # recursive
1682
1682
  pnpm typecheck # recursive
1683
1683
 
1684
- pnpm cms-plugin:new <slug> # scaffold a new plugin from example-plugin
1684
+ pnpm extension:new <slug> # scaffold a new plugin from example-plugin
1685
1685
  \`\`\`
1686
1686
 
1687
- \`pnpm dev\` and \`pnpm build\` both run \`cms-plugins:build\` first (via \`predev:setup\` / build script chain) — plugins must compile to \`dist/server.mjs\` before the backend resolves them in production. In dev under Bun the loader also accepts \`index.ts\` directly.
1687
+ \`pnpm dev\` and \`pnpm build\` both run \`extensions:build\` first (via \`predev:setup\` / build script chain) — plugins must compile to \`dist/server.mjs\` before the backend resolves them in production. In dev under Bun the loader also accepts \`index.ts\` directly.
1688
1688
 
1689
1689
  Release flow on a server: \`pnpm install && pnpm backend:upgrade && pnpm build && pm2 reload all\`. \`pnpm start\` does **not** run migrations.
1690
1690
 
@@ -1823,27 +1823,27 @@ needs the tables that setup creates.
1823
1823
  ${originSection}
1824
1824
  ## Custom plugins
1825
1825
 
1826
- Project-specific plugins live in \`apps/cms-plugins/<slug>/\` and are loaded by
1827
- the apollo-cms backend via \`APOLLO_EXTRA_PLUGINS_DIR=../cms-plugins\` (set
1826
+ Project-specific plugins live in \`apps/extensions/<slug>/\` and are loaded by
1827
+ the apollo-cms backend via \`APOLLO_EXTRA_PLUGINS_DIR=../extensions\` (set
1828
1828
  automatically in \`apps/backend/.env.local\`). The submodule stays clean —
1829
1829
  \`pnpm backend:update\` won't conflict with your plugins.
1830
1830
 
1831
1831
  ### Author a new plugin
1832
1832
 
1833
1833
  \`\`\`bash
1834
- pnpm cms-plugin:new my-plugin
1834
+ pnpm extension:new my-plugin
1835
1835
  pnpm install
1836
1836
  pnpm dev
1837
1837
  \`\`\`
1838
1838
 
1839
- The scaffolder copies \`apps/cms-plugins/example-plugin/\` to
1840
- \`apps/cms-plugins/my-plugin/\` and renames it. Edit \`index.ts\` to register
1839
+ The scaffolder copies \`apps/extensions/example-plugin/\` to
1840
+ \`apps/extensions/my-plugin/\` and renames it. Edit \`index.ts\` to register
1841
1841
  hooks, UI slots, and API routes — see
1842
1842
  \`apps/backend/docs/plugin-system.md\` for the full surface.
1843
1843
 
1844
1844
  ### Build pipeline
1845
1845
 
1846
- \`pnpm dev\` and \`pnpm build\` run \`pnpm cms-plugins:build\` first to compile
1846
+ \`pnpm dev\` and \`pnpm build\` run \`pnpm extensions:build\` first to compile
1847
1847
  each plugin's \`index.ts\` → \`dist/server.mjs\` (via esbuild). The backend's
1848
1848
  plugin loader resolves \`dist/server.mjs\` in production; in dev under Bun it
1849
1849
  also accepts \`index.ts\` directly.
@@ -1895,7 +1895,7 @@ processes without re-running \`drizzle-kit push\` every time. Always run
1895
1895
 
1896
1896
  | Script | What it does |
1897
1897
  | ------------------- | ------------------------------------------------------------------- |
1898
- | \`pnpm build\` | Full pipeline: cms-plugins → backend plugins → backend → frontend |
1898
+ | \`pnpm build\` | Full pipeline: extensions → backend plugins → backend → frontend |
1899
1899
  | \`pnpm start\` | FE + BE (parallel \`next start\`) |
1900
1900
  | \`pnpm start:rp\` | FE + BE + reverse proxy on :3030 |
1901
1901
  | \`pnpm start:proxy\` | Reverse proxy alone (already running FE/BE separately) |
@@ -2097,10 +2097,10 @@ async function main() {
2097
2097
  success(`apps/frontend (${frontendName})`);
2098
2098
 
2099
2099
  // ── Step 5b: Custom plugins workspace + example ──
2100
- step("5b", "Scaffolding apps/cms-plugins/example-plugin");
2100
+ step("5b", "Scaffolding apps/extensions/example-plugin");
2101
2101
  writeExampleCmsPlugin(targetDir, dirName);
2102
2102
  writeNewCmsPluginScript(targetDir);
2103
- success("apps/cms-plugins/example-plugin + scripts/new-cms-plugin.mjs");
2103
+ success("apps/extensions/example-plugin + scripts/new-extension.mjs");
2104
2104
 
2105
2105
  // ── Step 6: Backend submodule ──
2106
2106
  if (flags.skipSubmodule) {
@@ -2141,7 +2141,7 @@ async function main() {
2141
2141
  `CRON_SECRET=${cronSecret}`,
2142
2142
  `NEXT_PUBLIC_SITE_URL=${siteUrl}`,
2143
2143
  `NEXT_PUBLIC_DEFAULT_LOCALE=${locale}`,
2144
- `APOLLO_EXTRA_PLUGINS_DIR=../cms-plugins`,
2144
+ `APOLLO_EXTRA_PLUGINS_DIR=../extensions`,
2145
2145
  `PM2_NAMESPACE=${dirName}`,
2146
2146
  `APOLLO_APPS_FILE=${APPS_FILE_ENV_VALUE}`,
2147
2147
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-apollo-suite-monorepo",
3
- "version": "1.0.974",
3
+ "version": "1.0.975",
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-suite-monorepo": "index.mjs"