1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00
metamask-extension/development
kumavis 9a74c995bf
[LavaMoat] improve policy generation performance in dev workflow (#16338)
* npm scripts - rename lavamoat:background to lavamoat:webapp

* lavamoat - generate webapp policy - add devMode flag to run in node for speed

* lavamoat - generate webapp policy - dont lint fences

* lint fix
2022-11-01 08:52:38 -10:00
..
build Use current version of the phishing warning page (#16123) 2022-10-07 14:19:20 -02:30
charts Adding artifacts (#15145) 2022-07-20 19:33:16 +04:00
highlights chore: Adjust trailing whitespace (#15636) 2022-08-24 14:11:49 -05:00
lib remove exclusions for mismatched object jsdoc type casing (#15351) 2022-07-27 08:28:05 -05:00
states Deprecating the Rinkeby, Ropsten, and Kovan test networks (#15989) 2022-09-28 20:26:01 -07:00
ts-migration-dashboard Remove 3box feature and delete ThreeBoxController (#14571) 2022-10-31 13:50:50 -02:30
announcer.js development scripts: add node shebang; mark as executable (#15655) 2022-08-24 12:25:27 -05:00
chromereload.js Build - refactor background process to use html (#10769) 2021-03-31 11:12:28 +08:00
create-static-server.js development scripts: add node shebang; mark as executable (#15655) 2022-08-24 12:25:27 -05:00
empty.js Build - refactor background process to use html (#10769) 2021-03-31 11:12:28 +08:00
generate-icon-names.js Fix/remove mistake script (#15983) 2022-09-27 08:24:49 -05:00
generate-lavamoat-policies.js [LavaMoat] improve policy generation performance in dev workflow (#16338) 2022-11-01 08:52:38 -10:00
generate-migration.sh Fixing migration script generation paths (#10664) 2021-03-17 12:21:46 +08:00
gource-viz.sh chore: Adjust trailing whitespace (#15636) 2022-08-24 14:11:49 -05:00
jest.config.js Jest tests - incremental coverage (#14612) 2022-05-04 17:02:42 +01:00
metamaskbot-build-announce.js Capture user actions times for MV2 benchmark and generate artifacts (#15353) 2022-08-12 19:41:20 +02:00
missing-locale-strings.js development scripts: add node shebang; mark as executable (#15655) 2022-08-24 12:25:27 -05:00
mock-segment.js development scripts: add node shebang; mark as executable (#15655) 2022-08-24 12:25:27 -05:00
README.md chore: Adjust trailing whitespace (#15636) 2022-08-24 14:11:49 -05:00
run-ganache.sh Adding support for EIP-1559 in E2E tests (#13282) 2022-01-19 04:38:41 +05:30
sentry-publish.js development scripts: add node shebang; mark as executable (#15655) 2022-08-24 12:25:27 -05:00
sentry-upload-artifacts.sh Automate the Flask release process (#13898) 2022-03-22 19:55:51 -07:00
shellcheck.sh Add lint:shellcheck:package (#7568) 2019-12-11 15:52:08 -05:00
show-deps-install-scripts.js development scripts: add node shebang; mark as executable (#15655) 2022-08-24 12:25:27 -05:00
source-map-explorer.sh Excluding sourcemaps comment in production builds (#10695) 2021-03-22 19:41:23 -07:00
sourcemap-validator.js development scripts: add node shebang; mark as executable (#15655) 2022-08-24 12:25:27 -05:00
static-server.js development scripts: add node shebang; mark as executable (#15655) 2022-08-24 12:25:27 -05:00
stream-flat-map.js Build - refactor for bundle factoring and swappable runtime (#11080) 2021-07-15 10:59:34 -07:00
verify-locale-strings.js Remove related UI code from the app dir (#15384) 2022-09-16 14:05:21 -05:00

Development

Several files which are needed for developing on MetaMask.

Usually each file or directory contains information about its scope / usage.

Segment

Debugging with the Mock Segment API

To start the Mock Segment API:

  • Add/replace the SEGMENT_HOST and SEGMENT_WRITE_KEY variables in .metamaskrc
    SEGMENT_HOST='http://localhost:9090'
    SEGMENT_WRITE_KEY='FAKE'
    
  • Build the project to the ./dist/ folder with yarn dist
  • Run the Mock Segment API from the command line
    node development/mock-segment.js
    

Events triggered whilst using the extension will be logged to the console of the Mock Segment API.

More information on the API and its usage can be found here.

Debugging in Segment

To debug in a production Segment environment:

  • Create a free account on Segment
  • Create a New Workspace
  • Add a Source (Node.js)
  • Copy the Write Key from the API Keys section under Settings
  • Add/replace the SEGMENT_HOST and SEGMENT_WRITE_KEY variables in .metamaskrc
    SEGMENT_HOST='https://api.segment.io'
    SEGMENT_WRITE_KEY='COPIED_WRITE_KEY'
    
  • Build the project to the ./dist/ folder with yarn dist

Events triggered whilst using the extension will be displayed in Segment's Debugger.

Debugging Segment requests in MetaMask

To opt in to MetaMetrics;

  • Unlock the extension
  • Open the Account menu
  • Click the Settings menu item
  • Click the Security & Privacy menu item
  • Toggle the Participate in MetaMetrics menu option to the ON position

You can inspect the requests in the Network tab of your browser's Developer Tools (background.html) by filtering for POST requests to /v1/batch. The full url will be http://localhost:9090/v1/batch or https://api.segment.io/v1/batch respectively.

Sentry

Debugging in Sentry

To debug in a production Sentry environment:

  • If you have not already got a Sentry account, you can create a free account on Sentry
  • Create a New Sentry Organization
    • If you already have an existing Sentry account and workspace, open the sidebar drop down menu, then click Switch organization followed by Create a new organization
  • Create a New Project
  • Copy the Public Key and Project ID from the Client Keys section under your projects Settings
    • Select Settings in the sidebar menu, then select Projects in the secondary menu. Click your project then select Client Keys (DSN) from the secondary menu. Click the Configure button on the Client Keys page and copy your Project Id and Public Key
  • Add/replace the SENTRY_DSN and SENTRY_DSN_DEV variables in .metamaskrc
    SENTRY_DSN_DEV=https://{SENTRY_PUBLIC_KEY}@sentry.io/{SENTRY_PROJECT_ID}
    SENTRY_DSN=https://{SENTRY_PUBLIC_KEY}@sentry.io/{SENTRY_PROJECT_ID}
    
  • Build the project to the ./dist/ folder with yarn dist

Errors reported whilst using the extension will be displayed in Sentry's Issues page.