@xyd-js/cli 0.1.0-xyd.2 → 0.1.0-xyd.20

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 (83) hide show
  1. package/.cli/bin.js +3 -0
  2. package/.cli/index.js +24939 -0
  3. package/.cli/package-lock.json +7519 -0
  4. package/.cli/package.json +37 -0
  5. package/.cli/plugins/xyd-plugin-zero/src/pages/api-reference.tsx +79 -202
  6. package/.cli/plugins/xyd-plugin-zero/src/pages/docs.tsx +12 -3
  7. package/package.json +13 -15
  8. package/postinstall.js +15 -0
  9. package/.cli/dist/index.d.ts +0 -1
  10. package/.cli/dist/index.js +0 -12417
  11. package/.cli/host/.react-router/types/app/+types/root.ts +0 -40
  12. package/.cli/host/node_modules/.vite/deps/@mdx-js_mdx.js +0 -81
  13. package/.cli/host/node_modules/.vite/deps/@mdx-js_mdx.js.map +0 -7
  14. package/.cli/host/node_modules/.vite/deps/@mdx-js_rollup.js +0 -4003
  15. package/.cli/host/node_modules/.vite/deps/@mdx-js_rollup.js.map +0 -7
  16. package/.cli/host/node_modules/.vite/deps/@radix-ui_react-icons.js +0 -7531
  17. package/.cli/host/node_modules/.vite/deps/@radix-ui_react-icons.js.map +0 -7
  18. package/.cli/host/node_modules/.vite/deps/@radix-ui_react-tabs.js +0 -917
  19. package/.cli/host/node_modules/.vite/deps/@radix-ui_react-tabs.js.map +0 -7
  20. package/.cli/host/node_modules/.vite/deps/_metadata.json +0 -157
  21. package/.cli/host/node_modules/.vite/deps/chunk-2TUXWMP5.js +0 -46
  22. package/.cli/host/node_modules/.vite/deps/chunk-2TUXWMP5.js.map +0 -7
  23. package/.cli/host/node_modules/.vite/deps/chunk-DNIFH2K7.js +0 -3461
  24. package/.cli/host/node_modules/.vite/deps/chunk-DNIFH2K7.js.map +0 -7
  25. package/.cli/host/node_modules/.vite/deps/chunk-ERHH4CDL.js +0 -23875
  26. package/.cli/host/node_modules/.vite/deps/chunk-ERHH4CDL.js.map +0 -7
  27. package/.cli/host/node_modules/.vite/deps/chunk-ETJV5QNK.js +0 -27
  28. package/.cli/host/node_modules/.vite/deps/chunk-ETJV5QNK.js.map +0 -7
  29. package/.cli/host/node_modules/.vite/deps/chunk-GPEJJ3KZ.js +0 -1906
  30. package/.cli/host/node_modules/.vite/deps/chunk-GPEJJ3KZ.js.map +0 -7
  31. package/.cli/host/node_modules/.vite/deps/chunk-IVP26VTC.js +0 -21
  32. package/.cli/host/node_modules/.vite/deps/chunk-IVP26VTC.js.map +0 -7
  33. package/.cli/host/node_modules/.vite/deps/chunk-MJUUSK53.js +0 -894
  34. package/.cli/host/node_modules/.vite/deps/chunk-MJUUSK53.js.map +0 -7
  35. package/.cli/host/node_modules/.vite/deps/chunk-NHN7DW4J.js +0 -928
  36. package/.cli/host/node_modules/.vite/deps/chunk-NHN7DW4J.js.map +0 -7
  37. package/.cli/host/node_modules/.vite/deps/chunk-OO6QDGMA.js +0 -10609
  38. package/.cli/host/node_modules/.vite/deps/chunk-OO6QDGMA.js.map +0 -7
  39. package/.cli/host/node_modules/.vite/deps/chunk-OUN4SSIE.js +0 -205
  40. package/.cli/host/node_modules/.vite/deps/chunk-OUN4SSIE.js.map +0 -7
  41. package/.cli/host/node_modules/.vite/deps/chunk-TKNG6GUJ.js +0 -894
  42. package/.cli/host/node_modules/.vite/deps/chunk-TKNG6GUJ.js.map +0 -7
  43. package/.cli/host/node_modules/.vite/deps/chunk-TM4FKLNO.js +0 -21628
  44. package/.cli/host/node_modules/.vite/deps/chunk-TM4FKLNO.js.map +0 -7
  45. package/.cli/host/node_modules/.vite/deps/chunk-V2IF7L2E.js +0 -12
  46. package/.cli/host/node_modules/.vite/deps/chunk-V2IF7L2E.js.map +0 -7
  47. package/.cli/host/node_modules/.vite/deps/gray-matter.js +0 -3492
  48. package/.cli/host/node_modules/.vite/deps/gray-matter.js.map +0 -7
  49. package/.cli/host/node_modules/.vite/deps/lucide-react.js +0 -34742
  50. package/.cli/host/node_modules/.vite/deps/lucide-react.js.map +0 -7
  51. package/.cli/host/node_modules/.vite/deps/package.json +0 -3
  52. package/.cli/host/node_modules/.vite/deps/react-dom.js +0 -7
  53. package/.cli/host/node_modules/.vite/deps/react-dom.js.map +0 -7
  54. package/.cli/host/node_modules/.vite/deps/react-dom_client.js +0 -39
  55. package/.cli/host/node_modules/.vite/deps/react-dom_client.js.map +0 -7
  56. package/.cli/host/node_modules/.vite/deps/react-router.js +0 -243
  57. package/.cli/host/node_modules/.vite/deps/react-router.js.map +0 -7
  58. package/.cli/host/node_modules/.vite/deps/react-router_dom.js +0 -212
  59. package/.cli/host/node_modules/.vite/deps/react-router_dom.js.map +0 -7
  60. package/.cli/host/node_modules/.vite/deps/react.js +0 -6
  61. package/.cli/host/node_modules/.vite/deps/react.js.map +0 -7
  62. package/.cli/host/node_modules/.vite/deps/react_jsx-dev-runtime.js +0 -913
  63. package/.cli/host/node_modules/.vite/deps/react_jsx-dev-runtime.js.map +0 -7
  64. package/.cli/host/node_modules/.vite/deps/react_jsx-runtime.js +0 -7
  65. package/.cli/host/node_modules/.vite/deps/react_jsx-runtime.js.map +0 -7
  66. package/.cli/host/node_modules/.vite/deps/remark-frontmatter.js +0 -428
  67. package/.cli/host/node_modules/.vite/deps/remark-frontmatter.js.map +0 -7
  68. package/.cli/host/node_modules/.vite/deps/remark-gfm.js +0 -3122
  69. package/.cli/host/node_modules/.vite/deps/remark-gfm.js.map +0 -7
  70. package/.cli/host/node_modules/.vite/deps/remark-mdx-frontmatter.js +0 -10482
  71. package/.cli/host/node_modules/.vite/deps/remark-mdx-frontmatter.js.map +0 -7
  72. package/.cli/host/node_modules/.vite/deps/unist-util-visit.js +0 -14
  73. package/.cli/host/node_modules/.vite/deps/unist-util-visit.js.map +0 -7
  74. package/.cli/host/node_modules/.vite/deps/vfile.js +0 -8
  75. package/.cli/host/node_modules/.vite/deps/vfile.js.map +0 -7
  76. package/.cli/host/package.json +0 -43
  77. package/bin.js +0 -3
  78. /package/.cli/{host/app → app}/root.tsx +0 -0
  79. /package/.cli/{host/app → app}/routes.ts +0 -0
  80. /package/.cli/{host/postcss.config.cjs → postcss.config.cjs} +0 -0
  81. /package/.cli/{host/react-router.config.ts → react-router.config.ts} +0 -0
  82. /package/.cli/{host/tsconfig.json → tsconfig.json} +0 -0
  83. /package/.cli/{host/vite.config.ts → vite.config.ts} +0 -0
