1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Migrate version from _base manifest to package.json (#11029)

The version field is now stored in the main `package.json` file rather
than in the base manifest. It is built into the final manifest during
the build script.

This makes it easier to communicate what the current version should be
to our `auto-changelog` script. It's also generally a more conventional
place to keep track of the version, even considering that we're not
publishing to npm.
This commit is contained in:
Mark Stacey 2021-05-10 18:46:03 -02:30 committed by Dan Miller
parent cfc0a868a4
commit 4ced29e3a2
9 changed files with 17 additions and 15 deletions

View File

@ -19,9 +19,7 @@ fi
printf '%s\n' 'Updating the manifest version if needed' printf '%s\n' 'Updating the manifest version if needed'
version="${CIRCLE_BRANCH/Version-v/}" version="${CIRCLE_BRANCH/Version-v/}"
updated_manifest="$(jq ".version = \"$version\"" app/manifest/_base.json)" yarn version --no-git-tag-version --new-version "${version}"
printf '%s\n' "$updated_manifest" > app/manifest/_base.json
yarn prettier --write app/manifest/_base.json
if [[ -z $(git status --porcelain) ]] if [[ -z $(git status --porcelain) ]]
then then

View File

@ -28,7 +28,7 @@ fi
printf '%s\n' 'Commit the manifest version and changelog if the manifest has changed' printf '%s\n' 'Commit the manifest version and changelog if the manifest has changed'
if git diff --quiet app/manifest/_base.json; if git diff --quiet package.json;
then then
printf '%s\n' 'No manifest changes to commit' printf '%s\n' 'No manifest changes to commit'
exit 0 exit 0
@ -38,7 +38,7 @@ git \
-c user.name='MetaMask Bot' \ -c user.name='MetaMask Bot' \
-c user.email='metamaskbot@users.noreply.github.com' \ -c user.email='metamaskbot@users.noreply.github.com' \
commit --message "${CIRCLE_BRANCH/-/ }" \ commit --message "${CIRCLE_BRANCH/-/ }" \
CHANGELOG.md app/manifest/_base.json CHANGELOG.md package.json
repo_slug="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME" repo_slug="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME"
git push "https://$GITHUB_TOKEN_USER:$GITHUB_TOKEN@github.com/$repo_slug" "$CIRCLE_BRANCH" git push "https://$GITHUB_TOKEN_USER:$GITHUB_TOKEN@github.com/$repo_slug" "$CIRCLE_BRANCH"

View File

@ -71,6 +71,5 @@
"notifications" "notifications"
], ],
"short_name": "__MSG_appName__", "short_name": "__MSG_appName__",
"version": "9.5.9",
"web_accessible_resources": ["inpage.js", "phishing.html"] "web_accessible_resources": ["inpage.js", "phishing.html"]
} }

View File

@ -1,6 +1,6 @@
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const { version } = require('../app/manifest/_base.json'); const { version } = require('../package.json');
const changelog = fs.readFileSync( const changelog = fs.readFileSync(
path.join(__dirname, '..', 'CHANGELOG.md'), path.join(__dirname, '..', 'CHANGELOG.md'),

View File

@ -4,7 +4,7 @@ const gulpZip = require('gulp-zip');
const del = require('del'); const del = require('del');
const pify = require('pify'); const pify = require('pify');
const pump = pify(require('pump')); const pump = pify(require('pump'));
const baseManifest = require('../../app/manifest/_base.json'); const { version } = require('../../package.json');
const { createTask, composeParallel } = require('./task'); const { createTask, composeParallel } = require('./task');
module.exports = createEtcTasks; module.exports = createEtcTasks;
@ -38,7 +38,7 @@ function createZipTask(target) {
return async () => { return async () => {
await pump( await pump(
gulp.src(`dist/${target}/**`), gulp.src(`dist/${target}/**`),
gulpZip(`metamask-${target}-${baseManifest.version}.zip`), gulpZip(`metamask-${target}-${version}.zip`),
gulp.dest('builds'), gulp.dest('builds'),
); );
}; };

View File

@ -3,6 +3,7 @@ const path = require('path');
const { merge, cloneDeep } = require('lodash'); const { merge, cloneDeep } = require('lodash');
const baseManifest = require('../../app/manifest/_base.json'); const baseManifest = require('../../app/manifest/_base.json');
const { version } = require('../../package.json');
const { createTask, composeSeries } = require('./task'); const { createTask, composeSeries } = require('./task');
@ -23,7 +24,11 @@ function createManifestTasks({ browserPlatforms }) {
`${platform}.json`, `${platform}.json`,
), ),
); );
const result = merge(cloneDeep(baseManifest), platformModifications); const result = merge(
cloneDeep(baseManifest),
{ version },
platformModifications,
);
const dir = path.join('.', 'dist', platform); const dir = path.join('.', 'dist', platform);
await fs.mkdir(dir, { recursive: true }); await fs.mkdir(dir, { recursive: true });
await writeJson(result, path.join(dir, 'manifest.json')); await writeJson(result, path.join(dir, 'manifest.json'));

