@mintlify/cli 4.0.364 → 4.0.366
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/cli.js +13 -4
- package/bin/helpers.js +4 -5
- package/bin/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/cli.ts +19 -4
- package/src/helpers.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintlify/cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.366",
|
|
4
4
|
"description": "The Mintlify CLI",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.0"
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"format:check": "prettier . --check"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@mintlify/common": "1.0.
|
|
42
|
-
"@mintlify/link-rot": "3.0.
|
|
41
|
+
"@mintlify/common": "1.0.259",
|
|
42
|
+
"@mintlify/link-rot": "3.0.354",
|
|
43
43
|
"@mintlify/models": "0.0.169",
|
|
44
|
-
"@mintlify/prebuild": "1.0.
|
|
45
|
-
"@mintlify/previewing": "4.0.
|
|
46
|
-
"@mintlify/validation": "0.1.
|
|
44
|
+
"@mintlify/prebuild": "1.0.353",
|
|
45
|
+
"@mintlify/previewing": "4.0.360",
|
|
46
|
+
"@mintlify/validation": "0.1.283",
|
|
47
47
|
"chalk": "^5.2.0",
|
|
48
48
|
"detect-port": "^1.5.1",
|
|
49
49
|
"fs-extra": "^11.2.0",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"typescript": "^5.5.3",
|
|
70
70
|
"vitest": "^2.0.4"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "a711e1f1c34e524d41bfd16ecd16fadfb1004415"
|
|
73
73
|
}
|
package/src/cli.ts
CHANGED
|
@@ -8,7 +8,13 @@ import path from 'path';
|
|
|
8
8
|
import yargs from 'yargs';
|
|
9
9
|
import { hideBin } from 'yargs/helpers';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
checkPort,
|
|
13
|
+
checkForMintJson,
|
|
14
|
+
checkNodeVersion,
|
|
15
|
+
upgradeConfig,
|
|
16
|
+
checkForDocsJson,
|
|
17
|
+
} from './helpers.js';
|
|
12
18
|
|
|
13
19
|
export const cli = () =>
|
|
14
20
|
yargs(hideBin(process.argv))
|
|
@@ -77,7 +83,10 @@ export const cli = () =>
|
|
|
77
83
|
'Check for broken links in your Mintlify project.',
|
|
78
84
|
() => undefined,
|
|
79
85
|
async () => {
|
|
80
|
-
await checkForMintJson();
|
|
86
|
+
const hasMintJson = await checkForMintJson();
|
|
87
|
+
if (!hasMintJson) {
|
|
88
|
+
await checkForDocsJson();
|
|
89
|
+
}
|
|
81
90
|
|
|
82
91
|
console.log(Chalk.bold('Checking for broken links...\n'));
|
|
83
92
|
try {
|
|
@@ -127,7 +136,10 @@ export const cli = () =>
|
|
|
127
136
|
.demandOption(['from', 'to'])
|
|
128
137
|
.epilog('Example: `mintlify rename introduction.mdx overview.mdx`'),
|
|
129
138
|
async ({ from, to }) => {
|
|
130
|
-
await checkForMintJson();
|
|
139
|
+
const hasMintJson = await checkForMintJson();
|
|
140
|
+
if (!hasMintJson) {
|
|
141
|
+
await checkForDocsJson();
|
|
142
|
+
}
|
|
131
143
|
await renameFilesAndUpdateLinksInContent(from, to);
|
|
132
144
|
}
|
|
133
145
|
)
|
|
@@ -136,7 +148,10 @@ export const cli = () =>
|
|
|
136
148
|
'Upgrade the mint.json file to v2 (docs.json)',
|
|
137
149
|
() => undefined,
|
|
138
150
|
async () => {
|
|
139
|
-
await checkForMintJson();
|
|
151
|
+
const hasMintJson = await checkForMintJson();
|
|
152
|
+
if (!hasMintJson) {
|
|
153
|
+
await checkForDocsJson();
|
|
154
|
+
}
|
|
140
155
|
await upgradeConfig();
|
|
141
156
|
}
|
|
142
157
|
)
|
package/src/helpers.ts
CHANGED
|
@@ -45,9 +45,7 @@ export const buildLogger = (startText = ''): OraType => {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
export const checkForMintJson = async () => {
|
|
48
|
-
|
|
49
|
-
console.error('Must be run in a directory where a mint.json file exists.');
|
|
50
|
-
process.exit(1);
|
|
48
|
+
return !!(await getConfigPath(CMD_EXEC_PATH, 'mint'));
|
|
51
49
|
};
|
|
52
50
|
|
|
53
51
|
export const checkForDocsJson = async () => {
|
|
@@ -86,7 +84,9 @@ export const upgradeConfig = async () => {
|
|
|
86
84
|
const mintJsonFileContent = await fs.readFile(mintJsonPath, 'utf8');
|
|
87
85
|
const validationResult = await MintConfigUpdater.validateConfigJsonString(mintJsonFileContent);
|
|
88
86
|
const mintConfig = validationResult.data;
|
|
89
|
-
const upgradedDocsConfig = upgradeToDocsConfig(mintConfig
|
|
87
|
+
const upgradedDocsConfig = upgradeToDocsConfig(mintConfig, {
|
|
88
|
+
shouldUpgradeTheme: true,
|
|
89
|
+
});
|
|
90
90
|
await fs.writeFile(docsJsonPath, JSON.stringify(upgradedDocsConfig, null, 2));
|
|
91
91
|
console.log(Chalk.green('✅ Your mint.json file has been upgraded to v2 (docs.json).'));
|
|
92
92
|
} catch (err) {
|