@mintlify/cli 4.0.364 → 4.0.365
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 +1 -4
- package/bin/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/cli.ts +19 -4
- package/src/helpers.ts +1 -3
package/bin/cli.js
CHANGED
|
@@ -16,7 +16,7 @@ import yaml from 'js-yaml';
|
|
|
16
16
|
import path from 'path';
|
|
17
17
|
import yargs from 'yargs';
|
|
18
18
|
import { hideBin } from 'yargs/helpers';
|
|
19
|
-
import { checkPort, checkForMintJson, checkNodeVersion, upgradeConfig } from './helpers.js';
|
|
19
|
+
import { checkPort, checkForMintJson, checkNodeVersion, upgradeConfig, checkForDocsJson, } from './helpers.js';
|
|
20
20
|
export const cli = () => yargs(hideBin(process.argv))
|
|
21
21
|
.middleware(checkNodeVersion)
|
|
22
22
|
.command('dev', 'Runs Mintlify project locally.', (yargs) => yargs
|
|
@@ -62,7 +62,10 @@ export const cli = () => yargs(hideBin(process.argv))
|
|
|
62
62
|
}
|
|
63
63
|
}))
|
|
64
64
|
.command('broken-links', 'Check for broken links in your Mintlify project.', () => undefined, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
-
yield checkForMintJson();
|
|
65
|
+
const hasMintJson = yield checkForMintJson();
|
|
66
|
+
if (!hasMintJson) {
|
|
67
|
+
yield checkForDocsJson();
|
|
68
|
+
}
|
|
66
69
|
console.log(Chalk.bold('Checking for broken links...\n'));
|
|
67
70
|
try {
|
|
68
71
|
const brokenLinks = yield getBrokenInternalLinks();
|
|
@@ -105,11 +108,17 @@ export const cli = () => yargs(hideBin(process.argv))
|
|
|
105
108
|
})
|
|
106
109
|
.demandOption(['from', 'to'])
|
|
107
110
|
.epilog('Example: `mintlify rename introduction.mdx overview.mdx`'), (_a) => __awaiter(void 0, [_a], void 0, function* ({ from, to }) {
|
|
108
|
-
yield checkForMintJson();
|
|
111
|
+
const hasMintJson = yield checkForMintJson();
|
|
112
|
+
if (!hasMintJson) {
|
|
113
|
+
yield checkForDocsJson();
|
|
114
|
+
}
|
|
109
115
|
yield renameFilesAndUpdateLinksInContent(from, to);
|
|
110
116
|
}))
|
|
111
117
|
.command('upgrade', 'Upgrade the mint.json file to v2 (docs.json)', () => undefined, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
112
|
-
yield checkForMintJson();
|
|
118
|
+
const hasMintJson = yield checkForMintJson();
|
|
119
|
+
if (!hasMintJson) {
|
|
120
|
+
yield checkForDocsJson();
|
|
121
|
+
}
|
|
113
122
|
yield upgradeConfig();
|
|
114
123
|
}))
|
|
115
124
|
// Print the help menu when the user enters an invalid command.
|
package/bin/helpers.js
CHANGED
|
@@ -46,10 +46,7 @@ export const buildLogger = (startText = '') => {
|
|
|
46
46
|
return logger;
|
|
47
47
|
};
|
|
48
48
|
export const checkForMintJson = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
-
|
|
50
|
-
return;
|
|
51
|
-
console.error('Must be run in a directory where a mint.json file exists.');
|
|
52
|
-
process.exit(1);
|
|
49
|
+
return !!(yield getConfigPath(CMD_EXEC_PATH, 'mint'));
|
|
53
50
|
});
|
|
54
51
|
export const checkForDocsJson = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
52
|
const docsJsonPath = path.join(CMD_EXEC_PATH, 'docs.json');
|