UNPKG

dce-dev-wizard

Version:

Wizard for managing development apps at Harvard DCE.

39 lines 1.92 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const path_1 = __importDefault(require("path")); // Import shared helpers const print_1 = __importDefault(require("./helpers/print")); const exec_1 = __importDefault(require("./helpers/exec")); const getPackageJSON_1 = __importDefault(require("./helpers/getPackageJSON")); // Get current working directory const wizardPackageJSON = (0, getPackageJSON_1.default)(path_1.default.join(__dirname, '../package.json')); /*----------------------------------------*/ /* ---------------- Main ---------------- */ /*----------------------------------------*/ /** * Validate that the user is running the most up-to-date version of the dev wizard * @author Gabe Abrams */ const validateWizardVersion = () => { // Get latest wizard version const latestWizardVersionString = (0, exec_1.default)(`npm view dce-dev-wizard versions --json | jq -r '.[] | select(test("-beta") | not)' | sort -rV | head -n 1`); const latestWizardVersion = latestWizardVersionString.trim(); // Get current wizard version const currentWizardVersion = wizardPackageJSON.version; // If versions don't match, show warning if (latestWizardVersion !== currentWizardVersion) { print_1.default.title('Wizard Out of Date'); console.log(''); console.error(`You are running version ${currentWizardVersion} of the dev wizard.`); console.error(`The latest version of the dev wizard is ${latestWizardVersion}.`); console.log(''); console.log('Upgrade and try again:'); console.log(`npm i --save-dev dce-dev-wizard@${latestWizardVersion}`); process.exit(0); } }; exports.default = validateWizardVersion; //# sourceMappingURL=validateWizardVersion.js.map