@notionx/create-notionx-app 1.0.0

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 (239) hide show
  1. package/README.md +139 -0
  2. package/dist/answers.js +332 -0
  3. package/dist/answers.js.map +1 -0
  4. package/dist/cli-notionx.js +388 -0
  5. package/dist/cli-notionx.js.map +1 -0
  6. package/dist/cli-notionx.test.js +277 -0
  7. package/dist/cli-notionx.test.js.map +1 -0
  8. package/dist/diff.js +40 -0
  9. package/dist/diff.js.map +1 -0
  10. package/dist/diff.test.js +90 -0
  11. package/dist/diff.test.js.map +1 -0
  12. package/dist/index.js +99 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/locale-add/apply.js +39 -0
  15. package/dist/locale-add/apply.js.map +1 -0
  16. package/dist/locale-add/format.js +38 -0
  17. package/dist/locale-add/format.js.map +1 -0
  18. package/dist/locale-add/list.js +44 -0
  19. package/dist/locale-add/list.js.map +1 -0
  20. package/dist/locale-add/list.test.js +45 -0
  21. package/dist/locale-add/list.test.js.map +1 -0
  22. package/dist/locale-add/plan.js +128 -0
  23. package/dist/locale-add/plan.js.map +1 -0
  24. package/dist/locale-add/validate.js +46 -0
  25. package/dist/locale-add/validate.js.map +1 -0
  26. package/dist/metadata.js +41 -0
  27. package/dist/metadata.js.map +1 -0
  28. package/dist/notion-translation-sources/apply.js +61 -0
  29. package/dist/notion-translation-sources/apply.js.map +1 -0
  30. package/dist/notion-translation-sources/index.js +3 -0
  31. package/dist/notion-translation-sources/index.js.map +1 -0
  32. package/dist/notion-translation-sources/plan.js +33 -0
  33. package/dist/notion-translation-sources/plan.js.map +1 -0
  34. package/dist/notionx-source.js +142 -0
  35. package/dist/notionx-source.js.map +1 -0
  36. package/dist/notionx-source.test.js +144 -0
  37. package/dist/notionx-source.test.js.map +1 -0
  38. package/dist/password.js +18 -0
  39. package/dist/password.js.map +1 -0
  40. package/dist/presets.js +83 -0
  41. package/dist/presets.js.map +1 -0
  42. package/dist/presets.test.js +50 -0
  43. package/dist/presets.test.js.map +1 -0
  44. package/dist/prompt.js +218 -0
  45. package/dist/prompt.js.map +1 -0
  46. package/dist/provision/cloudflare.js +236 -0
  47. package/dist/provision/cloudflare.js.map +1 -0
  48. package/dist/provision/dependencies.js +219 -0
  49. package/dist/provision/dependencies.js.map +1 -0
  50. package/dist/provision/index.js +681 -0
  51. package/dist/provision/index.js.map +1 -0
  52. package/dist/provision/index.test.js +54 -0
  53. package/dist/provision/index.test.js.map +1 -0
  54. package/dist/provision/inspect.js +109 -0
  55. package/dist/provision/inspect.js.map +1 -0
  56. package/dist/provision/inspect.test.js +75 -0
  57. package/dist/provision/inspect.test.js.map +1 -0
  58. package/dist/provision/notion.js +1981 -0
  59. package/dist/provision/notion.js.map +1 -0
  60. package/dist/provision/notion.test.js +542 -0
  61. package/dist/provision/notion.test.js.map +1 -0
  62. package/dist/provision/ntn-credentials.js +198 -0
  63. package/dist/provision/ntn-credentials.js.map +1 -0
  64. package/dist/provision/options.js +15 -0
  65. package/dist/provision/options.js.map +1 -0
  66. package/dist/provision/password-hash.js +78 -0
  67. package/dist/provision/password-hash.js.map +1 -0
  68. package/dist/provision/prompts.js +115 -0
  69. package/dist/provision/prompts.js.map +1 -0
  70. package/dist/provision/repair.js +48 -0
  71. package/dist/provision/repair.js.map +1 -0
  72. package/dist/provision/repair.test.js +141 -0
  73. package/dist/provision/repair.test.js.map +1 -0
  74. package/dist/provision/shell.js +84 -0
  75. package/dist/provision/shell.js.map +1 -0
  76. package/dist/provision/wire.js +78 -0
  77. package/dist/provision/wire.js.map +1 -0
  78. package/dist/registry/doctor.js +181 -0
  79. package/dist/registry/doctor.js.map +1 -0
  80. package/dist/registry/doctor.test.js +180 -0
  81. package/dist/registry/doctor.test.js.map +1 -0
  82. package/dist/registry/install.js +217 -0
  83. package/dist/registry/install.js.map +1 -0
  84. package/dist/registry/install.test.js +168 -0
  85. package/dist/registry/install.test.js.map +1 -0
  86. package/dist/registry/load-registry.js +24 -0
  87. package/dist/registry/load-registry.js.map +1 -0
  88. package/dist/registry/load-registry.test.js +59 -0
  89. package/dist/registry/load-registry.test.js.map +1 -0
  90. package/dist/registry/migration-planner.js +204 -0
  91. package/dist/registry/migration-planner.js.map +1 -0
  92. package/dist/registry/migration-planner.test.js +340 -0
  93. package/dist/registry/migration-planner.test.js.map +1 -0
  94. package/dist/registry/migrations-store.js +125 -0
  95. package/dist/registry/migrations-store.js.map +1 -0
  96. package/dist/registry/migrations-store.test.js +163 -0
  97. package/dist/registry/migrations-store.test.js.map +1 -0
  98. package/dist/registry/migrations-types.js +25 -0
  99. package/dist/registry/migrations-types.js.map +1 -0
  100. package/dist/registry/project-meta.js +84 -0
  101. package/dist/registry/project-meta.js.map +1 -0
  102. package/dist/registry/registry-items.js +354 -0
  103. package/dist/registry/registry-items.js.map +1 -0
  104. package/dist/registry/registry-items.test.js +99 -0
  105. package/dist/registry/registry-items.test.js.map +1 -0
  106. package/dist/registry/registry-store.js +232 -0
  107. package/dist/registry/registry-store.js.map +1 -0
  108. package/dist/registry/registry-store.test.js +136 -0
  109. package/dist/registry/registry-store.test.js.map +1 -0
  110. package/dist/registry/registry-types.js +18 -0
  111. package/dist/registry/registry-types.js.map +1 -0
  112. package/dist/registry/registry-types.test.js +146 -0
  113. package/dist/registry/registry-types.test.js.map +1 -0
  114. package/dist/registry/render-content-source-files.js +158 -0
  115. package/dist/registry/render-content-source-files.js.map +1 -0
  116. package/dist/registry/render-multi-source.js +296 -0
  117. package/dist/registry/render-multi-source.js.map +1 -0
  118. package/dist/registry/render-multi-source.test.js +110 -0
  119. package/dist/registry/render-multi-source.test.js.map +1 -0
  120. package/dist/registry/text-utils.js +42 -0
  121. package/dist/registry/text-utils.js.map +1 -0
  122. package/dist/registry/uninstall.js +250 -0
  123. package/dist/registry/uninstall.js.map +1 -0
  124. package/dist/registry/uninstall.test.js +264 -0
  125. package/dist/registry/uninstall.test.js.map +1 -0
  126. package/dist/registry/update.js +280 -0
  127. package/dist/registry/update.js.map +1 -0
  128. package/dist/registry/update.test.js +229 -0
  129. package/dist/registry/update.test.js.map +1 -0
  130. package/dist/render.js +549 -0
  131. package/dist/render.js.map +1 -0
  132. package/dist/render.test.js +414 -0
  133. package/dist/render.test.js.map +1 -0
  134. package/dist/templates/.dev.vars.example.tmpl +32 -0
  135. package/dist/templates/.gitignore.tmpl +58 -0
  136. package/dist/templates/README.md.tmpl +417 -0
  137. package/dist/templates/app/[slug]/page.tsx.tmpl +55 -0
  138. package/dist/templates/app/admin/account/page.tsx.tmpl +18 -0
  139. package/dist/templates/app/admin/content-models/page.tsx.tmpl +6 -0
  140. package/dist/templates/app/admin/layout.tsx.tmpl +90 -0
  141. package/dist/templates/app/admin/loading.tsx.tmpl +6 -0
  142. package/dist/templates/app/admin/page.tsx.tmpl +17 -0
  143. package/dist/templates/app/api/auth/google/callback/route.ts.tmpl +3 -0
  144. package/dist/templates/app/api/auth/google/route.ts.tmpl +3 -0
  145. package/dist/templates/app/api/auth/verify-email/route.ts.tmpl +3 -0
  146. package/dist/templates/app/api/auth/viewer/route.ts.tmpl +3 -0
  147. package/dist/templates/app/api/health/route.ts.tmpl +3 -0
  148. package/dist/templates/app/api/{{contentSourceId}}/[slug]/route.ts.tmpl +27 -0
  149. package/dist/templates/app/api/{{contentSourceId}}/route.ts.tmpl +18 -0
  150. package/dist/templates/app/globals.css.tmpl +109 -0
  151. package/dist/templates/app/layout.tsx.tmpl +56 -0
  152. package/dist/templates/app/login/page.tsx.tmpl +154 -0
  153. package/dist/templates/app/page.fallback.tsx.tmpl +31 -0
  154. package/dist/templates/app/page.tsx.tmpl +42 -0
  155. package/dist/templates/app/register/page.tsx.tmpl +138 -0
  156. package/dist/templates/app/{{contentSourceListPath}}/[slug]/page.tsx.tmpl +113 -0
  157. package/dist/templates/app/{{contentSourceListPath}}/page.tsx.tmpl +74 -0
  158. package/dist/templates/components/content/post-card.tsx.tmpl +80 -0
  159. package/dist/templates/components/notion-blocks.tsx.tmpl +668 -0
  160. package/dist/templates/components/page-blocks/feature-grid-block.tsx.tmpl +68 -0
  161. package/dist/templates/components/page-blocks/hero-block.tsx.tmpl +73 -0
  162. package/dist/templates/components/page-blocks/latest-posts-block.tsx.tmpl +59 -0
  163. package/dist/templates/components/page-blocks/story-block.tsx.tmpl +70 -0
  164. package/dist/templates/components/page-blocks.fallback.tsx.tmpl +17 -0
  165. package/dist/templates/components/page-blocks.tsx.tmpl +32 -0
  166. package/dist/templates/components/search/search-dialog.tsx.tmpl +171 -0
  167. package/dist/templates/components/site/locale-switcher.tsx.tmpl +65 -0
  168. package/dist/templates/components/site/site-footer.tsx.tmpl +106 -0
  169. package/dist/templates/components/site/site-header.tsx.tmpl +80 -0
  170. package/dist/templates/components/site/site-shell.tsx.tmpl +20 -0
  171. package/dist/templates/components/site/theme-bootstrap.tsx.tmpl +51 -0
  172. package/dist/templates/components/theme-provider.tsx.tmpl +14 -0
  173. package/dist/templates/components/theme-toggle.tsx.tmpl +38 -0
  174. package/dist/templates/components/ui/accordion.tsx.tmpl +56 -0
  175. package/dist/templates/components/ui/alert.tsx.tmpl +59 -0
  176. package/dist/templates/components/ui/aspect-ratio.tsx.tmpl +8 -0
  177. package/dist/templates/components/ui/avatar.tsx.tmpl +44 -0
  178. package/dist/templates/components/ui/badge.tsx.tmpl +33 -0
  179. package/dist/templates/components/ui/button.tsx.tmpl +56 -0
  180. package/dist/templates/components/ui/card.tsx.tmpl +61 -0
  181. package/dist/templates/components/ui/checkbox.tsx.tmpl +28 -0
  182. package/dist/templates/components/ui/dialog.tsx.tmpl +104 -0
  183. package/dist/templates/components/ui/dropdown-menu.tsx.tmpl +183 -0
  184. package/dist/templates/components/ui/input.tsx.tmpl +21 -0
  185. package/dist/templates/components/ui/label.tsx.tmpl +25 -0
  186. package/dist/templates/components/ui/popover.tsx.tmpl +30 -0
  187. package/dist/templates/components/ui/radio-group.tsx.tmpl +44 -0
  188. package/dist/templates/components/ui/select.tsx.tmpl +150 -0
  189. package/dist/templates/components/ui/separator.tsx.tmpl +30 -0
  190. package/dist/templates/components/ui/sheet.tsx.tmpl +125 -0
  191. package/dist/templates/components/ui/skeleton.tsx.tmpl +15 -0
  192. package/dist/templates/components/ui/sonner.tsx.tmpl +30 -0
  193. package/dist/templates/components/ui/switch.tsx.tmpl +29 -0
  194. package/dist/templates/components/ui/table.tsx.tmpl +107 -0
  195. package/dist/templates/components/ui/tabs.tsx.tmpl +55 -0
  196. package/dist/templates/components/ui/textarea.tsx.tmpl +24 -0
  197. package/dist/templates/components/ui/tooltip.tsx.tmpl +30 -0
  198. package/dist/templates/components.json.tmpl +21 -0
  199. package/dist/templates/env.d.ts.tmpl +32 -0
  200. package/dist/templates/lib/admin/actions.ts.tmpl +43 -0
  201. package/dist/templates/lib/admin/context.tsx.tmpl +209 -0
  202. package/dist/templates/lib/admin/nav.ts.tmpl +23 -0
  203. package/dist/templates/lib/auth.config.fallback.ts.tmpl +10 -0
  204. package/dist/templates/lib/auth.config.ts.tmpl +45 -0
  205. package/dist/templates/lib/blocks/translations.ts.tmpl +44 -0
  206. package/dist/templates/lib/blog/translations.ts.tmpl +52 -0
  207. package/dist/templates/lib/content/models.ts.tmpl +53 -0
  208. package/dist/templates/lib/i18n/config.ts.tmpl +18 -0
  209. package/dist/templates/lib/i18n/index.ts.tmpl +1 -0
  210. package/dist/templates/lib/locale-contract/built-in.ts.tmpl +19 -0
  211. package/dist/templates/lib/locale-contract/index.ts.tmpl +3 -0
  212. package/dist/templates/lib/locale-contract/paths.ts.tmpl +29 -0
  213. package/dist/templates/lib/pages/model.ts.tmpl +16 -0
  214. package/dist/templates/lib/pages/source.ts.tmpl +566 -0
  215. package/dist/templates/lib/pages/translations.ts.tmpl +34 -0
  216. package/dist/templates/lib/search/config.fallback.ts.tmpl +11 -0
  217. package/dist/templates/lib/search/config.ts.tmpl +25 -0
  218. package/dist/templates/lib/site/config.ts.tmpl +120 -0
  219. package/dist/templates/lib/site/request-env.ts.tmpl +71 -0
  220. package/dist/templates/lib/site/settings.fallback.ts.tmpl +21 -0
  221. package/dist/templates/lib/site/settings.ts.tmpl +320 -0
  222. package/dist/templates/lib/site/translations.ts.tmpl +30 -0
  223. package/dist/templates/lib/utils.ts.tmpl +9 -0
  224. package/dist/templates/migrations/0001_init.sql.tmpl +57 -0
  225. package/dist/templates/migrations/0002_admin_seed.sql.tmpl +30 -0
  226. package/dist/templates/migrations/0003_search_index.sql.tmpl +29 -0
  227. package/dist/templates/next.config.ts.tmpl +18 -0
  228. package/dist/templates/package.json.tmpl +40 -0
  229. package/dist/templates/shims/cloudflare-workers-empty.mjs +4 -0
  230. package/dist/templates/shims/next-headers-empty.mjs +4 -0
  231. package/dist/templates/tests/smoke.test.ts.tmpl +83 -0
  232. package/dist/templates/tsconfig.json.tmpl +31 -0
  233. package/dist/templates/vite.config.ts.tmpl +53 -0
  234. package/dist/templates/vitest.config.ts.tmpl +13 -0
  235. package/dist/templates/worker/index.ts.tmpl +52 -0
  236. package/dist/templates/wrangler.jsonc.tmpl +44 -0
  237. package/dist/ui-presets.js +60 -0
  238. package/dist/ui-presets.js.map +1 -0
  239. package/package.json +60 -0
