@fumadocs/cli 0.0.7 → 0.0.8
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/index.js +41 -35
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -238,7 +238,7 @@ async function init(plugin, config = {}) {
|
|
|
238
238
|
if (value) {
|
|
239
239
|
await plugin.transform(ctx);
|
|
240
240
|
note(
|
|
241
|
-
`You can format the output with Prettier or other code
|
|
241
|
+
`You can format the output with Prettier or other code formatting tools
|
|
242
242
|
prettier . --write`,
|
|
243
243
|
picocolors.bold(picocolors.green("Changes Applied"))
|
|
244
244
|
);
|
|
@@ -510,6 +510,10 @@ import fs5 from "node:fs/promises";
|
|
|
510
510
|
import path5 from "node:path";
|
|
511
511
|
var transformExtensions = [".js", ".ts", ".tsx", ".jsx"];
|
|
512
512
|
async function moveFiles(from, to, filter, project, src2, originalDir = from) {
|
|
513
|
+
function isIncluded(file) {
|
|
514
|
+
if (!transformExtensions.includes(path5.extname(file))) return false;
|
|
515
|
+
return filter(path5.resolve(file));
|
|
516
|
+
}
|
|
513
517
|
const stats = await fs5.lstat(from).catch(() => void 0);
|
|
514
518
|
if (!stats) return;
|
|
515
519
|
if (stats.isDirectory()) {
|
|
@@ -517,8 +521,8 @@ async function moveFiles(from, to, filter, project, src2, originalDir = from) {
|
|
|
517
521
|
await Promise.all(
|
|
518
522
|
items.map(async (item) => {
|
|
519
523
|
await moveFiles(
|
|
520
|
-
path5.
|
|
521
|
-
path5.
|
|
524
|
+
path5.join(from, item),
|
|
525
|
+
path5.join(to, item),
|
|
522
526
|
filter,
|
|
523
527
|
project,
|
|
524
528
|
src2,
|
|
@@ -529,31 +533,31 @@ async function moveFiles(from, to, filter, project, src2, originalDir = from) {
|
|
|
529
533
|
await fs5.rmdir(from).catch(() => {
|
|
530
534
|
});
|
|
531
535
|
}
|
|
532
|
-
if (!stats.isFile()) return;
|
|
533
|
-
const
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
alias: {
|
|
544
|
-
type: "append",
|
|
545
|
-
dir: src2 ? "src" : ""
|
|
546
|
-
},
|
|
547
|
-
relativeTo: path5.dirname(from)
|
|
536
|
+
if (!stats.isFile() || !await isIncluded(from)) return;
|
|
537
|
+
const content = await fs5.readFile(from);
|
|
538
|
+
const sourceFile = project.createSourceFile(from, content.toString(), {
|
|
539
|
+
overwrite: true
|
|
540
|
+
});
|
|
541
|
+
await transformReferences(
|
|
542
|
+
sourceFile,
|
|
543
|
+
{
|
|
544
|
+
alias: {
|
|
545
|
+
type: "append",
|
|
546
|
+
dir: src2 ? "src" : ""
|
|
548
547
|
},
|
|
549
|
-
(
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
548
|
+
relativeTo: path5.dirname(from)
|
|
549
|
+
},
|
|
550
|
+
async (resolved) => {
|
|
551
|
+
if (resolved.type !== "file") return;
|
|
552
|
+
if (
|
|
553
|
+
// ignore if the file is also moved
|
|
554
|
+
isRelative(originalDir, from) && await isIncluded(resolved.path)
|
|
555
|
+
)
|
|
556
|
+
return;
|
|
557
|
+
return toReferencePath(to, resolved.path);
|
|
558
|
+
}
|
|
559
|
+
);
|
|
560
|
+
await sourceFile.save();
|
|
557
561
|
await fs5.mkdir(path5.dirname(to), { recursive: true });
|
|
558
562
|
await fs5.rename(from, to);
|
|
559
563
|
}
|
|
@@ -707,7 +711,9 @@ export default async function Page({
|
|
|
707
711
|
resolveAppPath("./app", ctx.src),
|
|
708
712
|
resolveAppPath("./app/[lang]", ctx.src),
|
|
709
713
|
(v) => {
|
|
710
|
-
|
|
714
|
+
const parsed = path7.parse(v);
|
|
715
|
+
if (parsed.ext === ".css") return false;
|
|
716
|
+
return parsed.name !== "layout.config" && !isRelative("./app/api", v);
|
|
711
717
|
},
|
|
712
718
|
project,
|
|
713
719
|
ctx.src
|
|
@@ -902,7 +908,7 @@ async function runTree(args) {
|
|
|
902
908
|
// package.json
|
|
903
909
|
var package_default = {
|
|
904
910
|
name: "@fumadocs/cli",
|
|
905
|
-
version: "0.0.
|
|
911
|
+
version: "0.0.8",
|
|
906
912
|
description: "The CLI tool for Fumadocs",
|
|
907
913
|
keywords: [
|
|
908
914
|
"NextJs",
|
|
@@ -936,17 +942,17 @@ var package_default = {
|
|
|
936
942
|
"types:check": "tsc --noEmit"
|
|
937
943
|
},
|
|
938
944
|
dependencies: {
|
|
939
|
-
"@clack/prompts": "^0.
|
|
940
|
-
commander: "^13.
|
|
945
|
+
"@clack/prompts": "^0.10.0",
|
|
946
|
+
commander: "^13.1.0",
|
|
941
947
|
execa: "^9.5.2",
|
|
942
|
-
"package-manager-detector": "^0.2.
|
|
948
|
+
"package-manager-detector": "^0.2.9",
|
|
943
949
|
picocolors: "^1.1.1",
|
|
944
|
-
"ts-morph": "^25.0.
|
|
950
|
+
"ts-morph": "^25.0.1"
|
|
945
951
|
},
|
|
946
952
|
devDependencies: {
|
|
947
953
|
"@types/cross-spawn": "^6.0.6",
|
|
948
|
-
"@types/node": "22.
|
|
949
|
-
"@types/react": "^19.0.
|
|
954
|
+
"@types/node": "22.13.1",
|
|
955
|
+
"@types/react": "^19.0.8",
|
|
950
956
|
"eslint-config-custom": "workspace:*",
|
|
951
957
|
"fast-glob": "^3.3.3",
|
|
952
958
|
tsconfig: "workspace:*",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fumadocs/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "The CLI tool for Fumadocs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -26,17 +26,17 @@
|
|
|
26
26
|
"dist/*"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@clack/prompts": "^0.
|
|
30
|
-
"commander": "^13.
|
|
29
|
+
"@clack/prompts": "^0.10.0",
|
|
30
|
+
"commander": "^13.1.0",
|
|
31
31
|
"execa": "^9.5.2",
|
|
32
|
-
"package-manager-detector": "^0.2.
|
|
32
|
+
"package-manager-detector": "^0.2.9",
|
|
33
33
|
"picocolors": "^1.1.1",
|
|
34
|
-
"ts-morph": "^25.0.
|
|
34
|
+
"ts-morph": "^25.0.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/cross-spawn": "^6.0.6",
|
|
38
|
-
"@types/node": "22.
|
|
39
|
-
"@types/react": "^19.0.
|
|
38
|
+
"@types/node": "22.13.1",
|
|
39
|
+
"@types/react": "^19.0.8",
|
|
40
40
|
"fast-glob": "^3.3.3",
|
|
41
41
|
"tsx": "^4.19.2",
|
|
42
42
|
"eslint-config-custom": "0.0.0",
|