Open filipeom opened 3 weeks ago
'use strict';
const { blue, bold, green, red } = require('chalk');
const path = require('path');
const semver = require('semver');
const { exec } = require('child_process');
const { promisify } = require('util');
const execAsync = promisify(exec);
async function getLatestVersions(name) {
const { stdout } = await execAsync(`npm view ${name} versions --json`);
try {
return JSON.parse(stdout);
} catch (err) {
throw new Error(`Failed to parse output from NPM view - ${err.toString()}`);
}
}