@@ -0,0 +1,37 @@
1
+ {
2
+ "private": true,
3
+ "name": "@xyd-js/documan-host",
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "xyd": "bin.js"
9
+ },
10
+ "scripts": {},
11
+ "dependencies": {
12
+ "@xyd-js/theme-poetry": "0.1.0-xyd.16",
13
+ "@xyd-js/react-router-dev": "7.1.1-xyd.3",
14
+ "@readme/oas-to-snippet": "^26.0.1",
15
+ "@react-router/node": "^7.1.1",
16
+ "@react-router/serve": "^7.1.1",
17
+ "@react-router/dev": "^7.1.1",
18
+ "react-router": "^7.1.1",
19
+ "isbot": "^5",
20
+ "remark-frontmatter": "^5.0.0",
21
+ "remark-mdx-frontmatter": "^5.0.0",
22
+ "json-to-graphql-query": "^2.3.0",
23
+ "remark": "^15.0.1",
24
+ "unist-builder": "^4.0.0",
25
+ "oas": "^25.0.3",
26
+ "openapi-sampler": "^1.5.1",
27
+ "json-schema-ref-parser": "^9.0.9"
28
+ },
29
+ "devDependencies": {
30
+ "@mdx-js/rollup": "^3.1.0",
31
+ "vite": "^5.4.9",
32
+ "semver": "^7.6.3",
33
+ "vite-tsconfig-paths": "^5.1.4",
34
+ "autoprefixer": "^10.4.20",
35
+ "postcss": "^8.4.47"
36
+ }
37
+ }
@@ -1,8 +1,8 @@
1
1
  import path from "path";