@@ -0,0 +1,204 @@
1
+ // packages/create-notionx-app/src/registry/migration-planner.ts
2
+ //
3
+ // Convert catalog `RegistryItem.migrations` into a sequenced
4
+ // `UpdatePlan` that the CLI can show, then turn into files.
5
+ //
6
+ // The planner is **pure**: it does no I/O, takes the catalog + the
7
+ // installed manifest as inputs, and returns a plan. That makes
8
+ // it easy to test the bookkeeping (idempotency, downgrade
9
+ // detection, version-chain selection) without touching the file
10
+ // system.
11
+ /**
12
+ * Look up the migration chain (a sequence of `from`/`to` hops)
13
+ * that the planner is walking. Each hop is recorded as
14
+ * `<itemId> <fromV>-><toV>` in the applied migration's `label`
15
+ * (e.g. `blog 1->2`). The chain is a map from item id to the
16
+ * list of `fromV->toV` strings the user has already applied.
17
+ */
18
+ function indexAppliedChains(applied) {
19
+ const out = new Map();
20
+ for (const m of applied) {
21
+ if (!m.label)
22
+ continue;
23
+ // Convention: `<itemId> <fromV>-><toV>`.
24
+ const match = m.label.match(/^(.+)\s+(\d+)->(\d+)$/);
25
+ if (!match)
26
+ continue;
27
+ const [, itemId, fromV, toV] = match;
28
+ if (!itemId || !fromV || !toV)
29
+ continue;
30
+ const key = itemId;
31
+ let set = out.get(key);
32
+ if (!set) {
33
+ set = new Set();
34
+ out.set(key, set);
35
+ }
36
+ set.add(`${fromV}->${toV}`);
37
+ }
38
+ return out;
39
+ }
40
+ /**
41
+ * Walk the catalog and the installed manifest, producing an
42
+ * `UpdatePlan` of every step that needs to run to bring
43
+ * `installed` up to date with `catalogItems`.
44
+ *
45
+ * What the planner does **not** do:
46
+ * - I/O. No file writes. The writer (`update.ts`) handles that.
47
+ * - Apply migrations itself. It just describes them.
48
+ * - Run codemods. Codemods are listed under `codemodTargets` and
49
+ * re-rendered as a hint to the user (and consumed by the
50
+ * writer).
51
+ */
52
+ export function buildUpdatePlan(input) {
53
+ const plan = {
54
+ additive: [],
55
+ destructive: [],
56
+ noop: [],
57
+ renderedFiles: [],
58
+ codemodTargets: [],
59
+ };
60
+ const appliedChains = indexAppliedChains(input.appliedMigrations);
61
+ for (const item of input.installed) {
62
+ const catalog = input.catalogItems.find((c) => c.id === item.id);
63
+ if (!catalog)
64
+ continue; // unknown / third-party item
65
+ if (catalog.version < item.version) {
66
+ // Catalog is behind the project — never auto-downgrade.
67
+ continue;
68
+ }
69
+ if (catalog.version === item.version) {
70
+ // Up to date. Skip.
71
+ continue;
72
+ }
73
+ // Find the **single hop** that starts at the project's
74
+ // currently-installed version. We do *not* walk a multi-hop
75
+ // chain here — each RegistryItem.migrations entry is one
76
+ // hop, and the catalog author is expected to provide a
77
+ // cumulative `from: "<id>@<currentV>", to: "<id>@<newV>"`
78
+ // migration that bundles every step needed.
79
+ //
80
+ // After the user applies the hop, the next `notionx update`
81
+ // call picks up the next one. This keeps each migration
82
+ // independently testable + reversible.
83
+ const hop = catalog.migrations.find((m) => {
84
+ const fromV = parseInt(m.from.split("@")[1] ?? "", 10);
85
+ return fromV === item.version;
86
+ });
87
+ if (!hop)
88
+ continue;
89
+ const toV = parseInt(hop.to.split("@")[1] ?? "", 10);
90
+ if (Number.isNaN(toV) || toV <= item.version)
91
+ continue;
92
+ const hopApplied = appliedChains.get(item.id)?.has(`${item.version}->${toV}`) ?? false;
93
+ for (const step of hop.steps) {
94
+ const planStep = toPlannedStep(item, step);
95
+ if (!planStep)
96
+ continue;
97
+ if (hopApplied) {
98
+ plan.noop.push(planStep);
99
+ continue;
100
+ }
101
+ if (isDestructiveStep(planStep)) {
102
+ plan.destructive.push(planStep);
103
+ }
104
+ else {
105
+ plan.additive.push(planStep);
106
+ }
107
+ if (planStep.kind === "ts-codemod") {
108
+ plan.codemodTargets.push(...planStep.targets);
109
+ }
110
+ }
111
+ }
112
+ return plan;
113
+ }
114
+ function parseInt(s, radix) {
115
+ return globalThis.parseInt(s, radix);
116
+ }
117
+ function toPlannedStep(item, step) {
118
+ switch (step.kind) {
119
+ case "notion-field-add":
120
+ return {
121
+ kind: "notion-field-add",
122
+ itemId: item.id,
123
+ dataSourceEnv: step.source,
124
+ property: step.property,
125
+ type: step.type,
126
+ };
127
+ case "notion-field-rename":
128
+ return {
129
+ kind: "notion-field-rename",
130
+ itemId: item.id,
131
+ dataSourceEnv: step.source,
132
+ from: step.from,
133
+ to: step.to,
134
+ };
135
+ case "notion-field-deprecate":
136
+ return {
137
+ kind: "notion-field-deprecate",
138
+ itemId: item.id,
139
+ dataSourceEnv: step.source,
140
+ property: step.property,
141
+ ...(step.fallback !== undefined
142
+ ? { fallback: step.fallback }
143
+ : {}),
144
+ };
145
+ case "d1-table-create":
146
+ return {
147
+ kind: "d1-table-create",
148
+ itemId: item.id,
149
+ tableName: step.name,
150
+ sql: step.sql,
151
+ };
152
+ case "d1-table-alter":
153
+ return {
154
+ kind: "d1-table-alter",
155
+ itemId: item.id,
156
+ tableName: step.name,
157
+ sql: step.sql,
158
+ };
159
+ case "ts-codemod":
160
+ return {
161
+ kind: "ts-codemod",
162
+ itemId: item.id,
163
+ transform: step.transform,
164
+ targets: [step.file],
165
+ };
166
+ case "env-add":
167
+ return {
168
+ kind: "env-add",
169
+ itemId: item.id,
170
+ name: step.name,
171
+ ...(step.default !== undefined ? { default: step.default } : {}),
172
+ ...(step.secret !== undefined ? { secret: step.secret } : {}),
173
+ };
174
+ case "config-merge":
175
+ return {
176
+ kind: "config-merge",
177
+ itemId: item.id,
178
+ file: step.file,
179
+ json: step.json,
180
+ };
181
+ case "d1-migration-file":
182
+ return {
183
+ kind: "d1-migration-file",
184
+ itemId: item.id,
185
+ file: step.file,
186
+ };
187
+ }
188
+ }
189
+ function isDestructiveStep(step) {
190
+ switch (step.kind) {
191
+ case "notion-field-rename":
192
+ case "notion-field-deprecate":
193
+ case "d1-table-alter":
194
+ return true;
195
+ case "notion-field-add":
196
+ case "d1-table-create":
197
+ case "ts-codemod":
198
+ case "env-add":
199
+ case "config-merge":
200
+ case "d1-migration-file":
201
+ return false;
202
+ }
203
+ }
204
+ //# sourceMappingURL=migration-planner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-planner.js","sourceRoot":"","sources":["../../src/registry/migration-planner.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,EAAE;AACF,6DAA6D;AAC7D,4DAA4D;AAC5D,EAAE;AACF,mEAAmE;AACnE,+DAA+D;AAC/D,0DAA0D;AAC1D,gEAAgE;AAChE,UAAU;AAuBV;;;;;;GAMG;AACH,SAAS,kBAAkB,CACzB,OAAoC;IAEpC,MAAM,GAAG,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC3C,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC,CAAC,CAAC,KAAK;YAAE,SAAS;QACvB,yCAAyC;QACzC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;QACrD,IAAI,CAAC,KAAK;YA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IAAI,EAAE,IAAI,CAAC,IAAI;aAChB,CAAC;QACJ,KAAK,mBAAmB;YACtB,OAAO;gBACL,IAAI,EAAE,mBAAmB;gBACzB,MAAM,EAAE,IAAI,CAAC,EAAE;gBACf,IAAI,EAAE,IAAI,CAAC,IAAI;aAChB,CAAC;IACN,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,IAA0B;IACnD,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,qBAAqB,CAAC;QAC3B,KAAK,wBAAwB,CAAC;QAC9B,KAAK,gBAAgB;YACnB,OAAO,IAAI,CAAC;QACd,KAAK,kBAAkB,CAAC;QACxB,KAAK,iBAAiB,CAAC;QACvB,KAAK,YAAY,CAAC;QAClB,KAAK,SAAS,CAAC;QACf,KAAK,cAAc,CAAC;QACpB,KAAK,mBAAmB;YACtB,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC"}
@@ -0,0 +1,340 @@
1
+ // packages/create-notionx-app/src/registry/migration-planner.test.ts
2
+ import { describe, expect, it } from "vitest";
3
+ import { buildUpdatePlan } from "./migration-planner.js";
4
+ const OFFICIAL = {
5
+ kind: "official",
6
+ name: "@notionx/official",
7
+ };
8
+ function installedItem(id, version) {
9
+ return {
10
+ id,
11
+ kind: "content-source",
12
+ version,
13
+ source: OFFICIAL,
14
+ params: { contentSourceId: id },
15
+ installedAt: "2026-06-10T00:00:00.000Z",
16
+ };
17
+ }
18
+ function blogV2() {
19
+ return {
20
+ id: "blog",
21
+ kind: "content-source",
22
+ version: 2,
23
+ source: OFFICIAL,
24
+ publishedAt: "2026-06-15T00:00:00.000Z",
25
+ params: { contentSourceId: "blog" },
26
+ files: [],
27
+ capabilities: { envVars: ["NOTION_BLOG_DATA_SOURCE_ID"] },
28
+ migrations: [
29
+ {
30
+ from: "blog@1",
31
+ to: "blog@2",
32
+ steps: [
33
+ {
34
+ kind: "notion-field-add",
35
+ source: "NOTION_BLOG_DATA_SOURCE_ID",
36
+ property: "Author",
37
+ type: "people",
38
+ },
39
+ {
40
+ kind: "notion-field-rename",
41
+ source: "NOTION_BLOG_DATA_SOURCE_ID",
42
+ from: "Eyebrow",
43
+ to: "Subheadline",
44
+ },
45
+ ],
46
+ },
47
+ ],
48
+ };
49
+ }
50
+ describe("buildUpdatePlan", () => {
51
+ it("returns an empty plan when the installed version equals the catalog version", () => {
52
+ const plan = buildUpdatePlan({
53
+ installed: [installedItem("blog", 2)],
54
+ catalogItems: [blogV2()],
55
+ appliedMigrations: [],
56
+ });
57
+ expect(plan.additive).toEqual([]);
58
+ expect(plan.destructive).toEqual([]);
59
+ expect(plan.noop).toEqual([]);
60
+ });
61
+ it("classifies notion-field-add as additive (safe, no data loss)", () => {
62
+ const plan = buildUpdatePlan({
63
+ installed: [installedItem("blog", 1)],
64
+ catalogItems: [blogV2()],
65
+ appliedMigrations: [],
66
+ });
67
+ const add = plan.additive.find((s) => s.kind === "notion-field-add");
68
+ expect(add).toMatchObject({
69
+ kind: "notion-field-add",
70
+ itemId: "blog",
71
+ dataSourceEnv: "NOTION_BLOG_DATA_SOURCE_ID",
72
+ property: "Author",
73
+ type: "people",
74
+ });
75
+ // The destructive bucket contains the rename — that's a
76
+ // *separate* step. The test only checks add isn't in
77
+ // destructive.
78
+ expect(plan.destructive.find((s) => s.kind === "notion-field-add")).toBeUndefined();
79
+ });
80
+ it("classifies notion-field-rename as destructive (could lose data if it aliases to a wrong prop)", () => {
81
+ const plan = buildUpdatePlan({
82
+ installed: [installedItem("blog", 1)],
83
+ catalogItems: [blogV2()],
84
+ appliedMigrations: [],
85
+ });
86
+ const rename = plan.destructive.find((s) => s.kind === "notion-field-rename");
87
+ expect(rename).toMatchObject({
88
+ kind: "notion-field-rename",
89
+ from: "Eyebrow",
90
+ to: "Subheadline",
91
+ });
92
+ });
93
+ it("skips steps whose migration is already in appliedMigrations (idempotent)", () => {
94
+ const applied = [
95
+ {
96
+ sequence: "0001",
97
+ itemId: "blog",
98
+ itemKind: "content-source",
99
+ label: "blog 1->2",
100
+ file: { kind: "notion-diff", filename: "0001_blog.notion-diff.json" },
101
+ generatedAt: "2026-06-15T00:00:00.000Z",
102
+ applied: true,
103
+ appliedAt: "2026-06-15T01:00:00.000Z",
104
+ },
105
+ ];
106
+ const plan = buildUpdatePlan({
107
+ installed: [installedItem("blog", 1)],
108
+ catalogItems: [blogV2()],
109
+ appliedMigrations: applied,
110
+ });
111
+ expect(plan.additive).toEqual([]);
112
+ expect(plan.destructive).toEqual([]);
113
+ expect(plan.noop.length).toBeGreaterThanOrEqual(2);
114
+ });
115
+ it("skips items the catalog does not know about (third-party items)", () => {
116
+ const plan = buildUpdatePlan({
117
+ installed: [installedItem("custom-team-source", 1)],
118
+ catalogItems: [blogV2()],
119
+ appliedMigrations: [],
120
+ });
121
+ expect(plan.additive).toEqual([]);
122
+ expect(plan.destructive).toEqual([]);
123
+ });
124
+ it("only emits migrations for the installed version, not for future versions", () => {
125
+ // v1 installed, v3 in catalog. There's no v1->v2->v3 chain
126
+ // expressed in the catalog, so the planner should only emit
127
+ // v1->v2.
128
+ const blogV3 = {
129
+ ...blogV2(),
130
+ version: 3,
131
+ migrations: [
132
+ {
133
+ from: "blog@1",
134
+ to: "blog@2",
135
+ steps: [
136
+ {
137
+ kind: "notion-field-add",
138
+ source: "NOTION_BLOG_DATA_SOURCE_ID",
139
+ property: "Author",
140
+ type: "people",
141
+ },
142
+ ],
143
+ },
144
+ {
145
+ from: "blog@2",
146
+ to: "blog@3",
147
+ steps: [
148
+ {
149
+ kind: "d1-table-create",
150
+ name: "blog_authors",
151
+ sql: "CREATE TABLE blog_authors (id INTEGER PRIMARY KEY);",
152
+ },
153
+ ],
154
+ },
155
+ ],
156
+ };
157
+ const plan = buildUpdatePlan({
158
+ installed: [installedItem("blog", 1)],
159
+ catalogItems: [blogV3],
160
+ appliedMigrations: [],
161
+ });
162
+ // We only get v1->v2 in the plan; v2->v3 is not yet reachable.
163
+ expect(plan.additive.length).toBe(1);
164
+ expect(plan.additive[0]).toMatchObject({
165
+ kind: "notion-field-add",
166
+ property: "Author",
167
+ });
168
+ });
169
+ it("returns an empty plan when the installed version is *newer* than the catalog (downgrade blocked)", () => {
170
+ const plan = buildUpdatePlan({
171
+ installed: [installedItem("blog", 5)],
172
+ catalogItems: [blogV2()], // catalog only has v2
173
+ appliedMigrations: [],
174
+ });
175
+ expect(plan.additive).toEqual([]);
176
+ expect(plan.destructive).toEqual([]);
177
+ });
178
+ });
179
+ describe("buildUpdatePlan: codemod support", () => {
180
+ it("includes ts-codemod steps in the additive bucket", () => {
181
+ const item = {
182
+ id: "blog",
183
+ kind: "content-source",
184
+ version: 2,
185
+ source: OFFICIAL,
186
+ publishedAt: "2026-06-15T00:00:00.000Z",
187
+ params: { contentSourceId: "blog" },
188
+ files: [],
189
+ capabilities: {},
190
+ migrations: [
191
+ {
192
+ from: "blog@1",
193
+ to: "blog@2",
194
+ steps: [
195
+ {
196
+ kind: "ts-codemod",
197
+ file: "app/blog/page.tsx",
198
+ transform: "rename-eyebrow-to-subheadline",
199
+ },
200
+ ],
201
+ },
202
+ ],
203
+ };
204
+ const plan = buildUpdatePlan({
205
+ installed: [installedItem("blog", 1)],
206
+ catalogItems: [item],
207
+ appliedMigrations: [],
208
+ });
209
+ expect(plan.additive).toEqual([
210
+ {
211
+ kind: "ts-codemod",
212
+ itemId: "blog",
213
+ transform: "rename-eyebrow-to-subheadline",
214
+ targets: ["app/blog/page.tsx"],
215
+ },
216
+ ]);
217
+ expect(plan.codemodTargets).toEqual(["app/blog/page.tsx"]);
218
+ });
219
+ });
220
+ describe("buildUpdatePlan: env-add / config-merge / d1-migration-file", () => {
221
+ it("classifies env-add as additive and forwards name/default/secret", () => {
222
+ const item = {
223
+ id: "blog",
224
+ kind: "content-source",
225
+ version: 2,
226
+ source: OFFICIAL,
227
+ publishedAt: "2026-06-15T00:00:00.000Z",
228
+ params: { contentSourceId: "blog" },
229
+ files: [],
230
+ capabilities: {},
231
+ migrations: [
232
+ {
233
+ from: "blog@1",
234
+ to: "blog@2",
235
+ steps: [
236
+ {
237
+ kind: "env-add",
238
+ name: "BLOG_SEARCH_INDEX_KEY",
239
+ default: "dev-key",
240
+ secret: true,
241
+ },
242
+ ],
243
+ },
244
+ ],
245
+ };
246
+ const plan = buildUpdatePlan({
247
+ installed: [installedItem("blog", 1)],
248
+ catalogItems: [item],
249
+ appliedMigrations: [],
250
+ });
251
+ expect(plan.additive).toEqual([
252
+ {
253
+ kind: "env-add",
254
+ itemId: "blog",
255
+ name: "BLOG_SEARCH_INDEX_KEY",
256
+ default: "dev-key",
257
+ secret: true,
258
+ },
259
+ ]);
260
+ expect(plan.destructive).toEqual([]);
261
+ });
262
+ it("classifies config-merge as additive and forwards file/json", () => {
263
+ const mergeJson = { compatibility_date: "2026-07-01" };
264
+ const item = {
265
+ id: "blog",
266
+ kind: "content-source",
267
+ version: 2,
268
+ source: OFFICIAL,
269
+ publishedAt: "2026-06-15T00:00:00.000Z",
270
+ params: { contentSourceId: "blog" },
271
+ files: [],
272
+ capabilities: {},
273
+ migrations: [
274
+ {
275
+ from: "blog@1",
276
+ to: "blog@2",
277
+ steps: [
278
+ {
279
+ kind: "config-merge",
280
+ file: "wrangler.jsonc",
281
+ json: mergeJson,
282
+ },
283
+ ],
284
+ },
285
+ ],
286
+ };
287
+ const plan = buildUpdatePlan({
288
+ installed: [installedItem("blog", 1)],
289
+ catalogItems: [item],
290
+ appliedMigrations: [],
291
+ });
292
+ expect(plan.additive).toEqual([
293
+ {
294
+ kind: "config-merge",
295
+ itemId: "blog",
296
+ file: "wrangler.jsonc",
297
+ json: mergeJson,
298
+ },
299
+ ]);
300
+ expect(plan.destructive).toEqual([]);
301
+ });
302
+ it("classifies d1-migration-file as additive and forwards file", () => {
303
+ const item = {
304
+ id: "blog",
305
+ kind: "content-source",
306
+ version: 2,
307
+ source: OFFICIAL,
308
+ publishedAt: "2026-06-15T00:00:00.000Z",
309
+ params: { contentSourceId: "blog" },
310
+ files: [],
311
+ capabilities: {},
312
+ migrations: [
313
+ {
314
+ from: "blog@1",
315
+ to: "blog@2",
316
+ steps: [
317
+ {
318
+ kind: "d1-migration-file",
319
+ file: "migrations/0002_add_blog_indexes.sql",
320
+ },
321
+ ],
322
+ },
323
+ ],
324
+ };
325
+ const plan = buildUpdatePlan({
326
+ installed: [installedItem("blog", 1)],
327
+ catalogItems: [item],
328
+ appliedMigrations: [],
329
+ });
330
+ expect(plan.additive).toEqual([
331
+ {
332
+ kind: "d1-migration-file",
333
+ itemId: "blog",
334
+ file: "migrations/0002_add_blog_indexes.sql",
335
+ },
336
+ ]);
337
+ expect(plan.destructive).toEqual([]);
338
+ });
339
+ });
340
+ //# sourceMappingURL=migration-planner.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-planner.test.js","sourceRoot":"","sources":["../../src/registry/migration-planner.test.ts"],"names":[],"mappings":"AAAA,qEAAqE;AAErE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAQzD,MAAM,QAAQ,GAA2B;IACvC,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,mBAAmB;CAC1B,CAAC;AAEF,SAAS,aAAa,CACpB,EAAU,EACV,OAAe;IAEf,OAAO;QACL,EAAE;QACF,IAAI,EAAE,gBAAgB;QACtB,OAAO;QACP,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE;QAC/B,WAAW,EAAE,0BAA0B;KACxC,CAAC;AACJ,CAAC;AAED,SAAS,MAAM;IACb,OAAO;QACL,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,QAAQ;QAChB,WAAW,EAAE,0BAA0B;QACvC,MAAM,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE;QACnC,KAAK,EAAE,EAAE;QACT,YAAY,EA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