@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/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, checkForDocsJson, } from './helpers.js';
19
+ import { checkPort, checkForMintJson, checkNodeVersion, upgradeConfig, checkForDocsJson, getVersions, } 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
@@ -138,10 +138,15 @@ export const cli = () => yargs(hideBin(process.argv))
138
138
  }
139
139
  yield upgradeConfig();
140
140
  }))
141
+ .command(['version', 'v'], 'Print the current version of the Mintlify CLI and client', () => undefined, () => {
142
+ const { cli, client } = getVersions();
143
+ console.log(`Mintlify CLI version: ${cli}`);
144
+ console.log(`Mintlify Client version: ${client}`);
145
+ })
141
146
  // Print the help menu when the user enters an invalid command.
142
147
  .strictCommands()
143
148
  .demandCommand(1, 'Unknown command. See above for the list of supported commands.')
144
- // Alias option flags --help = -h, --version = -v
149
+ // Alias option flags --help = -h, default --version = -v
145
150
  .alias('h', 'help')
146
151
  .alias('v', 'version')
147
152
  .parse();
package/bin/helpers.js CHANGED
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { getConfigPath } from '@mintlify/prebuild';
11
11
  import { MintConfigUpdater } from '@mintlify/prebuild';
12
+ import { getClientVersion } from '@mintlify/previewing';
12
13
  import { upgradeToDocsConfig } from '@mintlify/validation';
13
14
  import Chalk from 'chalk';
14
15
  import detect from 'detect-port';
@@ -17,6 +18,7 @@ import fs from 'fs/promises';
17
18
  import inquirer from 'inquirer';
18
19
  import Ora from 'ora';
19
20
  import path from 'path';
21
+ import yargs from 'yargs';
20
22
  import { CMD_EXEC_PATH } from './constants.js';
21
23
  export const checkPort = (argv) => __awaiter(void 0, void 0, void 0, function* () {
22
24
  const initialPort = typeof argv.port === 'number' ? argv.port : 3000;
@@ -91,3 +93,20 @@ export const upgradeConfig = () => __awaiter(void 0, void 0, void 0, function* (
91
93
  process.exit(1);
92
94
  }
93
95
  });
96
+ const getCliVersion = () => {
97
+ const y = yargs();
98
+ let version = undefined;
99
+ y.showVersion((s) => {
100
+ version = s;
101
+ return false;
102
+ });
103
+ return version;
104
+ };
105
+ export const getVersions = () => {
106
+ let cli = getCliVersion();
107
+ if (cli === 'unknown') {
108
+ cli = 'linked to local package';
109
+ }
110
+ const client = getClientVersion().trim();
111
+ return { cli, client };
112
+ };