livemark 0.2.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.
Files changed (348) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +5 -1
  3. package/build/actions/changelog/build.d.ts +14 -0
  4. package/build/actions/changelog/build.js +158 -0
  5. package/build/actions/changelog/build.unit.js +66 -0
  6. package/build/actions/config/define.d.ts +6 -0
  7. package/build/actions/config/define.js +8 -0
  8. package/build/actions/config/define.unit.js +29 -0
  9. package/build/actions/config/load.d.ts +5 -0
  10. package/build/actions/config/load.js +25 -0
  11. package/build/actions/config/load.unit.js +23 -0
  12. package/build/commands/build.d.ts +5 -0
  13. package/build/commands/build.js +14 -0
  14. package/build/commands/escape.d.ts +9 -0
  15. package/build/commands/escape.js +56 -0
  16. package/build/commands/preview.d.ts +5 -0
  17. package/build/commands/preview.js +18 -0
  18. package/build/commands/start.d.ts +5 -0
  19. package/build/commands/start.js +19 -0
  20. package/build/docs/markdown/includes/example.d.ts +58 -0
  21. package/build/docs/markdown/includes/example.js +5 -0
  22. package/build/entrypoints/main.d.ts +2 -0
  23. package/build/entrypoints/main.js +12 -0
  24. package/build/helpers/program.d.ts +2 -0
  25. package/build/helpers/program.js +5 -0
  26. package/build/index.d.ts +1 -4
  27. package/build/index.js +2 -5
  28. package/build/livemark.config.d.ts +58 -0
  29. package/build/livemark.config.js +25 -0
  30. package/build/models/config.d.ts +340 -0
  31. package/build/models/config.js +34 -0
  32. package/build/models/link.d.ts +13 -0
  33. package/build/models/link.js +9 -0
  34. package/build/models/patch.d.ts +21 -0
  35. package/build/models/patch.js +7 -0
  36. package/build/models/section.d.ts +75 -0
  37. package/build/models/section.js +26 -0
  38. package/build/models/theme.d.ts +72 -0
  39. package/build/models/theme.js +73 -0
  40. package/build/program.d.ts +2 -0
  41. package/build/program.js +16 -0
  42. package/build/vite.config.d.ts +2 -0
  43. package/build/vite.config.js +48 -0
  44. package/build/website/assets/logo.svg +117 -0
  45. package/build/website/client.tsx +10 -0
  46. package/build/website/components/Abbr.tsx +17 -0
  47. package/build/website/components/AnsiCode.tsx +15 -0
  48. package/build/website/components/Article.tsx +172 -0
  49. package/build/website/components/BackToTop.tsx +32 -0
  50. package/build/website/components/Banner.tsx +32 -0
  51. package/build/website/components/BlogIndex.tsx +121 -0
  52. package/build/website/components/BlogSidebar.tsx +162 -0
  53. package/build/website/components/Breadcrumbs.tsx +22 -0
  54. package/build/website/components/Callout.tsx +72 -0
  55. package/build/website/components/Card.tsx +48 -0
  56. package/build/website/components/Cards.tsx +8 -0
  57. package/build/website/components/ChangelogIndex.tsx +111 -0
  58. package/build/website/components/ChangelogSidebar.tsx +120 -0
  59. package/build/website/components/CodeBlock.tsx +135 -0
  60. package/build/website/components/CodeTabs.tsx +83 -0
  61. package/build/website/components/Column.tsx +4 -0
  62. package/build/website/components/Columns.tsx +12 -0
  63. package/build/website/components/Content.tsx +7 -0
  64. package/build/website/components/ContentTab.tsx +7 -0
  65. package/build/website/components/ContentTabs.tsx +82 -0
  66. package/build/website/components/DefaultCatchBoundary.tsx +54 -0
  67. package/build/website/components/DefinitionList.tsx +21 -0
  68. package/build/website/components/Details.tsx +30 -0
  69. package/build/website/components/FileTree.tsx +52 -0
  70. package/build/website/components/Footer.tsx +16 -0
  71. package/build/website/components/FootnoteRef.tsx +52 -0
  72. package/build/website/components/Heading.tsx +20 -0
  73. package/build/website/components/InlineBadge.tsx +9 -0
  74. package/build/website/components/InlineIcon.tsx +10 -0
  75. package/build/website/components/InlineToc.tsx +31 -0
  76. package/build/website/components/Layout.tsx +190 -0
  77. package/build/website/components/LinkButton.tsx +31 -0
  78. package/build/website/components/Mermaid.tsx +18 -0
  79. package/build/website/components/MermaidRenderer.tsx +37 -0
  80. package/build/website/components/MiniSidebar.tsx +49 -0
  81. package/build/website/components/NotFound.tsx +27 -0
  82. package/build/website/components/PackageTabs.tsx +74 -0
  83. package/build/website/components/PageToolbar.tsx +75 -0
  84. package/build/website/components/PrevNext.tsx +60 -0
  85. package/build/website/components/Search.tsx +28 -0
  86. package/build/website/components/SearchDialog.tsx +245 -0
  87. package/build/website/components/Section.tsx +24 -0
  88. package/build/website/components/SectionHeader.tsx +35 -0
  89. package/build/website/components/Sidebar.tsx +160 -0
  90. package/build/website/components/SidebarLinks.tsx +70 -0
  91. package/build/website/components/SidebarSections.tsx +71 -0
  92. package/build/website/components/SiteTitle.tsx +21 -0
  93. package/build/website/components/SortableTable.tsx +81 -0
  94. package/build/website/components/SoundCloud.tsx +16 -0
  95. package/build/website/components/TagIndex.tsx +120 -0
  96. package/build/website/components/Theme.tsx +39 -0
  97. package/build/website/components/Toc.tsx +226 -0
  98. package/build/website/components/YouTube.tsx +16 -0
  99. package/build/website/components/ZoomImage.tsx +25 -0
  100. package/build/website/content/article.ts +78 -0
  101. package/build/website/content/tag.ts +29 -0
  102. package/build/website/content-collections.ts +208 -0
  103. package/build/website/elements/accordion.tsx +78 -0
  104. package/build/website/elements/alert-dialog.tsx +185 -0
  105. package/build/website/elements/alert.tsx +74 -0
  106. package/build/website/elements/aspect-ratio.tsx +22 -0
  107. package/build/website/elements/avatar.tsx +107 -0
  108. package/build/website/elements/badge.tsx +51 -0
  109. package/build/website/elements/breadcrumb.tsx +120 -0
  110. package/build/website/elements/button-group.tsx +87 -0
  111. package/build/website/elements/button.tsx +57 -0
  112. package/build/website/elements/calendar.tsx +229 -0
  113. package/build/website/elements/card.tsx +102 -0
  114. package/build/website/elements/carousel.tsx +240 -0
  115. package/build/website/elements/chart.tsx +372 -0
  116. package/build/website/elements/checkbox.tsx +26 -0
  117. package/build/website/elements/collapsible.tsx +19 -0
  118. package/build/website/elements/command.tsx +210 -0
  119. package/build/website/elements/context-menu.tsx +270 -0
  120. package/build/website/elements/dialog.tsx +152 -0
  121. package/build/website/elements/direction.tsx +4 -0
  122. package/build/website/elements/drawer.tsx +127 -0
  123. package/build/website/elements/dropdown-menu.tsx +260 -0
  124. package/build/website/elements/empty.tsx +104 -0
  125. package/build/website/elements/field.tsx +235 -0
  126. package/build/website/elements/hover-card.tsx +49 -0
  127. package/build/website/elements/input-group.tsx +171 -0
  128. package/build/website/elements/input-otp.tsx +84 -0
  129. package/build/website/elements/input.tsx +18 -0
  130. package/build/website/elements/item.tsx +199 -0
  131. package/build/website/elements/kbd.tsx +26 -0
  132. package/build/website/elements/label.tsx +17 -0
  133. package/build/website/elements/menubar.tsx +282 -0
  134. package/build/website/elements/native-select.tsx +56 -0
  135. package/build/website/elements/navigation-menu.tsx +171 -0
  136. package/build/website/elements/pagination.tsx +133 -0
  137. package/build/website/elements/popover.tsx +88 -0
  138. package/build/website/elements/progress.tsx +81 -0
  139. package/build/website/elements/radio-group.tsx +36 -0
  140. package/build/website/elements/resizable.tsx +48 -0
  141. package/build/website/elements/scroll-area.tsx +51 -0
  142. package/build/website/elements/select.tsx +200 -0
  143. package/build/website/elements/separator.tsx +22 -0
  144. package/build/website/elements/sheet.tsx +130 -0
  145. package/build/website/elements/sidebar.tsx +717 -0
  146. package/build/website/elements/skeleton.tsx +13 -0
  147. package/build/website/elements/slider.tsx +57 -0
  148. package/build/website/elements/sonner.tsx +40 -0
  149. package/build/website/elements/spinner.tsx +16 -0
  150. package/build/website/elements/switch.tsx +30 -0
  151. package/build/website/elements/table.tsx +112 -0
  152. package/build/website/elements/tabs.tsx +79 -0
  153. package/build/website/elements/textarea.tsx +16 -0
  154. package/build/website/elements/toggle-group.tsx +87 -0
  155. package/build/website/elements/toggle.tsx +43 -0
  156. package/build/website/elements/tooltip.tsx +67 -0
  157. package/build/website/env.d.ts +14 -0
  158. package/build/website/helpers/article-icon.ts +61 -0
  159. package/build/website/helpers/article.ts +90 -0
  160. package/build/website/helpers/changelog-source.ts +16 -0
  161. package/build/website/helpers/changelog-source.unit.ts +38 -0
  162. package/build/website/helpers/dynamic-icon-resolver.tsx +19 -0
  163. package/build/website/helpers/dynamic-icon.tsx +12 -0
  164. package/build/website/helpers/favicon.ts +7 -0
  165. package/build/website/helpers/model.ts +4 -0
  166. package/build/website/helpers/resolve-asset-path.ts +9 -0
  167. package/build/website/helpers/resolve-includes.ts +131 -0
  168. package/build/website/helpers/resolve-includes.unit.ts +126 -0
  169. package/build/website/helpers/search-text.ts +15 -0
  170. package/build/website/helpers/section.ts +50 -0
  171. package/build/website/helpers/section.unit.ts +71 -0
  172. package/build/website/helpers/style.ts +6 -0
  173. package/build/website/helpers/theme.ts +27 -0
  174. package/build/website/helpers/toc-context.ts +10 -0
  175. package/build/website/helpers/toc.ts +46 -0
  176. package/build/website/helpers/toc.unit.ts +74 -0
  177. package/build/website/hooks/in-view.ts +30 -0
  178. package/build/website/hooks/media.ts +19 -0
  179. package/build/website/models/article.ts +55 -0
  180. package/build/website/models/toc.ts +5 -0
  181. package/build/website/plugins/rehype-inline-code.ts +107 -0
  182. package/build/website/plugins/rehype-task-list-a11y.ts +33 -0
  183. package/build/website/plugins/remark-abbr.ts +46 -0
  184. package/build/website/plugins/remark-abbr.unit.ts +99 -0
  185. package/build/website/plugins/remark-ansi.ts +248 -0
  186. package/build/website/plugins/remark-ansi.unit.ts +197 -0
  187. package/build/website/plugins/remark-badge.ts +50 -0
  188. package/build/website/plugins/remark-badge.unit.ts +96 -0
  189. package/build/website/plugins/remark-button.ts +60 -0
  190. package/build/website/plugins/remark-button.unit.ts +147 -0
  191. package/build/website/plugins/remark-callout.ts +57 -0
  192. package/build/website/plugins/remark-card.ts +80 -0
  193. package/build/website/plugins/remark-code-tabs.ts +87 -0
  194. package/build/website/plugins/remark-columns.ts +66 -0
  195. package/build/website/plugins/remark-custom-heading-id.ts +70 -0
  196. package/build/website/plugins/remark-custom-heading-id.unit.ts +131 -0
  197. package/build/website/plugins/remark-deflist.ts +36 -0
  198. package/build/website/plugins/remark-details.ts +49 -0
  199. package/build/website/plugins/remark-filetree.ts +89 -0
  200. package/build/website/plugins/remark-filetree.unit.ts +137 -0
  201. package/build/website/plugins/remark-github-callout.ts +71 -0
  202. package/build/website/plugins/remark-icon.ts +42 -0
  203. package/build/website/plugins/remark-image.ts +34 -0
  204. package/build/website/plugins/remark-media.ts +62 -0
  205. package/build/website/plugins/remark-media.unit.ts +74 -0
  206. package/build/website/plugins/remark-mermaid.ts +23 -0
  207. package/build/website/plugins/remark-npm.ts +52 -0
  208. package/build/website/plugins/remark-steps.ts +36 -0
  209. package/build/website/plugins/remark-steps.unit.ts +97 -0
  210. package/build/website/plugins/remark-tab.ts +100 -0
  211. package/build/website/plugins/remark-tab.unit.ts +181 -0
  212. package/build/website/plugins/remark-toc.ts +39 -0
  213. package/build/website/plugins/remark-toc.unit.ts +82 -0
  214. package/build/website/plugins/shiki-icon.ts +82 -0
  215. package/build/website/plugins/shiki-line-highlight.ts +174 -0
  216. package/build/website/plugins/vite-livemark.ts +91 -0
  217. package/build/website/routeTree.gen.ts +86 -0
  218. package/build/website/router.tsx +34 -0
  219. package/build/website/routes/$.tsx +92 -0
  220. package/build/website/routes/__root.tsx +97 -0
  221. package/build/website/server.ts +7 -0
  222. package/build/website/styles/general.css +163 -0
  223. package/build/website/styles/markdown.css +214 -0
  224. package/build/website/vite.config.ts +71 -0
  225. package/package.json +120 -12
  226. package/skills/authoring/SKILL.md +97 -0
  227. package/skills/configuration/SKILL.md +120 -0
  228. package/skills/customization/SKILL.md +118 -0
  229. package/build/descriptor/index.d.ts +0 -3
  230. package/build/descriptor/index.js +0 -4
  231. package/build/descriptor/load.d.ts +0 -8
  232. package/build/descriptor/load.js +0 -40
  233. package/build/descriptor/node.d.ts +0 -125
  234. package/build/descriptor/node.js +0 -9
  235. package/build/descriptor/save.d.ts +0 -8
  236. package/build/descriptor/save.js +0 -17
  237. package/build/descriptor/save.spec.js +0 -80
  238. package/build/descriptor/validate.d.ts +0 -9
  239. package/build/descriptor/validate.js +0 -14
  240. package/build/descriptor/validate.spec.js +0 -124
  241. package/build/dialect/Dialect.d.ts +0 -88
  242. package/build/dialect/Dialect.js +0 -2
  243. package/build/dialect/index.d.ts +0 -3
  244. package/build/dialect/index.js +0 -3
  245. package/build/dialect/load.d.ts +0 -4
  246. package/build/dialect/load.js +0 -7
  247. package/build/dialect/save.d.ts +0 -9
  248. package/build/dialect/save.js +0 -13
  249. package/build/dialect/validate.d.ts +0 -1
  250. package/build/dialect/validate.js +0 -4
  251. package/build/metadata/index.d.ts +0 -3
  252. package/build/metadata/index.js +0 -4
  253. package/build/metadata/load.d.ts +0 -10
  254. package/build/metadata/load.js +0 -55
  255. package/build/metadata/node.d.ts +0 -125
  256. package/build/metadata/node.js +0 -9
  257. package/build/metadata/save.d.ts +0 -8
  258. package/build/metadata/save.js +0 -17
  259. package/build/metadata/save.spec.js +0 -80
  260. package/build/metadata/validate.d.ts +0 -9
  261. package/build/metadata/validate.js +0 -14
  262. package/build/metadata/validate.spec.d.ts +0 -1
  263. package/build/metadata/validate.spec.js +0 -124
  264. package/build/package/Contributor.d.ts +0 -21
  265. package/build/package/Contributor.js +0 -2
  266. package/build/package/Package.d.ts +0 -65
  267. package/build/package/Package.js +0 -2
  268. package/build/package/index.d.ts +0 -4
  269. package/build/package/index.js +0 -3
  270. package/build/package/load.d.ts +0 -4
  271. package/build/package/load.js +0 -7
  272. package/build/package/save.d.ts +0 -9
  273. package/build/package/save.js +0 -13
  274. package/build/package/validate.d.ts +0 -1
  275. package/build/package/validate.js +0 -4
  276. package/build/resource/License.d.ts +0 -18
  277. package/build/resource/License.js +0 -2
  278. package/build/resource/Resource.d.ts +0 -67
  279. package/build/resource/Resource.js +0 -2
  280. package/build/resource/Source.d.ts +0 -17
  281. package/build/resource/Source.js +0 -2
  282. package/build/resource/index.d.ts +0 -5
  283. package/build/resource/index.js +0 -2
  284. package/build/resource/load.d.ts +0 -1
  285. package/build/resource/load.js +0 -2
  286. package/build/resource/save.d.ts +0 -9
  287. package/build/resource/save.js +0 -13
  288. package/build/resource/types/index.d.ts +0 -1
  289. package/build/resource/types/index.js +0 -2
  290. package/build/resource/types/table.d.ts +0 -29
  291. package/build/resource/types/table.js +0 -2
  292. package/build/resource/validate.d.ts +0 -1
  293. package/build/resource/validate.js +0 -4
  294. package/build/schema/Field.d.ts +0 -5
  295. package/build/schema/Field.js +0 -2
  296. package/build/schema/Schema.d.ts +0 -55
  297. package/build/schema/Schema.js +0 -2
  298. package/build/schema/fields/any.d.ts +0 -20
  299. package/build/schema/fields/any.js +0 -2
  300. package/build/schema/fields/array.d.ts +0 -32
  301. package/build/schema/fields/array.js +0 -2
  302. package/build/schema/fields/base.d.ts +0 -42
  303. package/build/schema/fields/base.js +0 -2
  304. package/build/schema/fields/boolean.d.ts +0 -28
  305. package/build/schema/fields/boolean.js +0 -2
  306. package/build/schema/fields/date.d.ts +0 -35
  307. package/build/schema/fields/date.js +0 -2
  308. package/build/schema/fields/datetime.d.ts +0 -35
  309. package/build/schema/fields/datetime.js +0 -2
  310. package/build/schema/fields/duration.d.ts +0 -28
  311. package/build/schema/fields/duration.js +0 -2
  312. package/build/schema/fields/geojson.d.ts +0 -26
  313. package/build/schema/fields/geojson.js +0 -2
  314. package/build/schema/fields/geopoint.d.ts +0 -27
  315. package/build/schema/fields/geopoint.js +0 -2
  316. package/build/schema/fields/index.d.ts +0 -16
  317. package/build/schema/fields/index.js +0 -17
  318. package/build/schema/fields/integer.d.ts +0 -37
  319. package/build/schema/fields/integer.js +0 -2
  320. package/build/schema/fields/list.d.ts +0 -36
  321. package/build/schema/fields/list.js +0 -2
  322. package/build/schema/fields/number.d.ts +0 -40
  323. package/build/schema/fields/number.js +0 -2
  324. package/build/schema/fields/object.d.ts +0 -32
  325. package/build/schema/fields/object.js +0 -2
  326. package/build/schema/fields/string.d.ts +0 -40
  327. package/build/schema/fields/string.js +0 -2
  328. package/build/schema/fields/time.d.ts +0 -35
  329. package/build/schema/fields/time.js +0 -2
  330. package/build/schema/fields/year.d.ts +0 -28
  331. package/build/schema/fields/year.js +0 -2
  332. package/build/schema/fields/yearmonth.d.ts +0 -28
  333. package/build/schema/fields/yearmonth.js +0 -2
  334. package/build/schema/index.d.ts +0 -4
  335. package/build/schema/index.js +0 -2
  336. package/build/schema/load.d.ts +0 -1
  337. package/build/schema/load.js +0 -2
  338. package/build/schema/save.d.ts +0 -9
  339. package/build/schema/save.js +0 -13
  340. package/build/schema/validate.d.ts +0 -1
  341. package/build/schema/validate.js +0 -4
  342. package/build/tsconfig.tsbuildinfo +0 -1
  343. package/index.ts +0 -0
  344. package/tsconfig.json +0 -10
  345. package/typedoc.json +0 -4
  346. /package/build/{descriptor/save.spec.d.ts → actions/changelog/build.unit.d.ts} +0 -0
  347. /package/build/{descriptor/validate.spec.d.ts → actions/config/define.unit.d.ts} +0 -0
  348. /package/build/{metadata/save.spec.d.ts → actions/config/load.unit.d.ts} +0 -0