2
2
  import {promises as fs} from "fs";
3
3
 
4
- import React, {useContext} from "react";
5
- import {redirect, UNSAFE_DataRouterStateContext} from "react-router";
4
+ import React, {} from "react";
5
+ import {redirect} from "react-router";
6
6
  import remarkFrontmatter from "remark-frontmatter";
7
7
  import remarkMdxFrontmatter from "remark-mdx-frontmatter";
8
8
  import remarkGfm from "remark-gfm";
@@ -12,14 +12,11 @@ import {recmaCodeHike, remarkCodeHike} from "codehike/mdx";
12
12
  import {compile as mdxCompile} from "@mdx-js/mdx";
13
13
 
14
14
  import {PageFrontMatter} from "@xyd-js/core";
15
- import {renderoll} from "@xyd-js/foo/renderoll";
16
- import {
17
- AtlasLazy
18
- } from "@xyd-js/atlas";
19
15
  import getContentComponents from "@xyd-js/components/content";
20
16
  import {mapSettingsToProps} from "@xyd-js/framework/hydration";
21
- import {Framework} from "@xyd-js/framework/react";
22
- import type {FwSidebarGroupProps} from "@xyd-js/framework/react";
17
+ import {Framework, type FwSidebarGroupProps} from "@xyd-js/framework/react";
18
+ import {AtlasLazy} from "@xyd-js/atlas";
19
+ import type {IBreadcrumb, INavLinks} from "@xyd-js/ui";
23
20
 
24
21
  import Theme from "virtual:xyd-theme" // TODO: for some reasons this cannot be hydrated by react-router
25
22
  import settings from 'virtual:xyd-settings';
@@ -27,6 +24,15 @@ import settings from 'virtual:xyd-settings';
27
24
  import "virtual:xyd-theme/index.css"
28
25
  import "virtual:xyd-theme-override/index.css"
29
26
 
27
+ interface loaderData {
28
+ sidebarGroups: FwSidebarGroupProps[]
29
+ breadcrumbs: IBreadcrumb[],
30
+ navlinks?: INavLinks,
31
+ toc: PageFrontMatter
32
+ slug: string
33
+ code: string
34
+ }
35
+
30
36
  const contentComponents = getContentComponents()
31
37
  const ComponentContent = contentComponents.Content
32
38
 
@@ -67,8 +73,14 @@ const codeHikeOptions = {
67
73
  // },
68
74
  };
69
75
 
76
+ const compiledBySlug = {}
77
+
70
78
  // TODO: map every file and merge them or load via client-side ?
