2022-03-10 17:01:50 +01:00
|
|
|
const { version: manifestVersion } = require('../../package.json');
|
2023-04-25 16:32:51 +02:00
|
|
|
const { loadBuildTypesConfig } = require('./build-type');
|
2022-03-10 17:01:50 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current version of the MetaMask extension. The base manifest version
|
|
|
|
* is modified according to the build type and version.
|
|
|
|
*
|
|
|
|
* The build version is needed because certain build types (such as beta) may
|
|
|
|
* be released multiple times during the release process.
|
|
|
|
*
|
2023-04-25 16:32:51 +02:00
|
|
|
* @param {string} buildType - The build type.
|
2022-03-10 17:01:50 +01:00
|
|
|
* @param {number} buildVersion - The build version.
|
|
|
|
* @returns {string} The MetaMask extension version.
|
|
|
|
*/
|
|
|
|
function getVersion(buildType, buildVersion) {
|
2023-04-25 16:32:51 +02:00
|
|
|
return loadBuildTypesConfig().buildTypes[buildType].isPrerelease === true
|
|
|
|
? `${manifestVersion}-${buildType}.${buildVersion}`
|
|
|
|
: manifestVersion;
|
2022-03-10 17:01:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = { getVersion };
|