2022-04-06 20:34:03 +02:00
|
|
|
const semver = require('semver');
|
2022-06-07 11:49:17 +02:00
|
|
|
// @ts-expect-error
|
2022-04-06 20:34:03 +02:00
|
|
|
const pck = require('../package.json');
|
|
|
|
|
|
|
|
const newUnleashVersion = process.argv[2];
|
|
|
|
const frontendVersion = pck.dependencies['unleash-frontend'];
|
|
|
|
|
|
|
|
function isPrerelease(version) {
|
|
|
|
const arr = semver.prerelease(version);
|
|
|
|
return arr && arr.length > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!newUnleashVersion) {
|
|
|
|
console.error('You must provide the new Unleash version as argument');
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isPrerelease(newUnleashVersion)) {
|
|
|
|
if (isPrerelease(frontendVersion)) {
|
|
|
|
console.error(
|
|
|
|
`A latest version of unleash-server (${newUnleashVersion}) cannot depend on a pre-release of unleash-frontend (${frontendVersion})`,
|
|
|
|
);
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(
|
|
|
|
` Passed!\x1b[36m unleash-server v${newUnleashVersion}\x1b[0m can depend on\x1b[36m unleash-frontend v${frontendVersion}\x1b[0m`,
|
|
|
|
);
|