@fumadocs/cli 1.0.0 → 1.0.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/dist/build/index.d.ts +5 -2
- package/dist/build/index.js +36 -22
- package/dist/index.js +5 -7
- package/package.json +4 -6
package/dist/build/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as ts_morph from 'ts-morph';
|
|
3
|
-
import { Registry as Registry$1 } from 'shadcn/
|
|
3
|
+
import { Registry as Registry$1 } from 'shadcn/schema';
|
|
4
4
|
|
|
5
5
|
type Output = z.infer<typeof rootSchema>;
|
|
6
6
|
type NamespaceType = (typeof namespaces)[number];
|
|
@@ -124,7 +124,10 @@ interface Registry {
|
|
|
124
124
|
}
|
|
125
125
|
declare function build(registry: Registry): Promise<Output>;
|
|
126
126
|
|
|
127
|
-
declare function toShadcnRegistry(out: Output, baseUrl: string):
|
|
127
|
+
declare function toShadcnRegistry(out: Output, baseUrl: string): {
|
|
128
|
+
registry: Registry$1;
|
|
129
|
+
index: Registry$1;
|
|
130
|
+
};
|
|
128
131
|
|
|
129
132
|
declare function combineRegistry(...items: Output[]): Output;
|
|
130
133
|
declare function writeShadcnRegistry(out: Output, options: {
|
package/dist/build/index.js
CHANGED
|
@@ -14,13 +14,38 @@ function escapeName(name) {
|
|
|
14
14
|
return name;
|
|
15
15
|
}
|
|
16
16
|
function toShadcnRegistry(out, baseUrl) {
|
|
17
|
-
|
|
17
|
+
const registry = {
|
|
18
18
|
homepage: baseUrl,
|
|
19
19
|
name: out.name,
|
|
20
20
|
items: out.components.map((comp) => componentToShadcn(comp, baseUrl))
|
|
21
21
|
};
|
|
22
|
+
return {
|
|
23
|
+
registry,
|
|
24
|
+
index: {
|
|
25
|
+
...registry,
|
|
26
|
+
items: out.components.map(
|
|
27
|
+
(comp) => componentToShadcn(comp, baseUrl, true)
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
};
|
|
22
31
|
}
|
|
23
|
-
function componentToShadcn(comp, baseUrl) {
|
|
32
|
+
function componentToShadcn(comp, baseUrl, noFile = false) {
|
|
33
|
+
const FileType = {
|
|
34
|
+
components: "registry:component",
|
|
35
|
+
lib: "registry:lib",
|
|
36
|
+
css: "registry:style",
|
|
37
|
+
route: "registry:page",
|
|
38
|
+
ui: "registry:ui",
|
|
39
|
+
block: "registry:block"
|
|
40
|
+
};
|
|
41
|
+
function onFile(file) {
|
|
42
|
+
return {
|
|
43
|
+
type: FileType[file.type],
|
|
44
|
+
content: file.content,
|
|
45
|
+
path: file.path,
|
|
46
|
+
target: file.target
|
|
47
|
+
};
|
|
48
|
+
}
|
|
24
49
|
return {
|
|
25
50
|
extends: "none",
|
|
26
51
|
type: "registry:block",
|
|
@@ -34,21 +59,7 @@ function componentToShadcn(comp, baseUrl) {
|
|
|
34
59
|
return comp2;
|
|
35
60
|
return new URL(`/r/${escapeName(comp2)}.json`, baseUrl).toString();
|
|
36
61
|
}),
|
|
37
|
-
files: comp.files.map(
|
|
38
|
-
return {
|
|
39
|
-
type: {
|
|
40
|
-
components: "registry:component",
|
|
41
|
-
lib: "registry:lib",
|
|
42
|
-
css: "registry:style",
|
|
43
|
-
route: "registry:page",
|
|
44
|
-
ui: "registry:ui",
|
|
45
|
-
block: "registry:block"
|
|
46
|
-
}[file.type],
|
|
47
|
-
content: file.content,
|
|
48
|
-
path: file.path,
|
|
49
|
-
target: file.target
|
|
50
|
-
};
|
|
51
|
-
})
|
|
62
|
+
files: noFile ? [] : comp.files.map(onFile)
|
|
52
63
|
};
|
|
53
64
|
}
|
|
54
65
|
|
|
@@ -349,12 +360,15 @@ async function writeShadcnRegistry(out, options) {
|
|
|
349
360
|
});
|
|
350
361
|
console.log(picocolors.bold(picocolors.greenBright("Cleaned directory")));
|
|
351
362
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
363
|
+
const { registry, index } = toShadcnRegistry(out, baseUrl);
|
|
364
|
+
const write = registry.items.map(async (item) => {
|
|
365
|
+
const file = path4.join(dir, `${item.name}.json`);
|
|
366
|
+
await writeFile2(file, JSON.stringify(item, null, 2));
|
|
367
|
+
});
|
|
368
|
+
write.push(
|
|
369
|
+
writeFile2(path4.join(dir, "registry.json"), JSON.stringify(index, null, 2))
|
|
357
370
|
);
|
|
371
|
+
await Promise.all(write);
|
|
358
372
|
}
|
|
359
373
|
async function writeFumadocsRegistry(out, options) {
|
|
360
374
|
const { dir, cleanDir = false, log = true } = options;
|
package/dist/index.js
CHANGED
|
@@ -343,7 +343,7 @@ async function runTree(args) {
|
|
|
343
343
|
// package.json
|
|
344
344
|
var package_default = {
|
|
345
345
|
name: "@fumadocs/cli",
|
|
346
|
-
version: "1.0.
|
|
346
|
+
version: "1.0.1",
|
|
347
347
|
description: "The CLI tool for Fumadocs",
|
|
348
348
|
keywords: [
|
|
349
349
|
"NextJs",
|
|
@@ -373,7 +373,6 @@ var package_default = {
|
|
|
373
373
|
clean: "rimraf dist",
|
|
374
374
|
dev: "tsup --watch",
|
|
375
375
|
lint: "eslint .",
|
|
376
|
-
sync: "tsx ./scripts/sync.ts",
|
|
377
376
|
"types:check": "tsc --noEmit"
|
|
378
377
|
},
|
|
379
378
|
dependencies: {
|
|
@@ -383,14 +382,13 @@ var package_default = {
|
|
|
383
382
|
picocolors: "^1.1.1",
|
|
384
383
|
tinyexec: "^1.0.1",
|
|
385
384
|
"ts-morph": "^26.0.0",
|
|
386
|
-
zod: "^4.
|
|
385
|
+
zod: "^4.1.4"
|
|
387
386
|
},
|
|
388
387
|
devDependencies: {
|
|
389
|
-
|
|
390
|
-
"@types/node": "24.2.1",
|
|
388
|
+
"@types/node": "24.3.0",
|
|
391
389
|
"eslint-config-custom": "workspace:*",
|
|
392
|
-
|
|
393
|
-
|
|
390
|
+
shadcn: "3.0.0",
|
|
391
|
+
tsconfig: "workspace:*"
|
|
394
392
|
},
|
|
395
393
|
publishConfig: {
|
|
396
394
|
access: "public"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fumadocs/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "The CLI tool for Fumadocs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -32,12 +32,11 @@
|
|
|
32
32
|
"picocolors": "^1.1.1",
|
|
33
33
|
"tinyexec": "^1.0.1",
|
|
34
34
|
"ts-morph": "^26.0.0",
|
|
35
|
-
"zod": "^4.
|
|
35
|
+
"zod": "^4.1.4"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"tsx": "^4.20.3",
|
|
38
|
+
"@types/node": "24.3.0",
|
|
39
|
+
"shadcn": "3.0.0",
|
|
41
40
|
"eslint-config-custom": "0.0.0",
|
|
42
41
|
"tsconfig": "0.0.0"
|
|
43
42
|
},
|
|
@@ -49,7 +48,6 @@
|
|
|
49
48
|
"clean": "rimraf dist",
|
|
50
49
|
"dev": "tsup --watch",
|
|
51
50
|
"lint": "eslint .",
|
|
52
|
-
"sync": "tsx ./scripts/sync.ts",
|
|
53
51
|
"types:check": "tsc --noEmit"
|
|
54
52
|
}
|
|
55
53
|
}
|