UNPKG

create-tezos-smart-contract

Version:

Node.js toolset to write, test and deploy Tezos smart contracts

43 lines (42 loc) 2.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.toLigoVersion = exports.isLigoVersionGT = exports.isLigoVersionLT = void 0; const types_1 = require("./types"); const semver_1 = require("semver"); const console_1 = require("../../console"); const isLigoVersionLT = (compare, to) => { if (compare === 'next') { return false; } const sCompare = new semver_1.SemVer(compare); const sTo = new semver_1.SemVer(to); return sCompare.compare(sTo) === -1; }; exports.isLigoVersionLT = isLigoVersionLT; const isLigoVersionGT = (compare, to) => { if (to === 'next') { return false; } const sCompare = new semver_1.SemVer(compare); const sTo = new semver_1.SemVer(to); return sCompare.compare(sTo) === 1; }; exports.isLigoVersionGT = isLigoVersionGT; const toLigoVersion = (version) => { if (version === 'next') { (0, console_1.warn)(`Your preference for the LIGO compiler version is set to "next", which might lead to non-working setups for three reasons:\n` + ` 1) LIGO compiler is downloaded during the project's initial setup. "next" was the latest available LIGO version during the first project setup on this machine. LIGO won't be updated automatically even if new releases are issued;\n` + ` 2) If the CLI interface of LIGO is changed, the toolchain might not be able to compile your contracts anymore;\n` + ` 3) Your contract's code might not be compatible with newer versions of the LIGO compiler.\n` + `\nPlease consider using a specific LIGO compiler version, editing the "ligoVersion" property in config.json or proceed at your own risk.\n` + `Most recent supported version is: ${types_1.DEFAULT_LIGO_VERSION}\n`); return version; } if ((0, exports.isLigoVersionGT)(version, types_1.DEFAULT_LIGO_VERSION)) { (0, console_1.warn)(`The specified LIGO compiler version "${version}" is above the most recent supported version ${types_1.DEFAULT_LIGO_VERSION}.\n` + `This might lead to unexpected behaviour or break the "compile" command, so proceed at your own risk.\n` + `\nPlease check if there's a new Lava release at https://www.npmjs.com/package/create-tezos-smart-contract and consider updating.\n`); } return (new semver_1.SemVer(version)).toString(); }; exports.toLigoVersion = toLigoVersion;