mintlify 1.0.3 → 1.0.4
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/package.json +1 -1
- package/src/index.ts +4 -3
- package/src/util.ts +7 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { writeFileSync } from "fs";
|
|
4
4
|
import inquirer from "inquirer";
|
|
5
|
-
import { MintConfig
|
|
6
|
-
import { toFilename } from "./util.js";
|
|
5
|
+
import { MintConfig } from "./templates.js";
|
|
6
|
+
import { createPage, toFilename } from "./util.js";
|
|
7
7
|
|
|
8
8
|
const args = process.argv.slice(2);
|
|
9
9
|
|
|
@@ -59,6 +59,7 @@ if (command === "init") {
|
|
|
59
59
|
"\t"
|
|
60
60
|
)
|
|
61
61
|
);
|
|
62
|
+
createPage(title);
|
|
62
63
|
console.log("🌱 Created initial files for Mintlify docs");
|
|
63
64
|
process.exit(1);
|
|
64
65
|
})
|
|
@@ -86,7 +87,7 @@ if (command === "page") {
|
|
|
86
87
|
.then((answers) => {
|
|
87
88
|
const { title, description } = answers;
|
|
88
89
|
|
|
89
|
-
|
|
90
|
+
createPage(title, description);
|
|
90
91
|
console.log("🌱 Created initial files for Mintlify docs");
|
|
91
92
|
process.exit(1);
|
|
92
93
|
})
|
package/src/util.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { writeFileSync } from "fs";
|
|
2
|
+
import { Page } from "./templates.js";
|
|
3
|
+
|
|
1
4
|
export const toFilename = (title: string) => {
|
|
2
5
|
return title.replace(/[^a-z0-9]/gi, "-").toLowerCase();
|
|
3
6
|
};
|
|
7
|
+
|
|
8
|
+
export const createPage = (title: string, description?: string) => {
|
|
9
|
+
return writeFileSync(toFilename(title), Page(title, description));
|
|
10
|
+
};
|