71
79
  async function compileBySlug(slug: string) {
80
+ if (compiledBySlug[slug]) {
81
+ return compiledBySlug[slug]
82
+ }
83
+ console.time("api-reference compileBySlug")
72
84
  // TODO: cwd ?
73
85
  let filePath = path.join(process.cwd(), `${slug}.md`)
74
86
 
@@ -80,23 +92,37 @@ async function compileBySlug(slug: string) {
80
92
  await fs.access(filePath)
81
93
  }
82
94
 
95
+ console.time("api-reference readFile")
83
96
  const content = await fs.readFile(filePath, "utf-8");
97
+ console.timeEnd("api-reference readFile")
98
+
99
+ console.time("api-reference compile")
100
+ const resp = await compile(content)
101
+ console.timeEnd("api-reference compile")
84
102
 
85
- return await compile(content)
103
+ console.timeEnd("api-reference compileBySlug")
104
+ compiledBySlug[slug] = resp
105
+ return resp
86
106
  }
87
107
 
88
108
  async function compile(content: string): Promise<string> {
89
109
  const compiled = await mdxCompile(content, {
90
110
  remarkPlugins: [
91
111
  normalizeCustomHeadings,
92
- [remarkCodeHike, codeHikeOptions],
112
+ [
113
+ remarkCodeHike,
114
+ codeHikeOptions
115
+ ],
93
116
  remarkFrontmatter,
94
117
  remarkMdxFrontmatter,
95
118
  remarkGfm
96
119
  ],
97
120
  rehypePlugins: [],
98
121
  recmaPlugins: [
99
- [recmaCodeHike, codeHikeOptions]
122
+ [
123
+ recmaCodeHike,
124
+ codeHikeOptions
125
+ ]
100
126
  ],
101
127
  outputFormat: 'function-body',
102
128
  development: false,
@@ -136,42 +162,61 @@ function findFirstUrl(items: any): string {
136
162
  return "";
137
163
  }
138
164
 
165
+ interface data {
166
+ groups: FwSidebarGroupProps[],
167
+ breadcrumbs: IBreadcrumb[]
168
+ navlinks?: INavLinks
169
+ }
170
+
171
+ const mapSettingsToPropsMap: { [key: string]: data } = {}
172
+
139
173
  // TODO: fix any
140
174
  export async function loader({request}: { request: any }) {
141
- const slug = getPathname(request.url)
175
+ console.time("api-reference loader")
176
+ const slug = getPathname(request.url);
142
177
 
143
- let code = ""
144
- let error: any
178
+ let code = "";
179
+ let error: any;
145
180
 
146
181
  try {
147
- code = await compileBySlug(slug)
182
+ code = await compileBySlug(slug);
148
183
  } catch (e) {
149
- error = e
184
+ error = e;
185
+ }
186
+ let data: data
187
+
188
+ if (!mapSettingsToPropsMap[slug]) {
189
+ data = await mapSettingsToProps(
190
+ settings,
191
+ slug
192
+ );
193
+ mapSettingsToPropsMap[slug] = data
194
+ } else {
195
+ data = mapSettingsToPropsMap[slug]
150
196
  }
151
197
 
152
- const {groups: sidebarGroups} = await mapSettingsToProps(
153
- settings,
154
- slug
155
- )
198
+ const {groups: sidebarGroups, breadcrumbs, navlinks} = data;
156
199
 
157
- // TODO: dry with docs.tsx - resolver?
158
200
  if (error) {
159
201
  if (sidebarGroups && error.code === "ENOENT") {
160
- const firstItem = findFirstUrl(sidebarGroups?.[0]?.items)
202
+ const firstItem = findFirstUrl(sidebarGroups?.[0]?.items);
161
203
 
162
204
  if (firstItem) {
163
- return redirect(firstItem)
205
+ return redirect(firstItem);
164
206
  }
165
207
  }
166
208
 
167
- console.error(error)
209
+ console.error(error);
168
210
  }
169
211
 
212
+ console.timeEnd("api-reference loader")
170
213
  return {
171
214
  sidebarGroups,
215
+ breadcrumbs,
216
+ navlinks,
172
217
  slug,
173
- code
174
- } as loaderData
218
+ code,
219
+ } as loaderData;
175
220
  }
176
221
 
177
222
  function mdxExport(code: string) {
@@ -185,157 +230,6 @@ function mdxExport(code: string) {
185
230
  return fn(scope)
186
231
  }
187
232
 
188
- function renderollAsyncClient(routeId: string, slug: string) {
189
- return async () => {
190
- let mod;
191
- let urlPrefix;
192
- let data;
193
-
194
- // TODO: fix any
195
- function moduleData(mods: any, id: string) {
196
- mod = mods.default[id]
197
- if (!mod) {
198
- throw new Error(`Unknown openapi id: ${id}`)
199
- }
200
- urlPrefix = mod.urlPrefix
201
- data = mod.data
202
- }
203
-
204
- switch (routeId) {
205
- case "xyd-plugin-zero/graphql": {
206
- // @ts-ignore
207
- mod = await import("virtual:xyd-plugin-zero/graphql");
208
- urlPrefix = "/docs/api/graphql" // TODO: dynamic urlPreifx
209
- data = mod.default.data
210
- break;
211
- }
212
- case "xyd-plugin-zero/openapi": {
213
- // @ts-ignore
214
- mod = await import("virtual:xyd-plugin-zero/openapi");
215
- urlPrefix = "/docs/api/openapi" // TODO: dynamic urlPrefix
216
- data = mod.default.data
217
- break;
218
- }
219
- default: {
220
- if (routeId.includes("xyd-plugin-zero/openapi")) {
221
- const [_, id] = routeId.split("xyd-plugin-zero/openapi-")
222
- // @ts-ignore
223
- const mods = await import("virtual:xyd-plugin-zero/openapi")
224
- moduleData(mods, id)
225
- break;
226
- }
227
- if (routeId.includes("xyd-plugin-zero/graphql")) {
228
- const [_, id] = routeId.split("xyd-plugin-zero/graphql-")
229
- // @ts-ignore
230
- const mods = await import("virtual:xyd-plugin-zero/graphql")
231
- moduleData(mods, id)
232
- break;
233
- }
234
-
235
- throw new Error(`Unknown routeId: ${routeId}`);
236
- }
237
- }
238
-
239
- if (!Array.isArray(data)) {
240
- console.warn(`mod.default is not an array, current type is: ${typeof mod.default}`)
241
-
242
- return
243
- }
244
-
245
- // TODO: in the future custom position
246
- const prevRefs = []
247
- const nextRefs = []
248
- const mdxComponentsPrev: any[] = []
249
- const mdxComponentsNext: any[] = []
250
-
251
- let pos = 0;
252
-
253
- for (const chunk of data) {
254
- if (!chunk) {
255
- continue
256
- }
257
-
258
- if (chunk.slug === slug) {
259
- pos = 1
260
- continue
261
- }
262
-
263
- const references = pos === 0 ? prevRefs : nextRefs
264
-
265
- const code = await compile(chunk.content) // TODO: do we need real path?
266
- const mdx = mdxExport(code)
267
- const Content = mdx.default
268
- const content = Content ? parse(Content, {
269
- components: contentComponents
270
- }) : null
271
-
272
- // TODO: support non-fererence pages
273
- if (content.references) {
274
- references.push(...(content?.references || []) as [])
275
- } else {
276
- const mdxComponents = pos === 0 ? mdxComponentsPrev : mdxComponentsNext
277
-
278
- mdxComponents.push(<div data-slug={`/${chunk.slug}`}>
279
- <ComponentContent>
280
- {content}
281
- </ComponentContent>
282
- </div>)
283
- }
284
- }
285
-
286
- return [
287
- ({onLoaded}) => <>
288
- <ComponentContent>
289
- {mdxComponentsPrev}
290
- </ComponentContent>
291
-
292
- {
293
- prevRefs.length ? <div>
294
- <AtlasLazy
295
- references={prevRefs}
296
- urlPrefix={urlPrefix}
297
- slug={slug}
298
- onLoaded={onLoaded}
299
- />
300
- </div> : null
301
- }
302
- </>,
303
-
304
- ({onLoaded}) => <>
305
- <ComponentContent>
306
- {mdxComponentsNext}
307
- </ComponentContent>
308
-
309
- {
310
- nextRefs.length ? <div>
311
- <AtlasLazy
312
- references={nextRefs}
313
- urlPrefix={urlPrefix}
314
- slug={slug}
315
- onLoaded={onLoaded}
316
- />
317
- </div> : null
318
- }
319
- </>
320
- ]
321
- }
322
- }
323
-
324
- function getRouteId() {
325
- const routerState = useContext(UNSAFE_DataRouterStateContext)
326
- let routeId: string = ""
327
-
328
- routerState?.matches?.forEach(match => {
329
- const loader = routerState?.loaderData[match?.route?.id]
330
-
331
- if (loader) {
332
- routeId = match?.route?.id
333
- }
334
- })
335
-
336
- return routeId
337
- }
338
-
339
233
  function MemoMDXComponent(codeComponent: any) {
340
234
  return React.useMemo(
341
235
  () => codeComponent ? codeComponent : null,
@@ -364,30 +258,11 @@ export default function APIReference({loaderData}: { loaderData: loaderData }) {
364
258
 
365
259
  const memoizedServerComponent = MemoMDXComponent(serverComponent)
366
260
 
367
- const serverAtlasOrMDX = memoizedServerComponent?.references ?
368
- <AtlasLazy
369
- references={memoizedServerComponent?.references || []}
370
- slug={loaderData.slug.startsWith("/") ? loaderData.slug : `/${loaderData.slug}`}
371
- urlPrefix="/"
372
- /> :
373
- <ComponentContent>
374
- {memoizedServerComponent}
375
- </ComponentContent>
376
-
377
- const routeId = getRouteId()
378
-
379
- const RenderollContent = renderoll(
380
- renderollAsyncClient(routeId, loaderData.slug),
381
- {
382
- decorator: ({children}) => <ComponentContent>
383
- {children}
384
- </ComponentContent>
385
- }
386
- )
387
-
388
261
  return <Framework
389
262
  settings={settings}
390
- sidebarGroups={loaderData.sidebarGroups}
263
+ sidebarGroups={loaderData.sidebarGroups || []}
264
+ breadcrumbs={loaderData.breadcrumbs || []}
265
+ navlinks={loaderData.navlinks}
391
266
  >
392
267
  <Theme
393
268
  themeSettings={{
@@ -398,9 +273,11 @@ export default function APIReference({loaderData}: { loaderData: loaderData }) {
398
273
  }
399
274
  }}
400
275
  >
401
- <RenderollContent>
402
- {serverAtlasOrMDX}
403
- </RenderollContent>
276
+ <AtlasLazy
277
+ references={memoizedServerComponent?.references || []}
278
+ slug={loaderData.slug.startsWith("/") ? loaderData.slug : `/${loaderData.slug}`}
279
+ urlPrefix="/"
280
+ />
404
281
  </Theme>
405
282
  </Framework>
406
283
  }
@@ -5,12 +5,11 @@ import {redirect} from "react-router";
5
5
 
6
6
  import {PageFrontMatter} from "@xyd-js/core"
7
7
  import {compileBySlug} from "@xyd-js/content"
8
+ import {mapSettingsToProps} from "@xyd-js/framework/hydration";
9
+ import {Framework, FwNav, type FwSidebarGroupProps} from "@xyd-js/framework/react";
8
10
  import getContentComponents from "@xyd-js/components/content";
9
11
  import {HomePage} from "@xyd-js/components/pages";
10
12
  import type {IBreadcrumb, INavLinks} from "@xyd-js/ui";
11
- import {mapSettingsToProps} from "@xyd-js/framework/hydration";
12
- import {Framework, FwNav} from "@xyd-js/framework/react";
13
- import type {FwSidebarGroupProps} from "@xyd-js/framework/react";
14
13
 
15
14
  import settings from 'virtual:xyd-settings';
16
15
  import Theme from "virtual:xyd-theme";
@@ -48,6 +47,15 @@ export async function loader({request}: { request: any }) {
48
47
  return {}
49
48
  }
50
49
 
50
+ // TODO: in the future map instead of arr
51
+ if (settings.redirects && settings.redirects.length) {
52
+ for (const item of settings.redirects) {
53
+ if (item.source === getPathname(request.url)) {
54
+ return redirect(item.destination)
55
+ }
56
+ }
57
+ }
58
+
51
59
  let code = ""
52
60
  let error: any
53
61
 
@@ -87,6 +95,7 @@ export async function loader({request}: { request: any }) {
87
95
  console.error(error)
88
96
  }
89
97
 
98
+ console.timeEnd("docs loader")
90
99
  return {
91
100
  sidebarGroups,
92
101
  breadcrumbs,
package/package.json CHANGED
@@ -1,18 +1,17 @@
1
1
  {
2
2
  "name": "@xyd-js/cli",
3
- "version": "0.1.0-xyd.2",
3
+ "version": "0.1.0-xyd.20",
4
4
  "keywords": [],
5
5
  "author": "",
6
6
  "description": "",
7
7
  "type": "module",
8
- "main": "./.cli/dist/index.js",
8
+ "main": ".cli/index.js",
9
9
  "bin": {
10
- "xyd": "bin.js"
10
+ "xyd": ".cli/bin.js"
11
11
  },
12
12
  "files": [
13
- ".cli/",
14
- "bin.js",
15
- "README.md"
13
+ ".cli",
14
+ "postinstall.js"
16
15
  ],
17
16
  "dependencies": {
18
17
  "@xyd-js/react-router-dev": "7.1.1-xyd.3",
@@ -22,8 +21,8 @@
22
21
  "codehike": "^1.0.3",
23
22
  "express": "^4.21.1",
24
23
  "isbot": "^5.1.17",
25
- "react": "^18.3.1",
26
- "react-dom": "^18.3.1",
24
+ "react": "^19.0.0",
25
+ "react-dom": "^19.0.0",
27
26
  "react-router": "^7.1.1",
28
27
  "remark-frontmatter": "^5.0.0",
29
28
  "remark-gfm": "^4.0.0",
@@ -55,19 +54,18 @@
55
54
  "lightningcss": "^1.27.0",
56
55
  "morgan": "^1.10.0",
57
56
  "source-map-support": "^0.5.21",
58
- "@xyd-js/components": "0.1.0-xyd.0",
59
- "@xyd-js/content": "0.1.0-xyd.3",
60
- "@xyd-js/framework": "0.1.0-xyd.3",
61
- "@xyd-js/atlas": "0.1.0-xyd.4",
62
- "@xyd-js/theme-poetry": "0.1.0-xyd.2"
57
+ "vite-tsconfig-paths": "^5.1.4"
63
58
  },
64
59
  "devDependencies": {
60
+ "tsup": "^8.3.0",
65
61
  "arg": "^5.0.2",
66
62
  "colors": "^1.4.0",
67
63
  "semver": "^7.6.3",
68
- "@xyd-js/documan": "0.1.0-xyd.2"
64
+ "vite-tsconfig-paths": "^5.1.4",
65
+ "@xyd-js/documan": "0.1.0-xyd.19"
69
66
  },
70
67
  "scripts": {
71
- "build": "tsup"
68
+ "build": "tsup",
69
+ "postinstall": "node postinstall.js"
72
70
  }
73
71
  }
package/postinstall.js ADDED
@@ -0,0 +1,15 @@
1
+ import { execSync } from 'child_process';
2
+ import { existsSync } from 'fs';
3
+
4
+ const cliDir = '.cli';
5
+
6
+ if (existsSync(cliDir)) {
7
+ try {
8
+ execSync(`cd ${cliDir} && npm install`, { stdio: 'inherit' });
9
+ console.log('Dependencies installed successfully in .cli directory.');
10
+ } catch (error) {
11
+ console.error('Failed to install dependencies in .cli directory:', error);
12
+ }
13
+ } else {
14
+ console.log('.cli directory does not exist. Skipping npm install.');
15
+ }
@@ -1 +0,0 @@
1
- #!/usr/bin/env node