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[2] = `${versionParts[2]}${buildType}${buildVersion}`; } else { versionParts.push(buildVersion); browserSpecificVersion.version_name = version; } } browserSpecificVersion.version = versionParts.join('.'); platformMap[platform] = browserSpecificVersion; return platformMap; }, {}); } module.exports = { BuildType, getBrowserVersionMap, };