From 297437cb83941e60af4f47e996e24be7744d9a3b Mon Sep 17 00:00:00 2001 From: kumavis Date: Tue, 10 Sep 2019 17:55:19 +0800 Subject: [PATCH 1/4] ci - create source-map-explorer build-artifacts --- .circleci/config.yml | 3 ++ development/source-map-explorer.sh | 8 +++++ package.json | 1 + yarn.lock | 51 +++++++++++++++++++++++++++--- 4 files changed, 58 insertions(+), 5 deletions(-) create mode 100755 development/source-map-explorer.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index a8cfb4000885..91578eab84f9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -213,6 +213,9 @@ jobs: - checkout - attach_workspace: at: . + - run: + name: build:source-map-explorer + command: ./development/source-map-explorer.sh - store_artifacts: path: dist/sourcemaps destination: builds/sourcemaps diff --git a/development/source-map-explorer.sh b/development/source-map-explorer.sh new file mode 100755 index 000000000000..f626a115270e --- /dev/null +++ b/development/source-map-explorer.sh @@ -0,0 +1,8 @@ +#! /bin/bash +set -x + +mkdir -p build-artifacts/source-map-explorer +npx source-map-explorer dist/chrome/inpage.js --html build-artifacts/source-map-explorer/inpage.html +npx source-map-explorer dist/chrome/contentscript.js --html build-artifacts/source-map-explorer/contentscript.html +npx source-map-explorer dist/chrome/background.js --html build-artifacts/source-map-explorer/background.html +npx source-map-explorer dist/chrome/ui.js --html build-artifacts/source-map-explorer/ui.html \ No newline at end of file diff --git a/package.json b/package.json index 86273e0785f9..9b4737ef5d92 100644 --- a/package.json +++ b/package.json @@ -269,6 +269,7 @@ "sesify-viz": "^2.0.1", "sinon": "^5.0.0", "source-map": "^0.7.2", + "source-map-explorer": "^2.0.1", "static-server": "^2.2.1", "style-loader": "^0.21.0", "stylelint-config-standard": "^18.2.0", diff --git a/yarn.lock b/yarn.lock index 5175a52b0dfd..ee7ef159ebe2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6029,7 +6029,7 @@ convert-source-map@^0.3.3: resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-0.3.5.tgz#f1d802950af7dd2631a1febe0596550c86ab3190" integrity sha1-8dgClQr33SYxof6+BZZVDIarMZA= -convert-source-map@^1.1.0, convert-source-map@^1.5.0: +convert-source-map@^1.1.0, convert-source-map@^1.5.0, convert-source-map@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.6.0.tgz#51b537a8c43e0f04dec1993bffcdd504e758ac20" integrity sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A== @@ -7678,6 +7678,11 @@ ejs@^2.4.1, ejs@^2.6.1: resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.6.1.tgz#498ec0d495655abc6f23cd61868d926464071aa0" integrity sha512-0xy4A/twfrRCnkhfk8ErDi5DqdAsAqeGxht4xkCUrsvhhbQNs7E+4jV0CN7+NKIY0aHE72+XvqtBIXzD31ZbXQ== +ejs@^2.6.2: + version "2.7.1" + resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.7.1.tgz#5b5ab57f718b79d4aca9254457afecd36fa80228" + integrity sha512-kS/gEPzZs3Y1rRsbGX4UOSjtP/CeJP0CxSNZHYxGfVM/VgLcv0ZqM7C45YyTj2DI2g7+P9Dd24C+IMIg6D0nYQ== + electron-download@^3.0.1: version "3.3.0" resolved "https://registry.yarnpkg.com/electron-download/-/electron-download-3.3.0.tgz#2cfd54d6966c019c4d49ad65fbe65cc9cdef68c8" @@ -8078,7 +8083,7 @@ es6-weak-map@^2.0.1, es6-weak-map@^2.0.2: es6-iterator "^2.0.1" es6-symbol "^3.1.1" -escape-html@~1.0.3: +escape-html@^1.0.3, escape-html@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= @@ -10700,7 +10705,7 @@ glob@7.1.2, glob@^7.0.0, glob@^7.0.3, glob@^7.0.4, glob@^7.0.5, glob@^7.1.0, glo once "^1.3.0" path-is-absolute "^1.0.0" -glob@7.1.4, glob@^7.1.3, glob@~7.1.4: +glob@7.1.4, glob@^7.1.3, glob@^7.1.4, glob@~7.1.4: version "7.1.4" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== @@ -15913,6 +15918,13 @@ open@^6.1.0: dependencies: is-wsl "^1.1.0" +open@^6.3.0: + version "6.4.0" + resolved "https://registry.yarnpkg.com/open/-/open-6.4.0.tgz#5c13e96d0dc894686164f18965ecfe889ecfc8a9" + integrity sha512-IFenVPgF70fSm1keSd2iDBIDIBZkroLeuffXq+wKTzTJlBpesFWojV9lb8mzOfaAzM1sr7HQHuO0vtV0zYekGg== + dependencies: + is-wsl "^1.1.0" + opener@~1.4.0: version "1.4.3" resolved "https://registry.yarnpkg.com/opener/-/opener-1.4.3.tgz#5c6da2c5d7e5831e8ffa3964950f8d6674ac90b8" @@ -18961,7 +18973,7 @@ rimraf@2, rimraf@^2.2.8, rimraf@^2.4.4, rimraf@^2.5.4, rimraf@^2.6.0, rimraf@^2. dependencies: glob "^7.0.5" -rimraf@2.6.3, rimraf@^2.6.1: +rimraf@2.6.3, rimraf@^2.6.1, rimraf@~2.6.2: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== @@ -20146,6 +20158,23 @@ source-list-map@^2.0.0: resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.0.tgz#aaa47403f7b245a92fbc97ea08f250d6087ed085" integrity sha512-I2UmuJSRr/T8jisiROLU3A3ltr+swpniSmNPI4Ml3ZCX6tVnDsuZzK7F2hl5jTqbZBWCEKlj5HRQiPExXLgE8A== +source-map-explorer@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/source-map-explorer/-/source-map-explorer-2.0.1.tgz#988721e8320d7b6925bc40289e5de658fe4cad4d" + integrity sha512-mv2sv2b6oN2L9n18O/eLrYiP5zfWEHESLq4utWBqNw8GnkbuRuXs8twVCOhMT5hxRzfQgS7Yxh7HlQaW8oeiAQ== + dependencies: + btoa "^1.2.1" + chalk "^2.4.2" + convert-source-map "^1.6.0" + ejs "^2.6.2" + escape-html "^1.0.3" + glob "^7.1.4" + lodash "^4.17.11" + open "^6.3.0" + source-map "^0.7.3" + temp "^0.9.0" + yargs "^13.2.4" + source-map-resolve@^0.5.0, source-map-resolve@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.1.tgz#7ad0f593f2281598e854df80f19aae4b92d7a11a" @@ -20229,6 +20258,11 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +source-map@^0.7.3: + version "0.7.3" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" + integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== + space-separated-tokens@^1.0.0: version "1.1.4" resolved "https://registry.yarnpkg.com/space-separated-tokens/-/space-separated-tokens-1.1.4.tgz#27910835ae00d0adfcdbd0ad7e611fb9544351fa" @@ -21293,6 +21327,13 @@ temp-dir@^1.0.0: resolved "https://registry.yarnpkg.com/temp-dir/-/temp-dir-1.0.0.tgz#0a7c0ea26d3a39afa7e0ebea9c1fc0bc4daa011d" integrity sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0= +temp@^0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/temp/-/temp-0.9.0.tgz#61391795a11bd9738d4c4d7f55f012cb8f55edaa" + integrity sha512-YfUhPQCJoNQE5N+FJQcdPz63O3x3sdT4Xju69Gj4iZe0lBKOtnAMi0SLj9xKhGkcGhsxThvTJ/usxtFPo438zQ== + dependencies: + rimraf "~2.6.2" + tempfile@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/tempfile/-/tempfile-2.0.0.tgz#6b0446856a9b1114d1856ffcbe509cccb0977265" @@ -23481,7 +23522,7 @@ yargs@^12.0.1: y18n "^3.2.1 || ^4.0.0" yargs-parser "^11.1.1" -yargs@^13.3.0: +yargs@^13.2.4, yargs@^13.3.0: version "13.3.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83" integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA== From 50c9465e101b0cf6b0aaf2adc8027d5dcfd6c8e3 Mon Sep 17 00:00:00 2001 From: kumavis Date: Tue, 10 Sep 2019 18:34:45 +0800 Subject: [PATCH 2/4] ci - add source-map-explorer builds to metamaskbot comment --- development/metamaskbot-build-announce.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/development/metamaskbot-build-announce.js b/development/metamaskbot-build-announce.js index 719cbd50cf60..8050263452bd 100755 --- a/development/metamaskbot-build-announce.js +++ b/development/metamaskbot-build-announce.js @@ -23,12 +23,23 @@ async function start () { const SHORT_SHA1 = CIRCLE_SHA1.slice(0, 7) const BUILD_LINK_BASE = `https://${CIRCLE_BUILD_NUM}-42009758-gh.circle-artifacts.com/0` - const CHROME = `${BUILD_LINK_BASE}/builds/metamask-chrome-${VERSION}.zip` - const FIREFOX = `${BUILD_LINK_BASE}/builds/metamask-firefox-${VERSION}.zip` - const EDGE = `${BUILD_LINK_BASE}/builds/metamask-edge-${VERSION}.zip` - const OPERA = `${BUILD_LINK_BASE}/builds/metamask-opera-${VERSION}.zip` - - const commentBody = `Builds ready [${SHORT_SHA1}]: chrome, firefox, edge, opera` + // build the github comment content + + // links to extension builds + const buildLinks = platforms.map(platform => { + const url = `${BUILD_LINK_BASE}/builds/metamask-${platform}-${VERSION}.zip` + return `${platform}` + }).join(', ') + + // links to bundle browser builds + const bundleLinks = bundles.map(bundle => { + const url = `${BUILD_LINK_BASE}/build-artifacts/source-map-explorer/${bundle}.html` + return `${bundle}` + }).join(', ') + + const exposedContent = `Builds ready [${SHORT_SHA1}]` + const hiddenContent = `` + const commentBody = `
${exposedContent}${hiddenContent}
` const JSON_PAYLOAD = JSON.stringify({ body: commentBody }) const POST_COMMENT_URI = `https://api.github.com/repos/metamask/metamask-extension/issues/${CIRCLE_PR_NUMBER}/comments` From 32f36923c4799b6313f251d19633303ca7396ca8 Mon Sep 17 00:00:00 2001 From: kumavis Date: Tue, 10 Sep 2019 18:52:31 +0800 Subject: [PATCH 3/4] lint fix --- development/metamaskbot-build-announce.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/development/metamaskbot-build-announce.js b/development/metamaskbot-build-announce.js index 8050263452bd..2e461e837681 100755 --- a/development/metamaskbot-build-announce.js +++ b/development/metamaskbot-build-announce.js @@ -26,12 +26,14 @@ async function start () { // build the github comment content // links to extension builds + const platforms = ['chrome', 'firefox', 'opera', 'edge'] const buildLinks = platforms.map(platform => { const url = `${BUILD_LINK_BASE}/builds/metamask-${platform}-${VERSION}.zip` return `${platform}` }).join(', ') // links to bundle browser builds + const bundles = ['background', 'ui', 'inpage', 'contentscript'] const bundleLinks = bundles.map(bundle => { const url = `${BUILD_LINK_BASE}/build-artifacts/source-map-explorer/${bundle}.html` return `${bundle}` From 9f3bea656f0e03fd3584722bbc8816313e4c870d Mon Sep 17 00:00:00 2001 From: kumavis Date: Wed, 11 Sep 2019 00:22:52 +0800 Subject: [PATCH 4/4] ci - source-map-explorer - include all bundles --- development/metamaskbot-build-announce.js | 2 +- development/source-map-explorer.sh | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/development/metamaskbot-build-announce.js b/development/metamaskbot-build-announce.js index 2e461e837681..682cf66b8e27 100755 --- a/development/metamaskbot-build-announce.js +++ b/development/metamaskbot-build-announce.js @@ -33,7 +33,7 @@ async function start () { }).join(', ') // links to bundle browser builds - const bundles = ['background', 'ui', 'inpage', 'contentscript'] + const bundles = ['background', 'ui', 'inpage', 'contentscript', 'libs', 'phishing-detect'] const bundleLinks = bundles.map(bundle => { const url = `${BUILD_LINK_BASE}/build-artifacts/source-map-explorer/${bundle}.html` return `${bundle}` diff --git a/development/source-map-explorer.sh b/development/source-map-explorer.sh index f626a115270e..2a2ec61204c0 100755 --- a/development/source-map-explorer.sh +++ b/development/source-map-explorer.sh @@ -5,4 +5,6 @@ mkdir -p build-artifacts/source-map-explorer npx source-map-explorer dist/chrome/inpage.js --html build-artifacts/source-map-explorer/inpage.html npx source-map-explorer dist/chrome/contentscript.js --html build-artifacts/source-map-explorer/contentscript.html npx source-map-explorer dist/chrome/background.js --html build-artifacts/source-map-explorer/background.html -npx source-map-explorer dist/chrome/ui.js --html build-artifacts/source-map-explorer/ui.html \ No newline at end of file +npx source-map-explorer dist/chrome/ui.js --html build-artifacts/source-map-explorer/ui.html +npx source-map-explorer dist/chrome/libs.js --html build-artifacts/source-map-explorer/libs.html +npx source-map-explorer dist/chrome/phishing-detect.js --html build-artifacts/source-map-explorer/phishing-detect.html