const semver = require('semver'); const { version } = require('../../package.json'); /** * The distribution this build is intended for. * * This should be kept in-sync with the `BuildType` map in `shared/constants/app.js`. */ const BuildType = { beta: 'beta', flask: 'flask', main: 'main', }; /** * Map the current version to a format that is compatible with each browser. * * The given version number is assumed to be a SemVer version number. Additionally, if the version * has a prerelease component, it is assumed to have the format ". { const versionParts = [major, minor, patch]; const browserSpecificVersion = {}; if (prerelease) { if (platform === 'firefox') { versionParts.push(`${buildType}${buildVersion}`); } else { versionParts.push(buildVersion); browserSpecificVersion.version_name = buildType; } } browserSpecificVersion.version = versionParts.join('.'); platformMap[platform] = browserSpecificVersion; return platformMap; }, {}); } module.exports = { BuildType, getBrowserVersionMap, };