mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
75a8aedc32
The version of a build is now derived from both the `version` field in `package.json` and the requested build type and version. The build type and version are added onto the manifest version as a suffix, according to the SemVer prerelease format. We already have support in the extension for versions of this format, but to apply a Flask or Beta version required manual updates to `package.json`. Now it can be done just with build arguments. A `get-version` module was created to make it easier to generate the version in the various places we do that during the build. It was created in the `development/lib` directory because it will be used by other non-build development scripts in a future PR. The `BuildType` constant was extracted to its own module as well, and moved to the `development/lib` directory. This was to make it clear that it's used by various different development scripts, not just the build.
22 lines
758 B
JavaScript
22 lines
758 B
JavaScript
const { version: manifestVersion } = require('../../package.json');
|
|
const { BuildType } = require('./build-type');
|
|
|
|
/**
|
|
* 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.
|
|
*
|
|
* @param {BuildType} buildType - The build type.
|
|
* @param {number} buildVersion - The build version.
|
|
* @returns {string} The MetaMask extension version.
|
|
*/
|
|
function getVersion(buildType, buildVersion) {
|
|
return buildType === BuildType.main
|
|
? manifestVersion
|
|
: `${manifestVersion}-${buildType}.${buildVersion}`;
|
|
}
|
|
|
|
module.exports = { getVersion };
|