create-apollo-suite-monorepo 1.0.903 → 1.0.906
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/README.md +27 -0
- package/index.mjs +19 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -131,11 +131,38 @@ Before the database has been set up once, edit the list by hand and run
|
|
|
131
131
|
|
|
132
132
|
```bash
|
|
133
133
|
pnpm backend:update # git submodule update --remote --merge apps/backend
|
|
134
|
+
# + node apps/backend/scripts/sync-root-workspace.mjs + pnpm install
|
|
134
135
|
```
|
|
135
136
|
|
|
136
137
|
Don't edit files inside `apps/backend` — open issues / PRs against the
|
|
137
138
|
`apollo-cms` repository upstream.
|
|
138
139
|
|
|
140
|
+
### Root `pnpm-workspace.yaml` mirrors the backend's overrides and patches
|
|
141
|
+
|
|
142
|
+
pnpm reads **only the root** `pnpm-workspace.yaml`; the submodule's own copy
|
|
143
|
+
is ignored once `apps/backend` is a package of the outer workspace. The
|
|
144
|
+
scaffold (and `pnpm backend:update`) therefore run
|
|
145
|
+
`node apps/backend/scripts/sync-root-workspace.mjs`, which copies the
|
|
146
|
+
backend's security `overrides` and `patchedDependencies` into the root file
|
|
147
|
+
(patch paths rewritten to `apps/backend/patches/…`). Your own root overrides
|
|
148
|
+
are kept; backend keys win on conflict.
|
|
149
|
+
|
|
150
|
+
Without the mirror the drizzle-kit patch never applies, and every
|
|
151
|
+
`drizzle-kit push` / `apl install` re-adds each `NULLS NOT DISTINCT` unique
|
|
152
|
+
constraint and prompts to truncate any non-empty table that owns one —
|
|
153
|
+
in CI (no TTY) the push aborts.
|
|
154
|
+
|
|
155
|
+
### Scaffolds created before `sync-root-workspace`
|
|
156
|
+
|
|
157
|
+
Run it once by hand, then reinstall:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
node apps/backend/scripts/sync-root-workspace.mjs && pnpm install
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
and add `node apps/backend/scripts/sync-root-workspace.mjs` to your
|
|
164
|
+
`backend:update` script between the submodule update and `pnpm install`.
|
|
165
|
+
|
|
139
166
|
### Scaffolds created before v0.9.991
|
|
140
167
|
|
|
141
168
|
Two entries were missing from older scaffolds, and `pnpm dev` fails during
|
package/index.mjs
CHANGED
|
@@ -388,12 +388,14 @@ function writeRootPackageJson(targetDir, dirName) {
|
|
|
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
|
|
391
|
-
// merge can't conflict, then update,
|
|
392
|
-
//
|
|
393
|
-
//
|
|
394
|
-
//
|
|
391
|
+
// merge can't conflict, then update, re-mirror apollo-cms's overrides +
|
|
392
|
+
// patchedDependencies into the root pnpm-workspace.yaml (pnpm ignores
|
|
393
|
+
// the submodule's own copy), then run `pnpm install` at the root so
|
|
394
|
+
// workspace deps pick up any package.json changes pulled in from the
|
|
395
|
+
// new apollo-cms commit. The stash is restored if it was created;
|
|
396
|
+
// otherwise this is a no-op.
|
|
395
397
|
"backend:update":
|
|
396
|
-
"node -e \"const {execSync:e}=require('child_process');const r=s=>e(s,{stdio:'inherit'});const has=e('git -C apps/backend status --porcelain',{encoding:'utf8'}).trim().length>0;if(has)r('git -C apps/backend stash push -u -m backend-update-auto');r('git submodule update --remote --merge apps/backend');r('pnpm install');if(has){try{r('git -C apps/backend stash pop');}catch(_){console.error('[backend:update] stash pop had conflicts — resolve manually with: git -C apps/backend stash list');}}\"",
|
|
398
|
+
"node -e \"const {execSync:e}=require('child_process');const r=s=>e(s,{stdio:'inherit'});const has=e('git -C apps/backend status --porcelain',{encoding:'utf8'}).trim().length>0;if(has)r('git -C apps/backend stash push -u -m backend-update-auto');r('git submodule update --remote --merge apps/backend');r('node apps/backend/scripts/sync-root-workspace.mjs');r('pnpm install');if(has){try{r('git -C apps/backend stash pop');}catch(_){console.error('[backend:update] stash pop had conflicts — resolve manually with: git -C apps/backend stash list');}}\"",
|
|
397
399
|
// `pnpm setup` is pnpm's CLI bootstrap built-in — must use `run` to
|
|
398
400
|
// forward to the workspace's setup script (apollo-cms's db:push + db:seed).
|
|
399
401
|
"backend:setup": "pnpm --filter ./apps/backend run setup",
|
|
@@ -2110,6 +2112,18 @@ async function main() {
|
|
|
2110
2112
|
);
|
|
2111
2113
|
run(`git submodule update --init --recursive`, { cwd: targetDir });
|
|
2112
2114
|
success("submodule added");
|
|
2115
|
+
// pnpm reads only the ROOT pnpm-workspace.yaml, so apollo-cms's security
|
|
2116
|
+
// `overrides` and its drizzle-kit patch (NULLS NOT DISTINCT introspection
|
|
2117
|
+
// fix — without it every `drizzle-kit push` re-adds those constraints
|
|
2118
|
+
// and prompts to truncate) never apply unless mirrored here.
|
|
2119
|
+
try {
|
|
2120
|
+
run(`node ${BACKEND_PATH}/scripts/sync-root-workspace.mjs`, { cwd: targetDir });
|
|
2121
|
+
success("root pnpm-workspace.yaml: mirrored apollo-cms overrides + patchedDependencies");
|
|
2122
|
+
} catch {
|
|
2123
|
+
warn(
|
|
2124
|
+
`Could not mirror apollo-cms overrides into pnpm-workspace.yaml (old backend?).\n Later: node ${BACKEND_PATH}/scripts/sync-root-workspace.mjs && pnpm install`,
|
|
2125
|
+
);
|
|
2126
|
+
}
|
|
2113
2127
|
} catch {
|
|
2114
2128
|
fatal(
|
|
2115
2129
|
`Failed to add submodule.\n Check the URL and your network, then run:\n cd ${dirName} && git submodule add -b ${flags.backendBranch} ${flags.backendUrl} ${BACKEND_PATH}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-apollo-suite-monorepo",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.906",
|
|
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"
|