@@ -0,0 +1,120 @@
1
+ ---
2
+ name: livemark-configuration
3
+ description: Use when editing livemark.config.ts — site metadata, include/exclude globs, syntax themes, sections (article/blog/changelog), navigation links, and patches.
4
+ ---
5
+
6
+ # Livemark Configuration
7
+
8
+ Guidance for editing `livemark.config.ts` at the project root.
9
+
10
+ ## When to use this skill
11
+
12
+ Invoke when the user asks to:
13
+
14
+ - Set the site title, description, canonical URL, logo, favicon.
15
+ - Change which files are included or excluded.
16
+ - Switch code-block syntax highlighting themes.
17
+ - Add, reorder, or retype a section (docs/blog/changelog).
18
+ - Add or remove header/sidebar links.
19
+ - Patch a specific file's frontmatter without editing its source.
20
+
21
+ ## The config shape
22
+
23
+ ```ts
24
+ // livemark.config.ts
25
+ import { defineConfig } from "livemark"
26
+
27
+ export default defineConfig({
28
+ // Required
29
+ include: "docs/**/*.md", // string | string[] of glob patterns
30
+
31
+ // Optional: site metadata
32
+ site: "https://example.com", // canonical origin — enables sitemap
33
+ title: "My Docs", // <title>, og:title, header
34
+ description: "Short blurb.", // <meta description>, og:description
35
+ logo: "/logo.svg", // header mark; also default favicon
36
+ favicon: "/favicon.ico", // browser tab icon
37
+
38
+ // Optional: content selection
39
+ exclude: "docs/drafts/**", // string | string[]
40
+
41
+ // Optional: syntax themes (Shiki)
42
+ codeThemeLight: "catppuccin-latte", // default
43
+ codeThemeDark: "catppuccin-mocha", // default
44
+
45
+ // Optional: navigation
46
+ links: [{ url: "https://github.com/x/y", title: "GitHub", icon: "github" }],
47
+
48
+ // Optional: sections
49
+ sections: [
50
+ { title: "Docs", prefix: "/" },
51
+ { title: "Blog", prefix: "/blog/", type: "blog" },
52
+ {
53
+ title: "Changelog",
54
+ prefix: "/changelog/",
55
+ type: "changelog",
56
+ source: "CHANGELOG.md",
57
+ version: true,
58
+ },
59
+ ],
60
+
61
+ // Optional: per-file frontmatter overrides
62
+ patches: [
63
+ { file: "README.md", article: { title: "Overview", icon: "sparkles" } },
64
+ ],
65
+ })
66
+ ```
67
+
68
+ ## Sections: the three types
69
+
70
+ `sections` is optional. Omitting it gives a single default docs section.
71
+
72
+ - **Article** (default when `type` is omitted): flat docs with a tree sidebar.
73
+ - **Blog** (`type: "blog"`): auto-generated index at `prefix`, sorts by `date`, exposes `/prefix/tags/<tag>/` pages.
74
+ - **Changelog** (`type: "changelog"`): reads `source` file; with `version: true`, splits on semver headings into per-version articles.
75
+
76
+ Shared fields on every section: `title`, `prefix` (keep trailing-slashed), `type`, `icon` (lucide), `position` (`"header"` default, `"sidebar"` also available).
77
+
78
+ Article-to-section matching is longest-prefix-wins on the article's URL `path`.
79
+
80
+ ## Links
81
+
82
+ ```ts
83
+ {
84
+ url: "https://example.com",
85
+ title: "Example",
86
+ icon: "github", // lucide name, kebab-case
87
+ position: "header", // or "sidebar"
88
+ prefix: "/blog/", // optional: only show in this section
89
+ }
90
+ ```
91
+
92
+ Default `position` is `"header"`. Use `prefix` to scope a sidebar link to a single section.
93
+
94
+ ## Syntax themes
95
+
96
+ Any [Shiki theme](https://shiki.style/themes) name works. Defaults keep the catppuccin pairing. If you swap the light theme, audit code-block token contrast against the theme's background (WCAG AA wants 4.5:1).
97
+
98
+ ## Editing rules of thumb
99
+
100
+ 1. **Don't invent fields.** Livemark's `UserConfig` is a strict zod schema. Unknown keys throw at config load.
101
+ 2. **Strings are literals.** Section `prefix` values are compared exactly; keep them consistent (`/blog/`, not `/blog`).
102
+ 3. **Array order matters** for `sections` and `links` — it drives tab / link display order.
103
+ 4. **Patches are silent on miss.** If `file` doesn't match any included article, nothing happens (no warning). Spell the path carefully.
104
+
105
+ ## Autoreload
106
+
107
+ The dev server watches `livemark.config.ts` and restarts on edit. No need to kill `pnpm docs:start` after tweaking the config.
108
+
109
+ ## Verification
110
+
111
+ - `pnpm type` — catches schema mismatches.
112
+ - `pnpm docs:build` — prerenders with the new config; the output listing shows whether section routes resolved.
113
+
114
+ ## References
115
+
116
+ - Config schema: `models/config.ts`.
117
+ - Section variants: `models/section.ts`.
118
+ - Link shape: `models/link.ts`.
119
+ - Patch shape: `models/patch.ts`.
120
+ - Narrative docs: `docs/customization/`.
@@ -0,0 +1,118 @@
1
+ ---
2
+ name: livemark-customization
3
+ description: Use when overriding Livemark's built-in UI or adding custom routes — drop same-named files under .livemark/{components,elements,styles} to shadow defaults, author .livemark/routes/*.tsx for new pages, or copy defaults with the `livemark escape` command.
4
+ ---
5
+
6
+ # Livemark Customization
7
+
8
+ Guidance for customizing the UI layer of a Livemark project beyond what `livemark.config.ts` exposes.
9
+
10
+ ## When to use this skill
11
+
12
+ Invoke when the user asks to:
13
+
14
+ - Change a built-in component's layout or markup (Footer, Sidebar, Banner, …).
15
+ - Restyle a shared primitive (buttons, inputs, cards, sheet, …).
16
+ - Rebrand via CSS tokens (colors, radii, typography).
17
+ - Add a brand-new page that isn't a Markdown article (landing hero, pricing page, about page).
18
+ - Replace Livemark's default landing page with a custom React component.
19
+ - Serve a custom `favicon.svg`, `robots.txt`, `og-image.png`, or other static asset.
20
+
21
+ ## Three overlapping mechanisms
22
+
23
+ | Goal | Mechanism |
24
+ | --------------------------------- | ----------------------------------------------------- |
25
+ | Replace a default component/style | Drop a file at `.livemark/components/<Name>.tsx` etc. |
26
+ | Add a new page at an exact URL | Create `.livemark/routes/<path>.tsx` |
27
+ | Serve a static asset at `/<path>` | Put the file in `.livemark/public/<path>` |
28
+
29
+ None require config changes. The Vite plugin (`website/plugins/vite-livemark.ts`) watches `.livemark/**` and hot-reloads.
30
+
31
+ ## Discovering what's overridable
32
+
33
+ Run the `escape` command. No arg lists every overridable file:
34
+
35
+ ```bash
36
+ livemark escape
37
+ ```
38
+
39
+ Output is a flat `<subdir>/<file>` list across `components/`, `elements/`, and `styles/`. With an argument, the command copies the default into `.livemark/`:
40
+
41
+ ```bash
42
+ livemark escape components/Footer.tsx # → .livemark/components/Footer.tsx
43
+ livemark escape elements/button.tsx # → .livemark/elements/button.tsx
44
+ livemark escape styles/general.css # → .livemark/styles/general.css
45
+ ```
46
+
47
+ The command refuses to overwrite an existing override. Delete the override first if you want a fresh start.
48
+
49
+ ## Typical workflow: override a component
50
+
51
+ 1. `livemark escape components/Footer.tsx` — copy the default.
52
+ 2. Edit `.livemark/components/Footer.tsx`. All the site's Footer renders shift to the new file on save.
53
+ 3. Inside the override, import other Livemark modules from the `livemark/<subdir>/*` subpath exports:
54
+ ```tsx
55
+ import { cn } from "livemark/helpers/style"
56
+ import { Button } from "livemark/elements/button"
57
+ ```
58
+
59
+ ## Typical workflow: rebrand
60
+
61
+ 1. `livemark escape styles/general.css`.
62
+ 2. Edit the `:root` and `.dark` blocks in `.livemark/styles/general.css`:
63
+ - `--primary` — brand accent (Tailwind-flavoured oklch values work).
64
+ - `--radius` — corner roundness base.
65
+ - Sidebar / chart tokens if you want deeper tweaks.
66
+ 3. Save — the dev server applies immediately.
67
+
68
+ Whole-site contrast is audited: light mode targets blue-600, dark mode targets blue-500. Keep new token values AA-compliant on both backgrounds (≥4.5:1 for text).
69
+
70
+ ## Typical workflow: add a page
71
+
72
+ Custom routes use [TanStack Router](https://tanstack.com/router). Minimal example:
73
+
74
+ ```tsx title=".livemark/routes/about.tsx"
75
+ import { createFileRoute } from "@tanstack/react-router"
76
+
77
+ export const Route = createFileRoute("/about")({
78
+ component: () => (
79
+ <main className="mx-auto max-w-3xl px-6 py-16 prose">
80
+ <h1>About</h1>
81
+ <p>Hello.</p>
82
+ </main>
83
+ ),
84
+ })
85
+ ```
86
+
87
+ Filename maps to URL path: `.livemark/routes/pricing.tsx` → `/pricing/`. Nested paths work via nested folders.
88
+
89
+ An `index.tsx` in `.livemark/routes/` **replaces** Livemark's default landing at `/`.
90
+
91
+ Custom routes win over the Markdown catch-all at exact URLs. Don't create a route that collides with an article URL unless you intend to hide the article.
92
+
93
+ ## Rules of thumb
94
+
95
+ 1. **Don't fork the repo** for routine customization. Use `.livemark/` first — it reliably survives Livemark upgrades.
96
+ 2. **Same filename, same path under `.livemark/`.** The override plugin is case-sensitive and mirrors the subdirectory structure exactly.
97
+ 3. **Override files are full replacements**, not diffs. Copy the default first (via `escape`), then edit.
98
+ 4. **Import Livemark internals via `livemark/*`**, not via relative paths — the plugin routes those through the override resolver, so chained overrides (e.g., your Layout using your Sidebar) compose correctly.
99
+ 5. **Static files belong in `.livemark/public/`**, which Vite exposes at the site root.
100
+
101
+ ## What's NOT overridable
102
+
103
+ - `actions/`, `commands/`, `program.ts` — server/CLI code. Fork upstream if you need to change these.
104
+ - `livemark.config.ts` schema — fixed.
105
+ - Content-collections transform pipeline. Customize markdown via remark/rehype plugins in a fork (or PR upstream).
106
+
107
+ ## Verification
108
+
109
+ - `pnpm type` — confirms overrides typecheck.
110
+ - `pnpm docs:build` — smoke-test the override lands in the bundle.
111
+ - Browser: load an article page with the dev server; custom Footer/Sidebar/etc. should render without a full reload.
112
+
113
+ ## References
114
+
115
+ - Narrative docs: `docs/customization/file-overrides.md`, `docs/customization/custom-routes.md`.
116
+ - Plugin implementation: `website/plugins/vite-livemark.ts`.
117
+ - Escape command: `commands/escape.ts`.
118
+ - Subpath exports: `package.json` `exports` block.
@@ -1,3 +0,0 @@
1
- export { loadDescriptor } from "./load.js";
2
- export { saveDescriptor } from "./save.js";
3
- export { validateDescriptor } from "./validate.js";
@@ -1,4 +0,0 @@
1
- export { loadDescriptor } from "./load.js";
2
- export { saveDescriptor } from "./save.js";
3
- export { validateDescriptor } from "./validate.js";
4
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9kZXNjcmlwdG9yL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxXQUFXLENBQUE7QUFDMUMsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLFdBQVcsQ0FBQTtBQUMxQyxPQUFPLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSxlQUFlLENBQUEiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgeyBsb2FkRGVzY3JpcHRvciB9IGZyb20gXCIuL2xvYWQuanNcIlxuZXhwb3J0IHsgc2F2ZURlc2NyaXB0b3IgfSBmcm9tIFwiLi9zYXZlLmpzXCJcbmV4cG9ydCB7IHZhbGlkYXRlRGVzY3JpcHRvciB9IGZyb20gXCIuL3ZhbGlkYXRlLmpzXCJcbiJdfQ==
@@ -1,8 +0,0 @@
1
- /**
2
- * Load a descriptor (JSON Object) from a file or URL
3
- * Uses dynamic imports to work in both Node.js and browser environments
4
- * Supports HTTP, HTTPS, FTP, and FTPS protocols
5
- */
6
- export declare function loadDescriptor(props: {
7
- path: string;
8
- }): Promise<Record<string, any>>;
@@ -1,40 +0,0 @@
1
- import { loadNodeApis } from "./node.js";
2
- /**
3
- * Load a descriptor (JSON Object) from a file or URL
4
- * Uses dynamic imports to work in both Node.js and browser environments
5
- * Supports HTTP, HTTPS, FTP, and FTPS protocols
6
- */
7
- export async function loadDescriptor(props) {
8
- const url = createRemoteUrl(props.path);
9
- return url
10
- ? await loadRemoteDescriptor(url)
11
- : await loadLocalDescriptor(props.path);
12
- }
13
- function createRemoteUrl(path) {
14
- try {
15
- return new URL(path);
16
- }
17
- catch {
18
- return undefined;
19
- }
20
- }
21
- const REMOTE_PROTOCOLS = ["http:", "https:", "ftp:", "ftps:"];
22
- async function loadRemoteDescriptor(url) {
23
- const protocol = url.protocol.toLowerCase();
24
- if (!REMOTE_PROTOCOLS.includes(protocol)) {
25
- throw new Error(`Unsupported URL protocol: ${protocol}`);
26
- }
27
- const response = await fetch(url.toString());
28
- const descriptor = (await response.json());
29
- return descriptor;
30
- }
31
- async function loadLocalDescriptor(path) {
32
- const node = await loadNodeApis();
33
- if (!node) {
34
- throw new Error("File system is not supported in this environment");
35
- }
36
- const content = await node.fs.readFile(path, "utf-8");
37
- const descriptor = JSON.parse(content);
38
- return descriptor;
39
- }
40
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL2Rlc2NyaXB0b3IvbG9hZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sV0FBVyxDQUFBO0FBRXhDOzs7O0dBSUc7QUFDSCxNQUFNLENBQUMsS0FBSyxVQUFVLGNBQWMsQ0FBQyxLQUF1QjtJQUMxRCxNQUFNLEdBQUcsR0FBRyxlQUFlLENBQUMsS0FBSyxDQUFDLElBQUksQ0FBQyxDQUFBO0lBRXZDLE9BQU8sR0FBRztRQUNSLENBQUMsQ0FBQyxNQUFNLG9CQUFvQixDQUFDLEdBQUcsQ0FBQztRQUNqQyxDQUFDLENBQUMsTUFBTSxtQkFBbUIsQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUE7QUFDM0MsQ0FBQztBQUVELFNBQVMsZUFBZSxDQUFDLElBQVk7SUFDbkMsSUFBSSxDQUFDO1FBQ0gsT0FBTyxJQUFJLEdBQUcsQ0FBQyxJQUFJLENBQUMsQ0FBQTtJQUN0QixDQUFDO0lBQUMsTUFBTSxDQUFDO1FBQ1AsT0FBTyxTQUFT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2wpKSB7XG4gICAgdGhyb3cgbmV3IEVycm9yKGBVbnN1cHBvcnRlZCBVUkwgcHJvdG9jb2w6ICR7cHJvdG9jb2x9YClcbiAgfVxuXG4gIGNvbnN0IHJlc3BvbnNlID0gYXdhaXQgZmV0Y2godXJsLnRvU3RyaW5nKCkpXG4gIGNvbnN0IGRlc2NyaXB0b3IgPSAoYXdhaXQgcmVzcG9uc2UuanNvbigpKSBhcyBSZWNvcmQ8c3RyaW5nLCBhbnk+XG5cbiAgcmV0dXJuIGRlc2NyaXB0b3Jcbn1cblxuYXN5bmMgZnVuY3Rpb24gbG9hZExvY2FsRGVzY3JpcHRvcihwYXRoOiBzdHJpbmcpIHtcbiAgY29uc3Qgbm9kZSA9IGF3YWl0IGxvYWROb2RlQXBpcygpXG4gIGlmICghbm9kZSkge1xuICAgIHRocm93IG5ldyBFcnJvcihcIkZpbGUgc3lzdGVtIGlzIG5vdCBzdXBwb3J0ZWQgaW4gdGhpcyBlbnZpcm9ubWVudFwiKVxuICB9XG5cbiAgY29uc3QgY29udGVudCA9IGF3YWl0IG5vZGUuZnMucmVhZEZpbGUocGF0aCwgXCJ1dGYtOFwiKVxuICBjb25zdCBkZXNjcmlwdG9yID0gSlNPTi5wYXJzZShjb250ZW50KSBhcyBSZWNvcmQ8c3RyaW5nLCBhbnk+XG5cbiAgcmV0dXJuIGRlc2NyaXB0b3Jcbn1cbiJdfQ==
@@ -1,125 +0,0 @@
1
- export declare function loadNodeApis(): Promise<{
2
- fs: {
3
- default: typeof import("node:fs/promises");
4
- access(path: import("fs").PathLike, mode?: number): Promise<void>;
5
- copyFile(src: import("fs").PathLike, dest: import("fs").PathLike, mode?: number): Promise<void>;
6
- open(path: import("fs").PathLike, flags?: string | number, mode?: import("fs").Mode): Promise<import("fs/promises").FileHandle>;
7
- rename(oldPath: import("fs").PathLike, newPath: import("fs").PathLike): Promise<void>;
8
- truncate(path: import("fs").PathLike, len?: number): Promise<void>;
9
- rmdir(path: import("fs").PathLike, options?: import("fs").RmDirOptions): Promise<void>;
10
- rm(path: import("fs").PathLike, options?: import("fs").RmOptions): Promise<void>;
11
- mkdir(path: import("fs").PathLike, options: import("fs").MakeDirectoryOptions & {
12
- recursive: true;
13
- }): Promise<string | undefined>;
14
- mkdir(path: import("fs").PathLike, options?: import("fs").Mode | (import("fs").MakeDirectoryOptions & {
15
- recursive?: false | undefined;
16
- }) | null): Promise<void>;
17
- mkdir(path: import("fs").PathLike, options?: import("fs").Mode | import("fs").MakeDirectoryOptions | null): Promise<string | undefined>;
18
- readdir(path: import("fs").PathLike, options?: (import("fs").ObjectEncodingOptions & {
19
- withFileTypes?: false | undefined;
20
- recursive?: boolean | undefined;
21
- }) | BufferEncoding | null): Promise<string[]>;
22
- readdir(path: import("fs").PathLike, options: {
23
- encoding: "buffer";
24
- withFileTypes?: false | undefined;
25
- recursive?: boolean | undefined;
26
- } | "buffer"): Promise<Buffer[]>;
27
- readdir(path: import("fs").PathLike, options?: (import("fs").ObjectEncodingOptions & {
28
- withFileTypes?: false | undefined;
29
- recursive?: boolean | undefined;
30
- }) | BufferEncoding | null): Promise<string[] | Buffer[]>;
31
- readdir(path: import("fs").PathLike, options: import("fs").ObjectEncodingOptions & {
32
- withFileTypes: true;
33
- recursive?: boolean | undefined;
34
- }): Promise<import("fs").Dirent[]>;
35
- readlink(path: import("fs").PathLike, options?: import("fs").ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
36
- readlink(path: import("fs").PathLike, options: import("fs").BufferEncodingOption): Promise<Buffer>;
37
- readlink(path: import("fs").PathLike, options?: import("fs").ObjectEncodingOptions | string | null): Promise<string | Buffer>;
38
- symlink(target: import("fs").PathLike, path: import("fs").PathLike, type?: string | null): Promise<void>;
39
- lstat(path: import("fs").PathLike, opts?: import("fs").StatOptions & {
40
- bigint?: false | undefined;
41
- }): Promise<import("fs").Stats>;
42
- lstat(path: import("fs").PathLike, opts: import("fs").StatOptions & {
43
- bigint: true;
44
- }): Promise<import("fs").BigIntStats>;
45
- lstat(path: import("fs").PathLike, opts?: import("fs").StatOptions): Promise<import("fs").Stats | import("fs").BigIntStats>;
46
- stat(path: import("fs").PathLike, opts?: import("fs").StatOptions & {
47
- bigint?: false | undefined;
48
- }): Promise<import("fs").Stats>;
49
- stat(path: import("fs").PathLike, opts: import("fs").StatOptions & {
50
- bigint: true;
51
- }): Promise<import("fs").BigIntStats>;
52
- stat(path: import("fs").PathLike, opts?: import("fs").StatOptions): Promise<import("fs").Stats | import("fs").BigIntStats>;
53
- statfs(path: import("fs").PathLike, opts?: import("fs").StatFsOptions & {
54
- bigint?: false | undefined;
55
- }): Promise<import("fs").StatsFs>;
56
- statfs(path: import("fs").PathLike, opts: import("fs").StatFsOptions & {
57
- bigint: true;
58
- }): Promise<import("fs").BigIntStatsFs>;
59
- statfs(path: import("fs").PathLike, opts?: import("fs").StatFsOptions): Promise<import("fs").StatsFs | import("fs").BigIntStatsFs>;
60
- link(existingPath: import("fs").PathLike, newPath: import("fs").PathLike): Promise<void>;
61
- unlink(path: import("fs").PathLike): Promise<void>;
62
- chmod(path: import("fs").PathLike, mode: import("fs").Mode): Promise<void>;
63
- lchmod(path: import("fs").PathLike, mode: import("fs").Mode): Promise<void>;
64
- lchown(path: import("fs").PathLike, uid: number, gid: number): Promise<void>;
65
- lutimes(path: import("fs").PathLike, atime: import("fs").TimeLike, mtime: import("fs").TimeLike): Promise<void>;
66
- chown(path: import("fs").PathLike, uid: number, gid: number): Promise<void>;
67
- utimes(path: import("fs").PathLike, atime: import("fs").TimeLike, mtime: import("fs").TimeLike): Promise<void>;
68
- realpath(path: import("fs").PathLike, options?: import("fs").ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
69
- realpath(path: import("fs").PathLike, options: import("fs").BufferEncodingOption): Promise<Buffer>;
70
- realpath(path: import("fs").PathLike, options?: import("fs").ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
71
- mkdtemp(prefix: string, options?: import("fs").ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
72
- mkdtemp(prefix: string, options: import("fs").BufferEncodingOption): Promise<Buffer>;
73
- mkdtemp(prefix: string, options?: import("fs").ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
74
- writeFile(file: import("fs").PathLike | import("fs/promises").FileHandle, data: string | NodeJS.ArrayBufferView | Iterable<string | NodeJS.ArrayBufferView> | AsyncIterable<string | NodeJS.ArrayBufferView> | import("stream"), options?: (import("fs").ObjectEncodingOptions & {
75
- mode?: import("fs").Mode | undefined;
76
- flag?: import("fs").OpenMode | undefined;
77
- flush?: boolean | undefined;
78
- } & import("events").Abortable) | BufferEncoding | null): Promise<void>;
79
- appendFile(path: import("fs").PathLike | import("fs/promises").FileHandle, data: string | Uint8Array, options?: (import("fs").ObjectEncodingOptions & import("fs/promises").FlagAndOpenMode & {
80
- flush?: boolean | undefined;
81
- }) | BufferEncoding | null): Promise<void>;
82
- readFile(path: import("fs").PathLike | import("fs/promises").FileHandle, options?: ({
83
- encoding?: null | undefined;
84
- flag?: import("fs").OpenMode | undefined;
85
- } & import("events").Abortable) | null): Promise<Buffer>;
86
- readFile(path: import("fs").PathLike | import("fs/promises").FileHandle, options: ({
87
- encoding: BufferEncoding;
88
- flag?: import("fs").OpenMode | undefined;
89
- } & import("events").Abortable) | BufferEncoding): Promise<string>;
90
- readFile(path: import("fs").PathLike | import("fs/promises").FileHandle, options?: (import("fs").ObjectEncodingOptions & import("events").Abortable & {
91
- flag?: import("fs").OpenMode | undefined;
92
- }) | BufferEncoding | null): Promise<string | Buffer>;
93
- opendir(path: import("fs").PathLike, options?: import("fs").OpenDirOptions): Promise<import("fs").Dir>;
94
- watch(filename: import("fs").PathLike, options: (import("fs").WatchOptions & {
95
- encoding: "buffer";
96
- }) | "buffer"): AsyncIterable<import("fs/promises").FileChangeInfo<Buffer>>;
97
- watch(filename: import("fs").PathLike, options?: import("fs").WatchOptions | BufferEncoding): AsyncIterable<import("fs/promises").FileChangeInfo<string>>;
98
- watch(filename: import("fs").PathLike, options: import("fs").WatchOptions | string): AsyncIterable<import("fs/promises").FileChangeInfo<string>> | AsyncIterable<import("fs/promises").FileChangeInfo<Buffer>>;
99
- cp(source: string | URL, destination: string | URL, opts?: import("fs").CopyOptions): Promise<void>;
100
- glob(pattern: string | string[]): NodeJS.AsyncIterator<string>;
101
- glob(pattern: string | string[], opt: import("fs").GlobOptionsWithFileTypes): NodeJS.AsyncIterator<import("fs").Dirent>;
102
- glob(pattern: string | string[], opt: import("fs").GlobOptionsWithoutFileTypes): NodeJS.AsyncIterator<string>;
103
- glob(pattern: string | string[], opt: import("fs").GlobOptions): NodeJS.AsyncIterator<import("fs").Dirent | string>;
104
- constants: typeof import("fs").constants;
105
- };
106
- path: {
107
- default: import("path").PlatformPath;
108
- normalize(path: string): string;
109
- join(...paths: string[]): string;
110
- resolve(...paths: string[]): string;
111
- matchesGlob(path: string, pattern: string): boolean;
112
- isAbsolute(path: string): boolean;
113
- relative(from: string, to: string): string;
114
- dirname(path: string): string;
115
- basename(path: string, suffix?: string): string;
116
- extname(path: string): string;
117
- sep: "\\" | "/";
118
- delimiter: ";" | ":";
119
- parse(path: string): import("path").ParsedPath;
120
- format(pathObject: import("path").FormatInputPathObject): string;
121
- toNamespacedPath(path: string): string;
122
- posix: import("path").PlatformPath;
123
- win32: import("path").PlatformPath;
124
- };
125
- } | undefined>;
@@ -1,9 +0,0 @@
1
- export async function loadNodeApis() {
2
- if (globalThis.process) {
3
- const fs = await import("node:fs/promises");
4
- const path = await import("node:path");
5
- return { fs, path };
6
- }
7
- return undefined;
8
- }
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL2Rlc2NyaXB0b3Ivbm9kZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQUMsS0FBSyxVQUFVLFlBQVk7SUFDaEMsSUFBSSxVQUFVLENBQUMsT0FBTyxFQUFFLENBQUM7UUFDdkIsTUFBTSxFQUFFLEdBQUcsTUFBTSxNQUFNLENBQUMsa0JBQWtCLENBQUMsQ0FBQTtRQUMzQyxNQUFNLElBQUksR0FBRyxNQUFNLE1BQU0sQ0FBQyxXQUFXLENBQUMsQ0FBQTtRQUN0QyxPQUFPLEVBQUUsRUFBRSxFQUFFLElBQUksRUFBRSxDQUFBO0lBQ3JCLENBQUM7SUFFRCxPQUFPLFNBQVMsQ0FBQTtBQUNsQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGFzeW5jIGZ1bmN0aW9uIGxvYWROb2RlQXBpcygpIHtcbiAgaWYgKGdsb2JhbFRoaXMucHJvY2Vzcykge1xuICAgIGNvbnN0IGZzID0gYXdhaXQgaW1wb3J0KFwibm9kZTpmcy9wcm9taXNlc1wiKVxuICAgIGNvbnN0IHBhdGggPSBhd2FpdCBpbXBvcnQoXCJub2RlOnBhdGhcIilcbiAgICByZXR1cm4geyBmcywgcGF0aCB9XG4gIH1cblxuICByZXR1cm4gdW5kZWZpbmVkXG59XG4iXX0=
@@ -1,8 +0,0 @@
1
- /**
2
- * Save a descriptor (JSON Object) to a file path
3
- * Works in Node.js environments
4
- */
5
- export declare function saveDescriptor(props: {
6
- descriptor: Record<string, any>;
7
- path: string;
8
- }): Promise<boolean>;
@@ -1,17 +0,0 @@
1
- import { loadNodeApis } from "./node.js";
2
- /**
3
- * Save a descriptor (JSON Object) to a file path
4
- * Works in Node.js environments
5
- */
6
- export async function saveDescriptor(props) {
7
- const { descriptor, path } = props;
8
- const node = await loadNodeApis();
9
- if (!node) {
10
- throw new Error("File system is not supported in this environment");
11
- }
12
- const content = JSON.stringify(descriptor, null, 2);
13
- await node.fs.mkdir(node.path.dirname(path), { recursive: true });
14
- await node.fs.writeFile(path, content, "utf-8");
15
- return true;
16
- }
17
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2F2ZS5qc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MgZW52aXJvbm1lbnRzXG4gKi9cbmV4cG9ydCBhc3luYyBmdW5jdGlvbiBzYXZlRGVzY3JpcHRvcihwcm9wczoge1xuICBkZXNjcmlwdG9yOiBSZWNvcmQ8c3RyaW5nLCBhbnk+XG4gIHBhdGg6IHN0cmluZ1xufSkge1xuICBjb25zdCB7IGRlc2NyaXB0b3IsIHBhdGggfSA9IHByb3BzXG5cbiAgY29uc3Qgbm9kZSA9IGF3YWl0IGxvYWROb2RlQXBpcygpXG4gIGlmICghbm9kZSkge1xuICAgIHRocm93IG5ldyBFcnJvcihcIkZpbGUgc3lzdGVtIGlzIG5vdCBzdXBwb3J0ZWQgaW4gdGhpcyBlbnZpcm9ubWVudFwiKVxuICB9XG5cbiAgY29uc3QgY29udGVudCA9IEpTT04uc3RyaW5naWZ5KGRlc2NyaXB0b3IsIG51bGwsIDIpXG5cbiAgYXdhaXQgbm9kZS5mcy5ta2Rpcihub2RlLnBhdGguZGlybmFtZShwYXRoKSwgeyByZWN1cnNpdmU6IHRydWUgfSlcbiAgYXdhaXQgbm9kZS5mcy53cml0ZUZpbGUocGF0aCwgY29udGVudCwgXCJ1dGYtOFwiKVxuXG4gIHJldHVybiB0cnVlXG59XG4iXX0=
@@ -1,80 +0,0 @@
1
- import * as fs from "node:fs/promises";
2
- import * as path from "node:path";
3
- import { temporaryDirectory } from "tempy";
4
- import { afterEach, beforeEach, describe, expect, it } from "vitest";
5
- import { saveDescriptor } from "./save.js";
6
- describe("saveDescriptor", () => {
7
- const testDescriptor = {
8
- name: "test-descriptor",
9
- version: "1.0.0",
10
- description: "Test descriptor for save function",
11
- resources: [
12
- {
13
- name: "resource1",
14
- path: "data/resource1.csv",
15
- },
16
- ],
17
- };
18
- let testDir;
19
- let testPath;
20
- beforeEach(() => {
21
- testDir = temporaryDirectory();
22
- testPath = path.join(testDir, "descriptor.json");
23
- });
24
- afterEach(async () => {
25
- try {
26
- await fs.rm(testDir, { recursive: true, force: true });
27
- }
28
- catch (error) {
29
- if (error instanceof Error && !error.message.includes("ENOENT")) {
30
- console.error(`Failed to clean up test directory: ${testDir}`, error);
31
- }
32
- }
33
- });
34
- it("should save a descriptor to the specified path", async () => {
35
- const result = await saveDescriptor({
36
- descriptor: testDescriptor,
37
- path: testPath,
38
- });
39
- expect(result).toBe(true);
40
- const fileExists = await fs
41
- .stat(testPath)
42
- .then(() => true)
43
- .catch(() => false);
44
- expect(fileExists).toBe(true);
45
- const content = await fs.readFile(testPath, "utf-8");
46
- const parsedContent = JSON.parse(content);
47
- expect(parsedContent).toEqual(testDescriptor);
48
- });
49
- it("should save a descriptor to a nested directory path", async () => {
50
- const nestedPath = path.join(testDir, "nested", "dir", "descriptor.json");
51
- const result = await saveDescriptor({
52
- descriptor: testDescriptor,
53
- path: nestedPath,
54
- });
55
- expect(result).toBe(true);
56
- const fileExists = await fs
57
- .stat(nestedPath)
58
- .then(() => true)
59
- .catch(() => false);
60
- expect(fileExists).toBe(true);
61
- const content = await fs.readFile(nestedPath, "utf-8");
62
- const parsedContent = JSON.parse(content);
63
- expect(parsedContent).toEqual(testDescriptor);
64
- });
65
- it("should use pretty formatting with 2-space indentation", async () => {
66
- await saveDescriptor({
67
- descriptor: testDescriptor,
68
- path: testPath,
69
- });
70
- const content = await fs.readFile(testPath, "utf-8");
71
- const expectedFormat = JSON.stringify(testDescriptor, null, 2);
72
- expect(content).toEqual(expectedFormat);
73
- const lines = content.split("\n");
74
- expect(lines.length).toBeGreaterThan(1);
75
- if (lines.length > 1 && lines[1]) {
76
- expect(lines[1].startsWith(" ")).toBe(true);
77
- }
78
- });
79
- });
80
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2F2ZS5zcGVjLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vZGVzY3JpcHRvci9zYXZlLnNwZWMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsTUFBT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AgIGlmIChsaW5lcy5sZW5ndGggPiAxICYmIGxpbmVzWzFdKSB7XG4gICAgICBleHBlY3QobGluZXNbMV0uc3RhcnRzV2l0aChcIiAgXCIpKS50b0JlKHRydWUpXG4gICAgfVxuICB9KVxufSlcbiJdfQ==
@@ -1,9 +0,0 @@
1
- /**
2
- * Validate a descriptor (JSON Object) against a JSON Schema
3
- * It uses Ajv for JSON Schema validation under the hood
4
- * It returns a list of errors (empty if valid)
5
- */
6
- export declare function validateDescriptor(props: {
7
- descriptor: Record<string, any>;
8
- profile: Record<string, any>;
9
- }): Promise<import("ajv").ErrorObject<string, Record<string, any>, unknown>[]>;
@@ -1,14 +0,0 @@
1
- import { Ajv } from "ajv";
2
- /**
3
- * Validate a descriptor (JSON Object) against a JSON Schema
4
- * It uses Ajv for JSON Schema validation under the hood
5
- * It returns a list of errors (empty if valid)
6
- */
7
- export async function validateDescriptor(props) {
8
- const { descriptor, profile } = props;
9
- const ajv = new Ajv();
10
- const validate = ajv.compile(profile);
11
- validate(descriptor);
12
- return validate.errors ?? [];
13
- }
14
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsaWRhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9kZXNjcmlwdG9yL3ZhbGlkYXRlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxHQUFHLEVBQUUsTUFBTSxLQUFLLENBQUE7QUFFekI7Ozs7R0FJRztBQUNILE1BQU0sQ0FBQyxLQUFLLFVBQVUsa0JBQWtCLENBQUMsS0FHeEM7SUFDQyxNQUFNLEVBQUUsVUFBVSxFQUFFLE9BQU8sRUFBRSxHQUFHLEtBQUssQ0FBQTtJQUVyQyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsRUFBRSxDQUFBO0lBQ3JCLE1BQU0sUUFBUSxHQUFHLEdBQUcsQ0FBQyxPQUFPLENBQUM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