@jant/core 0.7.0 → 0.7.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.
- package/bin/commands/export.js +3 -1
- package/bin/commands/import-site.js +689 -216
- package/bin/commands/setup.js +136 -0
- package/bin/commands/site/export.js +71 -34
- package/bin/commands/site/pull-media.js +2 -6
- package/bin/commands/site/snapshot/export.js +18 -60
- package/bin/commands/site/snapshot/import.js +22 -23
- package/bin/lib/d1-query.js +87 -2
- package/bin/lib/hugo-markdown.js +4 -0
- package/bin/lib/site-pull-media.js +21 -28
- package/bin/lib/site-selection.js +10 -1
- package/bin/lib/site-snapshot.js +338 -3
- package/bin/lib/sql-export.js +68 -5
- package/bin/lib/wrangler-cli.js +9 -0
- package/bin/lib/zip-archive.js +187 -0
- package/dist/{app-K_Aa1MMn.js → app-ZcaI1kPN.js} +732 -217
- package/dist/client/.vite/manifest.json +20 -20
- package/dist/client/_assets/chunks/{create-editor-CD3FhrOB.js → create-editor-B-m7X7S5.js} +50 -46
- package/dist/client/_assets/chunks/{sortable-list-CgaL2jCs.js → sortable-list-BJyd-LXE.js} +1 -1
- package/dist/client/_assets/chunks/{unsafe-svg-0QCkP0vZ.js → unsafe-svg-BkscJx69.js} +2 -2
- package/dist/client/_assets/{client-GiYENVw8.css → client-DAhoqPdr.css} +1 -1
- package/dist/client/_assets/{client-auth-k8gJ6QJj.js → client-auth-CAMfTrKW.js} +1 -1
- package/dist/client/_assets/{client-compose-B_kDtWkW.js → client-compose-D6rExKVK.js} +1 -1
- package/dist/client/_assets/{client-VnFxJN7G.js → client-knSEyUJO.js} +1 -1
- package/dist/client/_assets/{client-manage-M90aSTOk.js → client-manage-sVOkqVbH.js} +1 -1
- package/dist/client/_assets/{client-settings-DfYs9n1F.js → client-settings-CGR_nZ78.js} +7 -7
- package/dist/{github-sync-BPAvT999.js → github-sync-Gw4orAHk.js} +799 -110
- package/dist/index.js +2 -2
- package/dist/node.js +9 -5
- package/package.json +13 -3
- package/src/__tests__/dev-scripts.test.ts +203 -0
- package/src/__tests__/export-collection-order.test.ts +276 -0
- package/src/__tests__/export-feed-ids.test.ts +184 -0
- package/src/__tests__/export-feed-order.test.ts +294 -0
- package/src/__tests__/export-hugo-build.test.ts +130 -0
- package/src/__tests__/export-import-roundtrip.test.ts +94 -0
- package/src/__tests__/export-service.test.ts +611 -28
- package/src/__tests__/export-smart-collection.test.ts +329 -0
- package/src/__tests__/helpers/hugo-site.ts +146 -0
- package/src/__tests__/import-site-command.test.ts +487 -1
- package/src/__tests__/mise-config.test.ts +75 -4
- package/src/__tests__/node-dev-tasks.test.ts +264 -0
- package/src/__tests__/site-export-canonical-import.test.ts +149 -0
- package/src/__tests__/snapshot-canonical-replay.test.ts +179 -0
- package/src/__tests__/snapshot-settings.test.ts +97 -0
- package/src/__tests__/snapshot-tables.test.ts +219 -0
- package/src/__tests__/sql-export.test.ts +173 -0
- package/src/__tests__/zip-archive.test.ts +106 -0
- package/src/app.tsx +15 -6
- package/src/client/components/__tests__/jant-settings-avatar.test.ts +1 -1
- package/src/client/components/__tests__/jant-settings-general.test.ts +21 -1
- package/src/client/components/jant-repo-picker-types.ts +6 -1
- package/src/client/components/jant-repo-picker.ts +4 -7
- package/src/client/components/jant-settings-general.ts +17 -12
- package/src/client/tiptap/__tests__/list-editing.test.ts +224 -86
- package/src/client/tiptap/__tests__/mark-exit.test.ts +1 -2
- package/src/client/tiptap/__tests__/markdown-clipboard.test.ts +26 -0
- package/src/client/tiptap/extensions.ts +0 -3
- package/src/client/tiptap/structural-keymap.ts +158 -47
- package/src/db/__tests__/d1-query.test.ts +56 -1
- package/src/i18n/locales/settings/en.po +8 -8
- package/src/i18n/locales/settings/en.ts +1 -1
- package/src/i18n/locales/settings/zh-Hans.po +8 -8
- package/src/i18n/locales/settings/zh-Hans.ts +1 -1
- package/src/i18n/locales/settings/zh-Hant.po +8 -8
- package/src/i18n/locales/settings/zh-Hant.ts +1 -1
- package/src/lib/__tests__/github-sync-repo-name.test.ts +40 -0
- package/src/lib/__tests__/image.test.ts +27 -1
- package/src/lib/__tests__/markdown-to-tiptap.test.ts +105 -0
- package/src/lib/__tests__/markdown.test.ts +10 -0
- package/src/lib/__tests__/resolve-config.test.ts +67 -0
- package/src/lib/__tests__/schemas.test.ts +27 -1
- package/src/lib/__tests__/timeline.test.ts +87 -0
- package/src/lib/__tests__/tiptap-to-markdown.test.ts +172 -4
- package/src/lib/discover.ts +3 -1
- package/src/lib/github-sync-repo-name.ts +45 -0
- package/src/lib/hugo-markdown.ts +46 -0
- package/src/lib/image.ts +17 -4
- package/src/lib/markdown-manager.ts +392 -2
- package/src/lib/post-body-html.ts +11 -4
- package/src/lib/resolve-config.ts +58 -1
- package/src/lib/schemas.ts +50 -5
- package/src/lib/thread-fold.ts +3 -3
- package/src/lib/timeline.ts +1 -1
- package/src/lib/tiptap-to-markdown.ts +13 -7
- package/src/lib/url.ts +20 -0
- package/src/lib/view.ts +2 -2
- package/src/node/__tests__/cli-setup.test.ts +163 -0
- package/src/node/__tests__/cli-site-snapshot.test.ts +67 -0
- package/src/node/__tests__/cli-snapshot-meta.test.ts +20 -0
- package/src/node/__tests__/runtime.test.ts +38 -0
- package/src/node/index.ts +2 -0
- package/src/node/request-handler.ts +3 -1
- package/src/routes/api/__tests__/posts.test.ts +24 -0
- package/src/routes/api/__tests__/upload.test.ts +34 -0
- package/src/routes/api/export.ts +3 -3
- package/src/routes/api/internal/sites.ts +0 -1
- package/src/routes/api/posts.ts +2 -0
- package/src/routes/api/public/posts.ts +21 -1
- package/src/routes/api/upload.ts +10 -3
- package/src/routes/compose.tsx +4 -0
- package/src/routes/dash/__tests__/github-sync-app.test.ts +365 -0
- package/src/routes/dash/settings.tsx +212 -70
- package/src/routes/pages/__tests__/post-page-round-trips.test.ts +211 -0
- package/src/routes/pages/__tests__/thread-order.test.ts +179 -0
- package/src/routes/pages/archive.tsx +17 -11
- package/src/routes/pages/featured.tsx +11 -5
- package/src/routes/pages/page.tsx +53 -31
- package/src/routes/pages/search.tsx +4 -2
- package/src/runtime/__tests__/readiness.test.ts +23 -0
- package/src/runtime/node.ts +49 -0
- package/src/runtime/readiness.ts +15 -0
- package/src/services/__tests__/bootstrap-setup-instance.test.ts +230 -0
- package/src/services/__tests__/custom-url.test.ts +34 -0
- package/src/services/__tests__/github-app-installations.test.ts +153 -0
- package/src/services/__tests__/github-sync-push.test.ts +46 -0
- package/src/services/__tests__/media.test.ts +31 -0
- package/src/services/__tests__/path.test.ts +56 -0
- package/src/services/__tests__/post-timeline.test.ts +127 -0
- package/src/services/__tests__/post.test.ts +74 -0
- package/src/services/bootstrap.ts +263 -44
- package/src/services/custom-url.ts +2 -2
- package/src/services/export-theme/layouts/_default/alias.html +27 -1
- package/src/services/export-theme/layouts/_default/list.html +2 -63
- package/src/services/export-theme/layouts/_default/rss.xml +27 -38
- package/src/services/export-theme/layouts/collections/list.html +3 -3
- package/src/services/export-theme/layouts/featured/list.html +1 -4
- package/src/services/export-theme/layouts/index.html +40 -26
- package/src/services/export-theme/layouts/partials/collection-members.html +100 -0
- package/src/services/export-theme/layouts/partials/collection-threads.html +33 -0
- package/src/services/export-theme/layouts/partials/featured-members.html +35 -0
- package/src/services/export-theme/layouts/partials/featured-thread.html +1 -1
- package/src/services/export-theme/layouts/partials/footer.html +1 -1
- package/src/services/export-theme/layouts/partials/head.html +1 -1
- package/src/services/export-theme/layouts/partials/header.html +5 -3
- package/src/services/export-theme/layouts/partials/jant-data.html +23 -0
- package/src/services/export-theme/layouts/partials/latest-members.html +48 -0
- package/src/services/export-theme/layouts/partials/smart-collection-members.html +129 -0
- package/src/services/export-theme/layouts/partials/thread-preview.html +1 -1
- package/src/services/export-theme/layouts/post/list.html +1 -1
- package/src/services/export-theme/layouts/smart_collection/list.html +24 -0
- package/src/services/export-theme/styles/main.css +0 -1
- package/src/services/export-theme/theme.toml +1 -1
- package/src/services/export.ts +620 -71
- package/src/services/github-app-installations.ts +171 -4
- package/src/services/github-sync.ts +69 -15
- package/src/services/mcp.ts +19 -1
- package/src/services/media.ts +8 -1
- package/src/services/path.ts +34 -1
- package/src/services/post.ts +214 -39
- package/src/services/site-admin.ts +3 -7
- package/src/services/site.ts +83 -31
- package/src/styles/ui.css +7 -1
- package/src/types/app-context.ts +16 -0
- package/src/types/bindings.ts +5 -0
- package/src/types/operations.ts +10 -0
- package/src/ui/dash/settings/GeneralContent.tsx +10 -8
- package/src/client/tiptap/exitable-marks.ts +0 -73
|
@@ -53,6 +53,7 @@ function buildRoundtripServices(opts: {
|
|
|
53
53
|
},
|
|
54
54
|
paths: {
|
|
55
55
|
getPostSlugMap: async () => slugMap,
|
|
56
|
+
listStandalonePaths: async () => [],
|
|
56
57
|
getPostAliases: async () => opts.aliasMap ?? new Map(),
|
|
57
58
|
getCollectionSlugMap: async () => collectionSlugMap,
|
|
58
59
|
},
|
|
@@ -264,4 +265,97 @@ describe("export → import round-trip", () => {
|
|
|
264
265
|
);
|
|
265
266
|
expect(firstFm).toEqual(secondFm);
|
|
266
267
|
});
|
|
268
|
+
// Replies written in one go share a second, and a migrated archive puts
|
|
269
|
+
// hundreds of roots on the same second. Jant breaks those ties by ID; the
|
|
270
|
+
// export records the order and the importer creates posts in it, so the
|
|
271
|
+
// new IDs tie-break the same way.
|
|
272
|
+
it("keeps the order of posts that share a second", async () => {
|
|
273
|
+
const second = 1773014400;
|
|
274
|
+
const root = makePost({
|
|
275
|
+
id: "pst_01aaaaaaaaaaaaaaaaaaaaaaaa",
|
|
276
|
+
slug: "thread",
|
|
277
|
+
threadId: "pst_01aaaaaaaaaaaaaaaaaaaaaaaa",
|
|
278
|
+
createdAt: 1773000000,
|
|
279
|
+
publishedAt: second,
|
|
280
|
+
updatedAt: 1773090000,
|
|
281
|
+
});
|
|
282
|
+
// IDs in thread order are the reverse of the slugs' alphabetical order.
|
|
283
|
+
const replies = [
|
|
284
|
+
["pst_01bbbbbbbbbbbbbbbbbbbbbbb1", "zeta"],
|
|
285
|
+
["pst_01bbbbbbbbbbbbbbbbbbbbbbb2", "mu"],
|
|
286
|
+
["pst_01bbbbbbbbbbbbbbbbbbbbbbb3", "alpha"],
|
|
287
|
+
].map(([id, slug]) =>
|
|
288
|
+
makePost({
|
|
289
|
+
id,
|
|
290
|
+
slug,
|
|
291
|
+
replyToId: root.id,
|
|
292
|
+
threadId: root.id,
|
|
293
|
+
createdAt: second,
|
|
294
|
+
publishedAt: second,
|
|
295
|
+
updatedAt: second,
|
|
296
|
+
}),
|
|
297
|
+
);
|
|
298
|
+
const olderSameSecondRoot = makePost({
|
|
299
|
+
id: "pst_01000000000000000000000000",
|
|
300
|
+
slug: "zzz-older-same-second",
|
|
301
|
+
threadId: "pst_01000000000000000000000000",
|
|
302
|
+
publishedAt: second,
|
|
303
|
+
});
|
|
304
|
+
const video = makeMedia({
|
|
305
|
+
id: "med-video",
|
|
306
|
+
filename: "clip.mp4",
|
|
307
|
+
mimeType: "video/mp4",
|
|
308
|
+
durationSeconds: 11,
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
const services = buildRoundtripServices({
|
|
312
|
+
// Listed out of order on purpose.
|
|
313
|
+
posts: [replies[2], root, replies[0], olderSameSecondRoot, replies[1]],
|
|
314
|
+
collections: [],
|
|
315
|
+
mediaByPost: new Map([[root.id, [video]]]),
|
|
316
|
+
collectionEntriesByThread: new Map(),
|
|
317
|
+
});
|
|
318
|
+
const files = await createExportService(
|
|
319
|
+
services,
|
|
320
|
+
makeSiteConfig(),
|
|
321
|
+
).generateHugoFiles();
|
|
322
|
+
await writeExportToDir(files, tempDir);
|
|
323
|
+
await mkdir(join(tempDir, "static", "media"), { recursive: true });
|
|
324
|
+
await writeFile(join(tempDir, "static/media/med-video.mp4"), "video");
|
|
325
|
+
|
|
326
|
+
const walked = await importTestHelpers.walkHugoContent(tempDir);
|
|
327
|
+
expect(walked.rootBundles.map((bundle) => bundle.slug)).toEqual([
|
|
328
|
+
"zzz-older-same-second",
|
|
329
|
+
"thread",
|
|
330
|
+
]);
|
|
331
|
+
const thread = walked.rootBundles[1];
|
|
332
|
+
expect(thread.children.map((bundle) => bundle.slug)).toEqual([
|
|
333
|
+
"zeta",
|
|
334
|
+
"mu",
|
|
335
|
+
"alpha",
|
|
336
|
+
]);
|
|
337
|
+
expect(thread.children.map((bundle) => bundle.frontMatter.weight)).toEqual([
|
|
338
|
+
1, 2, 3,
|
|
339
|
+
]);
|
|
340
|
+
|
|
341
|
+
// Creation and edit times come back with the payload.
|
|
342
|
+
const payload = importTestHelpers.buildPostPayloadFromBundle(thread, {
|
|
343
|
+
bodyMarkdown: "",
|
|
344
|
+
attachments: [],
|
|
345
|
+
memberships: { entries: [], ids: [] },
|
|
346
|
+
replyToId: null,
|
|
347
|
+
});
|
|
348
|
+
expect(payload).toMatchObject({
|
|
349
|
+
publishedAt: second,
|
|
350
|
+
createdAt: 1773000000,
|
|
351
|
+
updatedAt: 1773090000,
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
const [videoSpec] = await Promise.all(
|
|
355
|
+
(thread.frontMatter.media ?? []).map((entry) =>
|
|
356
|
+
importTestHelpers.mediaSpecFromJantMedia(entry, tempDir),
|
|
357
|
+
),
|
|
358
|
+
);
|
|
359
|
+
expect(videoSpec?.durationSeconds).toBe(11);
|
|
360
|
+
});
|
|
267
361
|
});
|