View File

@ -22,7 +22,7 @@ const metamaskrc = require('rc')('metamask', {
SEGMENT_LEGACY_WRITE_KEY: process.env.SEGMENT_LEGACY_WRITE_KEY, SEGMENT_LEGACY_WRITE_KEY: process.env.SEGMENT_LEGACY_WRITE_KEY,
}); });
const baseManifest = require('../../app/manifest/_base.json'); const { version } = require('../../package.json');
const packageJSON = require('../../package.json'); const packageJSON = require('../../package.json');
const { const {
@ -424,7 +424,7 @@ function getEnvironmentVariables({ devMode, testing }) {
return { return {
METAMASK_DEBUG: devMode, METAMASK_DEBUG: devMode,
METAMASK_ENVIRONMENT: environment, METAMASK_ENVIRONMENT: environment,
METAMASK_VERSION: baseManifest.version, METAMASK_VERSION: version,
NODE_ENV: devMode ? 'development' : 'production', NODE_ENV: devMode ? 'development' : 'production',
IN_TEST: testing ? 'true' : false, IN_TEST: testing ? 'true' : false,
PUBNUB_SUB_KEY: process.env.PUBNUB_SUB_KEY || '', PUBNUB_SUB_KEY: process.env.PUBNUB_SUB_KEY || '',

View File

@ -1,6 +1,6 @@
{ {
"name": "metamask-crx", "name": "metamask-crx",
"version": "0.0.0", "version": "9.5.0",
"private": true, "private": true,
"repository": { "repository": {
"type": "git", "type": "git",
@ -105,6 +105,7 @@
"@metamask/jazzicon": "^2.0.0", "@metamask/jazzicon": "^2.0.0",
"@metamask/logo": "^2.5.0", "@metamask/logo": "^2.5.0",
"@metamask/obs-store": "^5.0.0", "@metamask/obs-store": "^5.0.0",
"@metamask/post-message-stream": "^4.0.0",
"@popperjs/core": "^2.4.0", "@popperjs/core": "^2.4.0",
"@reduxjs/toolkit": "^1.5.0", "@reduxjs/toolkit": "^1.5.0",
"@sentry/browser": "^5.26.0", "@sentry/browser": "^5.26.0",
@ -164,7 +165,6 @@
"nonce-tracker": "^1.0.0", "nonce-tracker": "^1.0.0",
"obj-multiplex": "^1.0.0", "obj-multiplex": "^1.0.0",
"pify": "^5.0.0", "pify": "^5.0.0",
"@metamask/post-message-stream": "^4.0.0",
"promise-to-callback": "^1.0.0", "promise-to-callback": "^1.0.0",
"prop-types": "^15.6.1", "prop-types": "^15.6.1",
"pubnub": "4.27.3", "pubnub": "4.27.3",

View File

@ -3,7 +3,7 @@ const os = require('os');
const path = require('path'); const path = require('path');
const { Builder, By, until } = require('selenium-webdriver'); const { Builder, By, until } = require('selenium-webdriver');
const firefox = require('selenium-webdriver/firefox'); const firefox = require('selenium-webdriver/firefox');
const { version } = require('../../../app/manifest/_base.json'); const { version } = require('../../../package.json');
/** /**
* The prefix for temporary Firefox profiles. All Firefox profiles used for e2e tests * The prefix for temporary Firefox profiles. All Firefox profiles used for e2e tests