Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Replace local code fence transform with @metamask/build-utils #7972

Merged
merged 4 commits into from
Dec 6, 2023

Conversation

rekmarks
Copy link
Member

@rekmarks rekmarks commented Dec 1, 2023

Description

In #7734, code fence support was added to MetaMask Mobile by essentially copypasting the implementation from the extension. This PR replaces the local code fence implementation with a version that was extracted into its own package.

The external package implements code fence parsing and removal, as well as linting transformed files. The consumer is responsible for integrating the fence parser into the given build system, and configuring the ESLint instance used for linting. Consequently, only the Metro transform and the ESLint instance initialization remain in this repository.

Related issues

Manual testing steps

  1. Check that different build types are built correctly

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@rekmarks rekmarks added needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) team-mobile-platform needs-smoke-e2e labels Dec 1, 2023
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Dec 1, 2023
@rekmarks rekmarks marked this pull request as ready for review December 1, 2023 03:23
@rekmarks rekmarks requested a review from a team as a code owner December 1, 2023 03:23
Copy link
Contributor

github-actions bot commented Dec 1, 2023

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/57586e03-9b32-40a9-83e3-33878c35cd48
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

Copy link

New dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
@metamask/build-utils 1.0.0 filesystem +3 742 kB metamaskbot

Copy link

socket-security bot commented Dec 1, 2023

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

@codecov-commenter
Copy link

codecov-commenter commented Dec 1, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (199aa40) 36.60% compared to head (f4ba714) 36.46%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7972      +/-   ##
==========================================
- Coverage   36.60%   36.46%   -0.15%     
==========================================
  Files        1092     1091       -1     
  Lines       29178    29076     -102     
  Branches     2677     2677              
==========================================
- Hits        10681    10602      -79     
+ Misses      17885    17862      -23     
  Partials      612      612              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rekmarks rekmarks changed the title Add @metamask/build-utils chore: Replace local code fence transform with @metamask/build-utils Dec 1, 2023
@rekmarks rekmarks changed the title chore: Replace local code fence transform with @metamask/build-utils chore: Replace local code fence transform with @metamask/build-utils Dec 1, 2023
- Migrate code fence removal from local to
  package implementation
- Delete local code fence implementation, tests,
  and mocks
@rekmarks
Copy link
Member Author

rekmarks commented Dec 1, 2023

@SocketSecurity ignore source-map@0.7.3

@rekmarks rekmarks marked this pull request as draft December 1, 2023 03:51
@rekmarks rekmarks marked this pull request as ready for review December 1, 2023 04:09
Copy link
Contributor

github-actions bot commented Dec 1, 2023

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/6e8aeea0-8863-4c52-ae64-92cc5b413304
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

rekmarks added a commit to MetaMask/metamask-extension that referenced this pull request Dec 4, 2023
## **Description**

In MetaMask/metamask-mobile#7734, code fence
support was added to MetaMask Mobile by essentially copypasting the
implementation from the extension. This PR replaces the local code fence
implementation with a version that was extracted into its own package.

The external package implements code fence parsing and removal, as well
as linting transformed files. The consumer is responsible for
integrating the fence parser into the given build system, and
configuring the ESLint instance used for linting. Consequently, the
following remains in this repository after extracting the fence parsers:
- `RemoveFencedCodeTransform`, a transform stream compatible with
Browserify
- A utility for configuring and initializing a singleton ESLint instance

The PR is deceptively large; most changes are due to renaming existing
fences. For reviewers, the relevant files are:
- `development/build/transforms/*`
- `lavamoat/build-system/policy.json`

## **Related issues**

- MetaMask/core#3577
- MetaMask/metamask-mobile#7972

## **Manual testing steps**

1. Create different builds of the extension and verify that they are
working and include the correct features

---------

Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
Copy link

sonarcloud bot commented Dec 4, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Contributor

@Jonathansoufer Jonathansoufer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great job decoupling this feature from clients.

@rekmarks rekmarks merged commit c91c486 into main Dec 6, 2023
26 checks passed
@rekmarks rekmarks deleted the add-build-utils branch December 6, 2023 02:05
@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2023
@github-actions github-actions bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Dec 6, 2023
@metamaskbot metamaskbot added the release-7.14.0 Issue or pull request that will be included in release 7.14.0 label Dec 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
INVALID-PR-TEMPLATE PR's body doesn't match template needs-smoke-e2e release-7.14.0 Issue or pull request that will be included in release 7.14.0 team-mobile-platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants