@mintlify/cli 4.0.541 → 4.0.543

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/cli",
3
- "version": "4.0.541",
3
+ "version": "4.0.543",
4
4
  "description": "The Mintlify CLI",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -39,11 +39,11 @@
39
39
  "format:check": "prettier . --check"
40
40
  },
41
41
  "dependencies": {
42
- "@mintlify/common": "1.0.383",
43
- "@mintlify/link-rot": "3.0.497",
42
+ "@mintlify/common": "1.0.384",
43
+ "@mintlify/link-rot": "3.0.498",
44
44
  "@mintlify/models": "0.0.193",
45
- "@mintlify/prebuild": "1.0.494",
46
- "@mintlify/previewing": "4.0.532",
45
+ "@mintlify/prebuild": "1.0.495",
46
+ "@mintlify/previewing": "4.0.534",
47
47
  "@mintlify/validation": "0.1.370",
48
48
  "chalk": "^5.2.0",
49
49
  "detect-port": "^1.5.1",
@@ -70,5 +70,5 @@
70
70
  "typescript": "^5.5.3",
71
71
  "vitest": "^2.0.4"
72
72
  },
73
- "gitHead": "bd64cf77b9c92cdbf62126af4699bd346db208c1"
73
+ "gitHead": "2d26cf404cec3574520e487221b2c0f17e8d3ee9"
74
74
  }
package/src/cli.ts CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  checkNodeVersion,
15
15
  upgradeConfig,
16
16
  checkForDocsJson,
17
+ getVersions,
17
18
  } from './helpers.js';
18
19
 
19
20
  export const cli = () =>
@@ -174,11 +175,21 @@ export const cli = () =>
174
175
  await upgradeConfig();
175
176
  }
176
177
  )
178
+ .command(
179
+ ['version', 'v'],
180
+ 'Print the current version of the Mintlify CLI and client',
181
+ () => undefined,
182
+ () => {
183
+ const { cli, client } = getVersions();
184
+ console.log(`Mintlify CLI version: ${cli}`);
185
+ console.log(`Mintlify Client version: ${client}`);
186
+ }
187
+ )
177
188
  // Print the help menu when the user enters an invalid command.
178
189
  .strictCommands()
179
190
  .demandCommand(1, 'Unknown command. See above for the list of supported commands.')
180
191
 
181
- // Alias option flags --help = -h, --version = -v
192
+ // Alias option flags --help = -h, default --version = -v
182
193
  .alias('h', 'help')
183
194
  .alias('v', 'version')
184
195
 
package/src/helpers.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { getConfigPath } from '@mintlify/prebuild';
2
2
  import { MintConfigUpdater } from '@mintlify/prebuild';
3
+ import { getClientVersion } from '@mintlify/previewing';
3
4
  import { upgradeToDocsConfig } from '@mintlify/validation';
4
5
  import Chalk from 'chalk';
5
6
  import detect from 'detect-port';
@@ -9,6 +10,7 @@ import inquirer from 'inquirer';
9
10
  import Ora, { Ora as OraType } from 'ora';
10
11
  import path from 'path';
11
12
  import type { ArgumentsCamelCase } from 'yargs';
13
+ import yargs from 'yargs';
12
14
 
13
15
  import { CMD_EXEC_PATH } from './constants.js';
14
16
 
@@ -94,3 +96,25 @@ export const upgradeConfig = async () => {
94
96
  process.exit(1);
95
97
  }
96
98
  };
99
+
100
+ const getCliVersion = (): string | undefined => {
101
+ const y = yargs();
102
+ let version = undefined;
103
+ y.showVersion((s) => {
104
+ version = s;
105
+ return false;
106
+ });
107
+ return version;
108
+ };
109
+
110
+ export const getVersions = (): {
111
+ cli: string | undefined;
112
+ client: string | undefined;
113
+ } => {
114
+ let cli = getCliVersion();
115
+ if (cli === 'unknown') {
116
+ cli = 'linked to local package';
117
+ }
118
+ const client = getClientVersion().trim();
119
+ return { cli, client };
120
+ };