Skip to content

Commit

Permalink
Merge branch 'main' into MultipleNotificationsPerf
Browse files Browse the repository at this point in the history
  • Loading branch information
darkwing authored Mar 4, 2025
2 parents 0a69896 + 3789dde commit 7b12df4
Show file tree
Hide file tree
Showing 911 changed files with 30,582 additions and 21,357 deletions.
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,9 @@ jobs:
job-publish-release:
executor: node-browsers-small
steps:
- add_ssh_keys:
fingerprints:
- 'SHA256:It7UdNvvXY8g5aN32yfbPKFxZSV9ny7K8ifDdlP53rQ'
- run: *shallow-git-clone-and-enable-vnc
- run: sudo corepack enable
- attach_workspace:
Expand All @@ -1075,6 +1078,9 @@ jobs:
- run:
name: Create GitHub release
command: .circleci/scripts/release-create-gh-release.sh
- run:
name: Push Firefox bundle script
command: .circleci/scripts/push-firefox-bundle-script.sh

job-publish-ts-migration-dashboard:
executor: node-browsers-small
Expand Down
54 changes: 54 additions & 0 deletions .circleci/scripts/bundle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

export CIRCLE_BRANCH=""
export CONTENTFUL_ACCESS_SPACE_ID=""
export CONTENTFUL_ACCESS_TOKEN=""
export ETHERSCAN_API_KEY=""
export FIREBASE_API_KEY=""
export FIREBASE_APP_ID=""
export FIREBASE_AUTH_DOMAIN=""
export FIREBASE_MEASUREMENT_ID=""
export FIREBASE_MESSAGING_SENDER_ID=""
export FIREBASE_PROJECT_ID=""
export FIREBASE_STORAGE_BUCKET=""
export INFURA_BETA_PROJECT_ID=""
export INFURA_FLASK_PROJECT_ID=""
export INFURA_MMI_PROJECT_ID=""
export INFURA_PROD_PROJECT_ID=""
export INFURA_PROJECT_ID=""
export MMI_CONFIGURATION_SERVICE_URL=""
export PUBNUB_PUB_KEY=""
export SEGMENT_BETA_WRITE_KEY=""
export SEGMENT_FLASK_WRITE_KEY=""
export SEGMENT_MMI_WRITE_KEY=""
export SEGMENT_PROD_LEGACY_WRITE_KEY=""
export SEGMENT_PROD_WRITE_KEY=""
export SEGMENT_WRITE_KEY=""
export ANALYTICS_DATA_DELETION_SOURCE_ID=""
export ANALYTICS_DATA_DELETION_ENDPOINT=""
export SENTRY_AUTH_TOKEN=""
export SENTRY_DSN=""
export SENTRY_MMI_DSN=""
export SENTRY_DSN_DEV=""
export VAPID_KEY=""
export TZ="UTC"
export ENABLE_MV3="false"

# 1. Download and install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/179d45050be0a71fd57591b0ed8aedf9b177ba10/install.sh | bash

# 2. Activate nvm in lieu of restarting the shell
# shellcheck disable=SC1091
\. "${HOME}/.nvm/nvm.sh"

# 3. Download and install Node.js
nvm install

# 4. Enable corepack to install yarn
corepack enable

# 5. Install dependencies
yarn

# 6. Run the production build command
yarn build prod
22 changes: 8 additions & 14 deletions .circleci/scripts/git-diff-default-branch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@ async function gitDiff(): Promise<string> {
return diffResult;
}

