smartui-migration-tool
Version:
Enterprise-grade CLI tool for migrating visual testing platforms to LambdaTest SmartUI
36 lines (27 loc) ⢠1.27 kB
JavaScript
const { Command } = require('@oclif/core');
const chalk = require('chalk');
const { execSync } = require('child_process');
const { ASCIILogos } = require('../utils/ascii-logos');
class Version extends Command {
static description = 'Show version information';
async run() {
console.log(ASCIILogos.getMinimalLogo());
const packageJson = require('../package.json');
const installedVersion = packageJson.version;
console.log(chalk.cyan.bold(`\nš¦ Installed Version: ${installedVersion}`));
try {
// Check for latest version on npm
const latestVersion = execSync('npm view smartui-migration-tool version', { encoding: 'utf8' }).trim();
if (latestVersion !== installedVersion) {
console.log(chalk.yellow(`š Latest Version: ${latestVersion}`));
console.log(chalk.gray('š” Run "smartui-migrator update" to update to the latest version'));
} else {
console.log(chalk.green('ā
You have the latest version!'));
}
} catch (error) {
console.log(chalk.gray('ā¹ļø Could not check for updates'));
}
console.log(chalk.gray('\nFor more information, visit: https://github.com/RushilK7/smartui-migration-tool'));
}
}
module.exports.default = Version;