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

feat: enable code fence capabilities on mobile app. #7734

Merged
merged 25 commits into from
Nov 17, 2023

Conversation

Jonathansoufer
Copy link
Contributor

@Jonathansoufer Jonathansoufer commented Nov 8, 2023

Description

This PR implements code fence feature to allow flask and main code co-live in the same branch yet delivered accordantly with build type, meaning flask code will only be included in flask build and not main.

Here is the version of code fencing implemented on extension.

Related issues

Fixes: https://github.com/MetaMask/accounts-planning/issues/112

Manual testing steps

Add code fence directive (BEGIN and END) on any code block and run the build.

              {
               ///: BEGIN:ONLY_INCLUDE_IN(flask)
              }

              <View style={styles.foxWrapper}>
                {Device.isAndroid() ? (
                  <Image
                    source={require('../../../images/fox.png')}
                    style={styles.image}
                    resizeMethod={'auto'}
                  />
                ) : (
                  <AnimatedFox bgColor={colors.background.default} />
                )}
              </View>
              {
                ///: END:ONLY_INCLUDE_IN
              }

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

Next Steps

  • Adjust android/app/build.gradle and add new iOS configurations/schemas for FLASK build.
  • Add env variable to distinguish builds.

@Jonathansoufer Jonathansoufer self-assigned this Nov 8, 2023
Copy link
Contributor

github-actions bot commented Nov 8, 2023

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Nov 8, 2023
@owencraston
Copy link
Contributor

we also need to ensure that we run a lint step after we build both main and flask to ensure that there are no unused variables and that each ///: END:ONLY_INCLUDE_IN has a corresponding ///: END:ONLY_INCLUDE_IN

@owencraston owencraston mentioned this pull request Nov 8, 2023
14 tasks
@Jonathansoufer Jonathansoufer changed the title Feat: Add Code Fencing feat: Add Code Fencing Nov 13, 2023
@Jonathansoufer Jonathansoufer changed the title feat: Add Code Fencing feat: enable code fence capabilities on mobile app. Nov 13, 2023
@Jonathansoufer Jonathansoufer removed the INVALID-PR-TEMPLATE PR's body doesn't match template label Nov 13, 2023
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Nov 13, 2023
@Jonathansoufer Jonathansoufer marked this pull request as ready for review November 13, 2023 13:03
@Jonathansoufer Jonathansoufer requested a review from a team as a code owner November 13, 2023 13:03
Copy link
Contributor

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/ad77009b-f443-4b42-a895-4d366242bf26
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

metro.transform.js Outdated Show resolved Hide resolved
@sethkfman
Copy link
Contributor

@Jonathansoufer The only thing I would add is a bit of documentation in the README.md with a short description of code fencing and how to use it. If you wrote something up in notion bring it into the project.

@owencraston
Copy link
Contributor

@Jonathansoufer we can probably add a similar readme to this one

Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

Left some comments

metro.config.js Outdated Show resolved Hide resolved
remove-fenced-code.js Outdated Show resolved Hide resolved
remove-fenced-code.test.js Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Nov 16, 2023

Codecov Report

Attention: 23 lines in your changes are missing coverage. Please review.

Comparison is base (eeb99d8) 35.17% compared to head (428e94f) 35.32%.

Files Patch % Lines
app/transforms/remove-fenced-code.js 77.00% 23 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7734      +/-   ##
==========================================
+ Coverage   35.17%   35.32%   +0.15%     
==========================================
  Files        1039     1040       +1     
  Lines       27614    27714     +100     
  Branches     2340     2340              
==========================================
+ Hits         9712     9789      +77     
- Misses      17377    17400      +23     
  Partials      525      525              

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

@owencraston owencraston mentioned this pull request Nov 16, 2023
18 tasks
metro.transform.js Outdated Show resolved Hide resolved
owencraston
owencraston previously approved these changes Nov 16, 2023
@owencraston
Copy link
Contributor

I added a few more specific tests so that the expected results were more clear and they are all passing.
Screenshot 2023-11-16 at 3 35 31 PM

Copy link
Contributor

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/bc01b80b-4ace-4f58-a81e-aebf855ad731
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

@owencraston
Copy link
Contributor

Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

LGTM

@owencraston
Copy link
Contributor

Copy link

sonarcloud bot commented Nov 17, 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 3 Code Smells

61.6% 61.6% Coverage
0.0% 0.0% Duplication

@owencraston owencraston merged commit 9ed32a5 into main Nov 17, 2023
26 checks passed
@owencraston owencraston deleted the feat/add-flask-code-fencing branch November 17, 2023 18:43
@github-actions github-actions bot locked and limited conversation to collaborators Nov 17, 2023
@metamaskbot metamaskbot added the release-7.12.0 Issue or pull request that will be included in release 7.12.0 label Nov 17, 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 mobile-snaps release-7.12.0 Issue or pull request that will be included in release 7.12.0 team-accounts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants