Skip to content

Commit

Permalink
Merge branch 'develop' into hydai/update_zh_TW_translation
Browse files Browse the repository at this point in the history
  • Loading branch information
hydai committed Sep 25, 2023
2 parents 7b51b36 + 8ac620f commit eef9905
Show file tree
Hide file tree
Showing 2,049 changed files with 156,054 additions and 95,300 deletions.
541 changes: 452 additions & 89 deletions .circleci/config.yml

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions .circleci/scripts/check-working-tree.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -e
set -u
set -o pipefail

if ! git diff --exit-code
then
echo "Working tree dirty"
exit 1
fi
4 changes: 2 additions & 2 deletions .circleci/scripts/chrome-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ set -o pipefail
sudo apt-get update

# To get the latest version, see <https://www.ubuntuupdates.org/ppa/google_chrome?dist=stable>
CHROME_VERSION='111.0.5563.64-1'
CHROME_VERSION='116.0.5845.179-1'
CHROME_BINARY="google-chrome-stable_${CHROME_VERSION}_amd64.deb"
CHROME_BINARY_URL="https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/${CHROME_BINARY}"

# To retrieve this checksum, run the `wget` and `shasum` commands below
CHROME_BINARY_SHA512SUM='bbfd436c17d6f0554b91211ecf1324aeeac012f1d000d610f93956dbfb8387c0adb56f921c5b7bcc1833c49ab2abbd3bbc250001f650b3ca4f79cebe708c29ae'
CHROME_BINARY_SHA512SUM='cbdad3f5c928ef79a46a3619054b3c4a73a99f942f9bf4ea75d37d6434912da5c01f6ee30718a58e869ff6b57b10bb7fea1cf91885a25aac290a50a2ee3c03c4'

wget -O "${CHROME_BINARY}" -t 5 "${CHROME_BINARY_URL}"

Expand Down
9 changes: 0 additions & 9 deletions .circleci/scripts/deps-install.sh

This file was deleted.

42 changes: 42 additions & 0 deletions .circleci/scripts/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash

set -e
set -o pipefail

IS_NON_FORK_DRAFT='false'

if [[ -n $CIRCLE_PULL_REQUEST ]] && gh auth status
then
PR_NUMBER="${CIRCLE_PULL_REQUEST##*/}"
if [ -n "$PR_NUMBER" ]
then
IS_NON_FORK_DRAFT="$(gh pr view --json isDraft --jq '.isDraft' "$PR_NUMBER")"
fi
fi

# Build query to see whether there are any "preview-like" packages in the manifest
# A "preview-like" package is a `@metamask`-scoped package with a prerelease version that has no period.
QUERY='.dependencies + .devDependencies' # Get list of all dependencies
QUERY+=' | with_entries( select(.key | startswith("@metamask") ) )' # filter to @metamask-scoped packages
QUERY+=' | to_entries[].value' # Get version ranges
QUERY+=' | select(test("^\\d+\\.\\d+\\.\\d+-[^.]+$"))' # Get pinned versions where the prerelease part has no "."

# Use `-e` flag so that exit code indicates whether any matches were found
if jq -e "${QUERY}" < ./package.json
then
echo "Preview builds detected"
HAS_PREVIEW_BUILDS='true'
else
echo "No preview builds detected"
HAS_PREVIEW_BUILDS='false'
fi

if [[ $IS_NON_FORK_DRAFT == 'true' && $HAS_PREVIEW_BUILDS == 'true' ]]
then
# Use GitHub registry on draft PRs, allowing the use of preview builds
echo "Installing with preview builds"
METAMASK_NPM_REGISTRY=https://npm.pkg.github.com yarn --immutable
else
echo "Installing without preview builds"
yarn --immutable
fi
36 changes: 22 additions & 14 deletions .circleci/scripts/release-create-gh-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,42 @@ function install_github_cli ()
popd
}

function print_flask_version ()
function print_build_version ()
{
local flask_filename
flask_filename="$(find ./builds-flask -type f -name 'metamask-flask-chrome-*.zip' -exec basename {} .zip \;)"
local build_type="${1}"; shift

local flask_build_filename_prefix
flask_build_filename_prefix='metamask-flask-chrome-'
local flask_build_filename_prefix_size
flask_build_filename_prefix_size="${#flask_build_filename_prefix}"
local filename
filename="$(find "./builds-${build_type}" -type f -name "metamask-${build_type}-chrome-*.zip" -exec basename {} .zip \;)"

local build_filename_prefix
build_filename_prefix="metamask-${build_type}-chrome-"
local build_filename_prefix_size
build_filename_prefix_size="${#build_filename_prefix}"

# Use substring parameter expansion to remove the filename prefix, leaving just the version
echo "${flask_filename:$flask_build_filename_prefix_size}"
echo "${filename:$build_filename_prefix_size}"
}

function publish_flask_tag ()

function publish_tag ()
{
local flask_version="${1}"; shift
local build_name="${1}"; shift
local build_version="${1}"; shift

git config user.email "[email protected]"
git config user.name "MetaMask Bot"
git tag -a "v${flask_version}" -m "Flask version ${flask_version}"
git tag -a "v${build_version}" -m "${build_name} version ${build_version}"
repo_slug="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME"
git push "https://$GITHUB_TOKEN@github.com/$repo_slug" "v${flask_version}"
git push "https://$GITHUB_TOKEN@github.com/$repo_slug" "v${build_version}"
}

current_commit_msg=$(git show -s --format='%s' HEAD)

if [[ $current_commit_msg =~ Version[-[:space:]](v[[:digit:]]+.[[:digit:]]+.[[:digit:]]+) ]]
then
tag="${BASH_REMATCH[1]}"
flask_version="$(print_flask_version)"
flask_version="$(print_build_version 'flask')"
mmi_version="$(print_build_version 'mmi')"

install_github_cli

Expand All @@ -67,12 +72,15 @@ then
--attach builds/metamask-firefox-*.zip \
--attach builds-flask/metamask-flask-chrome-*.zip \
--attach builds-flask/metamask-flask-firefox-*.zip \
--attach builds-mmi/metamask-mmi-chrome-*.zip \
--attach builds-mmi/metamask-mmi-firefox-*.zip \
--message "Version ${tag##v}" \
--message "$release_body" \
--commitish "$CIRCLE_SHA1" \
"$tag"

publish_flask_tag "${flask_version}"
publish_tag 'Flask' "${flask_version}"
publish_tag 'MMI' "${mmi_version}"
else
printf '%s\n' 'Version not found in commit message; skipping GitHub Release'
exit 0
Expand Down
15 changes: 0 additions & 15 deletions .circleci/scripts/validate-allow-scripts.sh

This file was deleted.

15 changes: 0 additions & 15 deletions .circleci/scripts/validate-lavamoat-policy.sh

This file was deleted.

24 changes: 0 additions & 24 deletions .circleci/scripts/yarn-audit.sh

This file was deleted.

12 changes: 3 additions & 9 deletions .depcheckrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ ignores:
- '@fortawesome/fontawesome-free'
- 'punycode'

#
# snaps flask deps
#
- '@metamask/rpc-methods-flask'
- '@metamask/snaps-controllers-flask'
- '@metamask/snaps-ui-flask'
- '@metamask/snaps-utils-flask'

