a2r
Version:
A2R Framework
23 lines (22 loc) • 1.16 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const getLatestVersion_1 = __importDefault(require("./getLatestVersion"));
const colors_1 = require("./colors");
const package_json_1 = __importDefault(require("../package.json"));
const getVersion = async (print = false) => {
const lastVersion = await (0, getLatestVersion_1.default)();
const { version: currentVersion } = package_json_1.default;
if (print) {
if (lastVersion === currentVersion) {
(0, colors_1.log)(`Your project is using the latest version (${(0, colors_1.version)(currentVersion)}) of ${colors_1.framework} 👌`);
}
else {
(0, colors_1.log)(`Your project is using version ${(0, colors_1.version)(currentVersion)} of ${colors_1.framework}. Version ${(0, colors_1.version)(lastVersion)} is now available. Use ${(0, colors_1.terminalCommand)('npx a2r --update')} to upgrade the project.`);
}
}
return currentVersion;
};
exports.default = getVersion;