mintlify 1.0.1 → 1.0.2
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/bin/index.js +51 -1
- package/bin/index.js.map +1 -0
- package/bin/templates.js +24 -0
- package/bin/templates.js.map +1 -0
- package/package.json +15 -2
- package/src/index.ts +64 -0
- package/src/templates.ts +29 -0
- package/tsconfig.json +17 -0
package/bin/index.js
CHANGED
|
@@ -1,2 +1,52 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import { writeFileSync } from "fs";
|
|
3
|
+
import inquirer from "inquirer";
|
|
4
|
+
import { MintConfig } from "./templates.js";
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
if (args.length === 0) {
|
|
7
|
+
console.error(`No command specified. Here are is the list that you can use:\ninit: initialize a Mintlify documentation instance`);
|
|
8
|
+
process.exit(1); //an error occurred
|
|
9
|
+
}
|
|
10
|
+
if (args[0] === "init") {
|
|
11
|
+
inquirer
|
|
12
|
+
.prompt([
|
|
13
|
+
{
|
|
14
|
+
type: "input",
|
|
15
|
+
name: "name",
|
|
16
|
+
message: "What is the name of the organization?",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: "input",
|
|
20
|
+
name: "color",
|
|
21
|
+
message: "What is the primary color of the brand?",
|
|
22
|
+
default: "#3b83f4",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
type: "input",
|
|
26
|
+
name: "ctaName",
|
|
27
|
+
message: "What is the name of the call to action button?",
|
|
28
|
+
default: "Get Started",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: "input",
|
|
32
|
+
name: "ctaUrl",
|
|
33
|
+
message: "What is the URL destination of the call to action button?",
|
|
34
|
+
default: "/",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: "input",
|
|
38
|
+
name: "title",
|
|
39
|
+
message: "What is the title of the first page?",
|
|
40
|
+
default: "Introduction",
|
|
41
|
+
},
|
|
42
|
+
])
|
|
43
|
+
.then((answers) => {
|
|
44
|
+
const { name, color, ctaName, ctaUrl, title } = answers;
|
|
45
|
+
writeFileSync("mint.config.json", JSON.stringify(MintConfig(name, color, ctaName, ctaUrl, title), null, "\t"));
|
|
46
|
+
})
|
|
47
|
+
.catch((error) => {
|
|
48
|
+
console.error(error);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
package/bin/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEnC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;IACrB,OAAO,CAAC,KAAK,CACX,kHAAkH,CACnH,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,mBAAmB;CACrC;AAED,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE;IACtB,QAAQ;SACL,MAAM,CAAC;QACN;YACE,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,uCAAuC;SACjD;QACD;YACE,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,yCAAyC;YAClD,OAAO,EAAE,SAAS;SACnB;QACD;YACE,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,gDAAgD;YACzD,OAAO,EAAE,aAAa;SACvB;QACD;YACE,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,2DAA2D;YACpE,OAAO,EAAE,GAAG;SACb;QACD;YACE,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,sCAAsC;YAC/C,OAAO,EAAE,cAAc;SACxB;KACF,CAAC;SACD,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;QAChB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;QACxD,aAAa,CACX,kBAAkB,EAClB,IAAI,CAAC,SAAS,CACZ,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAC/C,IAAI,EACJ,IAAI,CACL,CACF,CAAC;IACJ,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;CACN"}
|
package/bin/templates.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const MintConfig = (name, color, ctaName, ctaUrl, title) => {
|
|
2
|
+
return {
|
|
3
|
+
name,
|
|
4
|
+
logo: "",
|
|
5
|
+
favicon: "",
|
|
6
|
+
colors: {
|
|
7
|
+
primary: color,
|
|
8
|
+
},
|
|
9
|
+
topbarLinks: [],
|
|
10
|
+
topbarCtaButton: {
|
|
11
|
+
name: ctaName,
|
|
12
|
+
url: ctaUrl,
|
|
13
|
+
},
|
|
14
|
+
anchors: [],
|
|
15
|
+
navigation: [
|
|
16
|
+
{
|
|
17
|
+
group: "Home",
|
|
18
|
+
pages: [title],
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
// footerSocials: {}, // support object type for footer tyoes
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,IAAY,EACZ,KAAa,EACb,OAAe,EACf,MAAc,EACd,KAAa,EACb,EAAE;IACF,OAAO;QACL,IAAI;QACJ,IAAI,EAAE,EAAE;QACR,OAAO,EAAE,EAAE;QACX,MAAM,EAAE;YACN,OAAO,EAAE,KAAK;SACf;QACD,WAAW,EAAE,EAAE;QACf,eAAe,EAAE;YACf,IAAI,EAAE,OAAO;YACb,GAAG,EAAE,MAAM;SACZ;QACD,OAAO,EAAE,EAAE;QACX,UAAU,EAAE;YACV;gBACE,KAAK,EAAE,MAAM;gBACb,KAAK,EAAE,CAAC,KAAK,CAAC;aACf;SACF;QACD,6DAA6D;KAC9D,CAAC;AACJ,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mintlify",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Mintlify CLI",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=14.16"
|
|
7
|
+
},
|
|
5
8
|
"scripts": {
|
|
6
|
-
"
|
|
9
|
+
"build": "tsc"
|
|
7
10
|
},
|
|
8
11
|
"author": "Mintlify, Inc.",
|
|
9
12
|
"license": "ISC",
|
|
13
|
+
"exports": "./bin/index.js",
|
|
10
14
|
"bin": {
|
|
11
15
|
"mintlify": "bin/index.js"
|
|
16
|
+
},
|
|
17
|
+
"type": "module",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"inquirer": "^9.1.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/inquirer": "^9.0.1",
|
|
23
|
+
"@types/node": "^18.7.13",
|
|
24
|
+
"typescript": "^4.8.2"
|
|
12
25
|
}
|
|
13
26
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { writeFileSync } from "fs";
|
|
4
|
+
import inquirer from "inquirer";
|
|
5
|
+
import { MintConfig } from "./templates.js";
|
|
6
|
+
|
|
7
|
+
const args = process.argv.slice(2);
|
|
8
|
+
|
|
9
|
+
if (args.length === 0) {
|
|
10
|
+
console.error(
|
|
11
|
+
`No command specified. Here are is the list that you can use:\ninit: initialize a Mintlify documentation instance`
|
|
12
|
+
);
|
|
13
|
+
process.exit(1); //an error occurred
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (args[0] === "init") {
|
|
17
|
+
inquirer
|
|
18
|
+
.prompt([
|
|
19
|
+
{
|
|
20
|
+
type: "input",
|
|
21
|
+
name: "name",
|
|
22
|
+
message: "What is the name of the organization?",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
type: "input",
|
|
26
|
+
name: "color",
|
|
27
|
+
message: "What is the primary color of the brand?",
|
|
28
|
+
default: "#3b83f4",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: "input",
|
|
32
|
+
name: "ctaName",
|
|
33
|
+
message: "What is the name of the call to action button?",
|
|
34
|
+
default: "Get Started",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: "input",
|
|
38
|
+
name: "ctaUrl",
|
|
39
|
+
message: "What is the URL destination of the call to action button?",
|
|
40
|
+
default: "/",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: "input",
|
|
44
|
+
name: "title",
|
|
45
|
+
message: "What is the title of the first page?",
|
|
46
|
+
default: "Introduction",
|
|
47
|
+
},
|
|
48
|
+
])
|
|
49
|
+
.then((answers) => {
|
|
50
|
+
const { name, color, ctaName, ctaUrl, title } = answers;
|
|
51
|
+
writeFileSync(
|
|
52
|
+
"mint.config.json",
|
|
53
|
+
JSON.stringify(
|
|
54
|
+
MintConfig(name, color, ctaName, ctaUrl, title),
|
|
55
|
+
null,
|
|
56
|
+
"\t"
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
})
|
|
60
|
+
.catch((error) => {
|
|
61
|
+
console.error(error);
|
|
62
|
+
process.exit(1);
|
|
63
|
+
});
|
|
64
|
+
}
|
package/src/templates.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const MintConfig = (
|
|
2
|
+
name: string,
|
|
3
|
+
color: string,
|
|
4
|
+
ctaName: string,
|
|
5
|
+
ctaUrl: string,
|
|
6
|
+
title: string
|
|
7
|
+
) => {
|
|
8
|
+
return {
|
|
9
|
+
name,
|
|
10
|
+
logo: "",
|
|
11
|
+
favicon: "",
|
|
12
|
+
colors: {
|
|
13
|
+
primary: color,
|
|
14
|
+
},
|
|
15
|
+
topbarLinks: [],
|
|
16
|
+
topbarCtaButton: {
|
|
17
|
+
name: ctaName,
|
|
18
|
+
url: ctaUrl,
|
|
19
|
+
},
|
|
20
|
+
anchors: [],
|
|
21
|
+
navigation: [
|
|
22
|
+
{
|
|
23
|
+
group: "Home",
|
|
24
|
+
pages: [title],
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
// footerSocials: {}, // support object type for footer tyoes
|
|
28
|
+
};
|
|
29
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "node16",
|
|
4
|
+
"moduleResolution": "node16",
|
|
5
|
+
"target": "es2017",
|
|
6
|
+
"lib": ["es2015"],
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"outDir": "bin",
|
|
9
|
+
"baseUrl": ".",
|
|
10
|
+
"paths": {
|
|
11
|
+
"*": ["node_modules/*", "src/types/*"]
|
|
12
|
+
},
|
|
13
|
+
"emitDecoratorMetadata": true,
|
|
14
|
+
"experimentalDecorators": true
|
|
15
|
+
},
|
|
16
|
+
"include": ["src/**/*"]
|
|
17
|
+
}
|