mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-29 17:38:07 +00:00
* feat: add tooljet info command * post publish changes * upgraded cli version * readme changes Co-authored-by: gsmithun4 <gsmithun4@gmail.com>
38 lines
966 B
TypeScript
38 lines
966 B
TypeScript
import { Command } from '@oclif/core';
|
|
import * as chalk from 'chalk';
|
|
import * as os from 'os';
|
|
import * as childProcess from 'child_process';
|
|
|
|
function getPackageVersion() {
|
|
try {
|
|
return require(`./package.json`).version;
|
|
} catch {
|
|
return 'N/A';
|
|
}
|
|
}
|
|
|
|
function getBinaryVersion(binaryName: string) {
|
|
try {
|
|
return childProcess.execSync(`${binaryName} --version`).toString().trim();
|
|
} catch {
|
|
return 'N/A';
|
|
}
|
|
}
|
|
|
|
export class InfoCommand extends Command {
|
|
static description = 'This command returns the information about where tooljet is being run';
|
|
|
|
async run() {
|
|
console.log(`
|
|
Operating System:
|
|
platform: ${chalk.green(os.platform())}
|
|
arch: ${chalk.green(os.arch())}
|
|
version: ${chalk.green(os.version())}
|
|
Binaries:
|
|
node: ${chalk.green(process.versions.node)}
|
|
npm: ${chalk.green(getBinaryVersion('npm'))}
|
|
Relevant packages:
|
|
tooljet: ${chalk.green(getPackageVersion())}
|
|
`);
|
|
}
|
|
}
|