function writePrBodyToFile(prBody: string) {
function writePrBodyAndInfoToFile(prInfo: PRInfo) {
const prBodyPath = path.resolve(CHANGED_FILES_DIR, 'pr-body.txt');
fs.writeFileSync(prBodyPath, prBody.trim());
console.log(`PR body saved to ${prBodyPath}`);
const labels = prInfo.labels.map(label => label.name).join(', ');
const updatedPrBody = `PR labels: {${labels}}\nPR base: {${prInfo.base.ref}}\n${prInfo.body.trim()}`;
fs.writeFileSync(prBodyPath, updatedPrBody);
console.log(`PR body and info saved to ${prBodyPath}`);
}

/**
Expand All @@ -135,17 +137,9 @@ async function storeGitDiffOutputAndPrBody() {
if (!baseRef) {
console.log('Not a PR, skipping git diff');
return;
} else if (baseRef !== GITHUB_DEFAULT_BRANCH) {
console.log(`This is for a PR targeting '${baseRef}', skipping git diff`);
writePrBodyToFile(prInfo.body);
return;
} else if (
prInfo.labels.some((label) => label.name === 'skip-e2e-quality-gate')
) {
console.log('PR has the skip-e2e-quality-gate label, skipping git diff');
return;
}

// We perform git diff even if the PR base is not main or skip-e2e-quality-gate label is applied
// because we rely on the git diff results for other jobs
console.log('Attempting to get git diff...');
const diffOutput = await gitDiff();
console.log(diffOutput);
Expand All @@ -155,7 +149,7 @@ async function storeGitDiffOutputAndPrBody() {
fs.writeFileSync(outputPath, diffOutput.trim());
console.log(`Git diff results saved to ${outputPath}`);

writePrBodyToFile(prInfo.body);
writePrBodyAndInfoToFile(prInfo);

process.exit(0);
} catch (error: any) {
Expand Down
45 changes: 45 additions & 0 deletions .circleci/scripts/push-firefox-bundle-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash

set -e
set -o pipefail

if [[ "${CI:-}" != 'true' ]]
then
printf '%s\n' 'CI environment variable must be set to true'
exit 1
fi

if [[ "${CIRCLECI:-}" != 'true' ]]
then
printf '%s\n' 'CIRCLECI environment variable must be set to true'
exit 1
fi

git config --global user.name "MetaMask Bot"
git config --global user.email [email protected]
version=$(git show -s --format='%s' HEAD | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+')

git clone [email protected]:MetaMask/firefox-bundle-script.git
cd firefox-bundle-script
git checkout release
cp ../.circleci/scripts/bundle.sh ./bundle.sh

# sed works differently on macOS and Linux
# macOS requires an empty string argument for -i
# so we need to handle this case based on the OS
if sed --version 2>/dev/null | grep -q GNU; then
SED_OPTS=(-i)
else
SED_OPTS=(-i '')
fi

# Insert exported environment variables
awk -F '=' '/^\s*export / {gsub(/^export /, ""); print $1}' bundle.sh | while read -r var; do
if [[ -n "${!var}" ]]; then
sed "${SED_OPTS[@]}" "s|^\(\s*export $var=\).*|\1\"${!var}\"|" bundle.sh
fi
done

git add bundle.sh
git commit --allow-empty -m "${version}"
git push origin release
42 changes: 42 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,48 @@ module.exports = {
},
},
},

/**
* TypeScript React-specific code
*
* Similar to above, but marks a majority of errors to warnings.
* TODO - combine rulesets and resolve errors
*/
{
files: ['ui/**/*.ts', 'ui/**/*.tsx'],
extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended'],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
plugins: ['react'],
rules: {
'react/no-unused-prop-types': 'warn',
'react/no-unused-state': 'warn',
'react/jsx-boolean-value': 'off',
'react/jsx-curly-brace-presence': 'off',
'react/no-deprecated': 'warn',
'react/default-props-match-prop-types': 'warn',
'react/jsx-no-duplicate-props': 'warn',
'react/display-name': 'off',
'react/no-unescaped-entities': 'warn',
'react/prop-types': 'off',
'react/no-children-prop': 'off',
'react/jsx-key': 'warn', // TODO - increase this into 'error' level
'react-hooks/rules-of-hooks': 'warn', // TODO - increase this into 'error' level
},
settings: {
react: {
// If this is set to 'detect', ESLint will import React in order to
// find its version. Because we run ESLint in the build system under
// LavaMoat, this means that detecting the React version requires a
// LavaMoat policy for all of React, in the build system. That's a
// no-go, so we grab it from React's package.json.
version: reactVersion,
},
},
},
/**
* Mocha tests
*
Expand Down
1 change: 1 addition & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ There are also plenty of open issues we'd love help with. Search the [`good firs
If you're picking up a bounty or an existing issue, feel free to ask clarifying questions on the issue as you go about your work.

### Submitting a pull request

When you're done with your project / bugfix / feature and ready to submit a PR, there are a couple guidelines we ask you to follow:

- [ ] **Make sure you followed our [`coding guidelines`](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md)**: These guidelines aim to maintain consistency and readability across the codebase. They help ensure that the code is easy to understand, maintain, and modify, which is particularly important when working with multiple contributors.
Expand Down
Loading

0 comments on commit 7b12df4

Please sign in to comment.