Files
directus-schema-sync/scripts/release-channel.js
2024-01-29 11:30:28 +02:00

19 lines
621 B
JavaScript

// Given a version, figure out what the release channel is so that we can publish to the correct
// channel on npm.
// Copied from https://github.com/tailwindlabs/heroicons/blob/eee05eb77af6cdedfb97f128d1998773fc984b28/scripts/release-channel.js
//
// E.g.:
//
// 1.2.3 -> latest (default)
// 0.0.0-insiders.ffaa88 -> insiders
// 4.1.0-alpha.4 -> alpha
let version =
process.argv[2] || process.env.npm_package_version || require("../package.json").version;
let match = /\d+\.\d+\.\d+-(.*)\.\d+/g.exec(version);
if (match) {
console.log(match[1]);
} else {
console.log("latest");
}