#
# dev deps
#
Expand Down Expand Up @@ -45,14 +37,16 @@ ignores:
- 'playwright'
- 'wait-on'
# development tool
- 'improved-yarn-audit'
- 'nyc'
# storybook
- '@storybook/cli'
- '@storybook/core'
- '@storybook/addon-essentials'
- '@storybook/addon-a11y'
- '@storybook/addon-mdx-gfm'
- '@storybook/builder-webpack5'
- '@storybook/manager-webpack5'
- '@storybook/react-webpack5'
- 'storybook-dark-mode'
- '@whitespace/storybook-addon-html'
- 'react-syntax-highlighter'
Expand Down
3 changes: 3 additions & 0 deletions .eslintrc.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,8 @@ module.exports = {
// upgrading eslint and dependencies. This rule should be evaluated and
// if agreeable turned on upstream in @metamask/eslint-config
'import/no-named-as-default-member': 'off',

// This is necessary to run eslint on Windows and not get a thousand CRLF errors
'prettier/prettier': ['error', { endOfLine: 'auto' }],
},
};
13 changes: 9 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,18 @@ module.exports = {
],
excludedFiles: [
'app/scripts/controllers/app-state.test.js',
'app/scripts/controllers/network/**/*.test.js',
'app/scripts/controllers/mmi-controller.test.js',
'app/scripts/controllers/permissions/**/*.test.js',
'app/scripts/controllers/preferences.test.js',
'app/scripts/lib/**/*.test.js',
'app/scripts/metamask-controller.test.js',
'app/scripts/migrations/*.test.js',
'app/scripts/platforms/*.test.js',
'development/**/*.test.js',
'shared/**/*.test.js',
'ui/**/*.test.js',
'ui/__mocks__/*.js',
'test/e2e/helpers.test.js',
],
extends: ['@metamask/eslint-config-mocha'],
rules: {
Expand All @@ -265,18 +268,20 @@ module.exports = {
files: [
'**/__snapshots__/*.snap',
'app/scripts/controllers/app-state.test.js',
'app/scripts/controllers/network/**/*.test.js',
'app/scripts/controllers/network/**/*.test.ts',
'app/scripts/controllers/network/provider-api-tests/*.ts',
'app/scripts/controllers/mmi-controller.test.js',
'app/scripts/controllers/permissions/**/*.test.js',
'app/scripts/controllers/preferences.test.js',
'app/scripts/lib/**/*.test.js',
'app/scripts/metamask-controller.test.js',
'app/scripts/migrations/*.test.js',
'app/scripts/platforms/*.test.js',
'development/**/*.test.js',
'development/**/*.test.ts',
'shared/**/*.test.js',
'shared/**/*.test.ts',
'test/helpers/*.js',
'test/jest/*.js',
'test/e2e/helpers.test.js',
'ui/**/*.test.js',
'ui/__mocks__/*.js',
'shared/lib/error-utils.test.js',
Expand Down
4 changes: 3 additions & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@ If you're submitting code to MetaMask, there are some simple things we'd appreci

Before taking the time to code and implement something, feel free to open an issue and discuss it! There may even be an issue already open, and together we may come up with a specific strategy before you take your precious time to write code.

There are also plenty of open issues we'd love help with. Search the [`good first issue`](https://github.com/MetaMask/metamask-extension/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) label, or head to Gitcoin and earn ETH for completing projects we've posted bounties on.
There are also plenty of open issues we'd love help with. Search the [`good first issue`](https://github.com/MetaMask/metamask-extension/contribute) label, or head to Gitcoin and earn ETH for completing projects we've posted bounties on.

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/develop/.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.
- [ ] **Test it**: For any new programmatic functionality, we like unit tests when possible, so if you can keep your code cleanly isolated, please do add a test file to the `tests` folder.
- [ ] **Add to the CHANGELOG**: Help us keep track of all the moving pieces by adding an entry to the [`CHANGELOG.md`](https://github.com/MetaMask/metamask-extension/blob/develop/CHANGELOG.md) with a link to your PR.
- [ ] **Meet the spec**: Make sure the PR adds functionality that matches the issue you're closing. This is especially important for bounties: sometimes design or implementation details are included in the conversation, so read carefully!
- [ ] **Close the issue**: If this PR closes an open issue, add the line `Fixes #$ISSUE_NUMBER`. Ex. For closing issue 418, include the line `Fixes #418`. If it doesn't close the issue but addresses it partially, just include a reference to the issue number, like `#418`.
- [ ] **Keep it simple**: Try not to include multiple features in a single PR, and don't make extraneous changes outside the scope of your contribution. All those touched files make things harder to review ;)
- [ ] **PR against `develop`**: Submit your PR against the `develop` branch. This is where we merge new features so they get some time to receive extra testing before being pushed to `master` for production. If your PR is a hot-fix that needs to be published urgently, you may submit a PR against the `master` branch, but this PR will receive tighter scrutiny before merging.
- [ ] **Get reviewed by a core contributor**: Make sure you get a `:thumbsup`, `:+1`, or `LGTM` from a user with a `Member` badge before merging.
- [ ] **Ensure the PR is correctly labeled.**: More detail about labels definitions can be found [here](https://github.com/MetaMask/metamask-extension/blob/develop/.github/LABELING_GUIDELINES.md).

And that's it! Thanks for helping out.
34 changes: 29 additions & 5 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,30 @@ body:
id: what-happened
attributes:
label: Describe the bug
description: What happened? What did you expect to happen? Please include screenshots if applicable!
placeholder: Tell us what you see!
description: What happened?
placeholder: A clear and concise description of what the bug is
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
description: What did you expect to happen?
- type: textarea
id: screenshot
attributes:
label: Screenshots
description: Please include screenshots if applicable!
- type: textarea
id: reproduce
attributes:
label: Steps to reproduce
description: List all steps needed to reproduce the problem
value: |
1.
description: "List all steps needed to reproduce the problem:"
placeholder: |
1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error
validations:
required: true
- type: textarea
Expand Down Expand Up @@ -96,3 +109,14 @@ body:
attributes:
label: Additional context
description: Add any other context about the problem here, e.g. related issues, additional error messages or logs, or any potentially relevant details about the environment or situation the bug occurred in.
- type: textarea
id: severity
attributes:
label: Severity
description: |
To be added after bug submission by internal support / PM:
placeholder: |
- How critical is the impact of this bug on a user?
- Add stats if available on % of customers impacted
- Is this visible to all users?
- Is this tech debt?
Loading

0 comments on commit eef9905

Please sign in to comment.