From b98cef16afe7101cf0484ae69af8f31b3dce687f Mon Sep 17 00:00:00 2001 From: kumavis Date: Wed, 3 Feb 2021 13:45:38 +0800 Subject: [PATCH] Update to Node v14 (#9514) * manual rebase against develop * Update .nvmrc --- .circleci/config.yml | 19 +- .circleci/scripts/chrome-install.sh | 19 ++ .circleci/scripts/create-sesify-viz | 13 - .circleci/scripts/deps-install.sh | 1 - .nvmrc | 2 +- development/build/scripts.js | 56 ----- development/metamaskbot-build-announce.js | 5 - package.json | 9 +- test/unit-global/frozenPromise.js | 2 +- yarn.lock | 294 ++-------------------- 10 files changed, 56 insertions(+), 364 deletions(-) create mode 100755 .circleci/scripts/chrome-install.sh delete mode 100755 .circleci/scripts/create-sesify-viz diff --git a/.circleci/config.yml b/.circleci/config.yml index e0407f18b..c2c7f8a46 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,10 +3,10 @@ version: 2.1 executors: node-browsers: docker: - - image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88 + - image: circleci/node:14-browsers node-browsers-medium-plus: docker: - - image: circleci/node@sha256:e16740707de2ebed45c05d507f33ef204902349c7356d720610b5ec6a35d3d88 + - image: circleci/node:14-browsers resource_class: medium+ environment: NODE_OPTIONS: --max_old_space_size=2048 @@ -262,6 +262,9 @@ jobs: executor: node-browsers steps: - checkout + - run: + name: Re-Install Chrome + command: ./.circleci/scripts/chrome-install.sh - attach_workspace: at: . - run: @@ -286,6 +289,9 @@ jobs: executor: node-browsers steps: - checkout + - run: + name: Re-Install Chrome + command: ./.circleci/scripts/chrome-install.sh - attach_workspace: at: . - run: @@ -364,6 +370,9 @@ jobs: executor: node-browsers steps: - checkout + - run: + name: Re-Install Chrome + command: ./.circleci/scripts/chrome-install.sh - attach_workspace: at: . - run: @@ -404,12 +413,6 @@ jobs: - store_artifacts: path: test-artifacts destination: test-artifacts - # important: generate sesify viz AFTER uploading builds as artifacts - # Temporarily disabled until we can update to a version of `sesify` with - # this fix included: https://github.com/LavaMoat/LavaMoat/pull/121 - # - run: - # name: build:sesify-viz - # command: ./.circleci/scripts/create-sesify-viz - store_artifacts: path: build-artifacts destination: build-artifacts diff --git a/.circleci/scripts/chrome-install.sh b/.circleci/scripts/chrome-install.sh new file mode 100755 index 000000000..491e8c3ed --- /dev/null +++ b/.circleci/scripts/chrome-install.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -e +set -u +set -o pipefail + +CHROME_VERSION='79.0.3945.117-1' +CHROME_BINARY="google-chrome-stable_${CHROME_VERSION}_amd64.deb" +CHROME_BINARY_URL="http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/${CHROME_BINARY}" + +wget -O "${CHROME_BINARY}" -t 5 "${CHROME_BINARY_URL}" + +(sudo dpkg -i "${CHROME_BINARY}" || sudo apt-get -fy install) + +rm -rf "${CHROME_BINARY}" + +sudo sed -i 's|HERE/chrome"|HERE/chrome" --disable-setuid-sandbox --no-sandbox|g' "/opt/google/chrome/google-chrome" + +printf '%s\n' "CHROME ${CHROME_VERSION} configured" diff --git a/.circleci/scripts/create-sesify-viz b/.circleci/scripts/create-sesify-viz deleted file mode 100755 index 33dc0bc72..000000000 --- a/.circleci/scripts/create-sesify-viz +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -set -x -set -e -set -u -set -o pipefail - -# prepare artifacts dir -mkdir -p ./build-artifacts/deps-viz/ - -# generate viz -SESIFY_AUTOGEN=1 yarn build scripts:core:prod:background -npx sesify-viz --deps sesify/deps-background.json --config sesify/background.json --dest ./build-artifacts/deps-viz/background \ No newline at end of file diff --git a/.circleci/scripts/deps-install.sh b/.circleci/scripts/deps-install.sh index 9e1c36c4e..06b4748a9 100755 --- a/.circleci/scripts/deps-install.sh +++ b/.circleci/scripts/deps-install.sh @@ -16,5 +16,4 @@ then fi # use @lavamoat/allow-scripts instead of manually running install scripts so directory change does not persist - yarn allow-scripts diff --git a/.nvmrc b/.nvmrc index 1de6ab5e2..958b5a36e 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v10.18.1 +v14 diff --git a/development/build/scripts.js b/development/build/scripts.js index ae1a3472c..8a54c9b33 100644 --- a/development/build/scripts.js +++ b/development/build/scripts.js @@ -1,4 +1,3 @@ -const fs = require('fs') const gulp = require('gulp') const watch = require('gulp-watch') const pify = require('pify') @@ -11,9 +10,7 @@ const watchify = require('watchify') const browserify = require('browserify') const envify = require('loose-envify/custom') const sourcemaps = require('gulp-sourcemaps') -const sesify = require('sesify') const terser = require('gulp-terser-js') -const { makeStringTransform } = require('browserify-transform-tools') const conf = require('rc')('metamask', { INFURA_PROJECT_ID: process.env.INFURA_PROJECT_ID, @@ -277,44 +274,6 @@ function createScriptTasks({ browserPlatforms, livereload }) { } } - function configureBundleForSesify({ browserifyOpts, bundleName }) { - // add in sesify args for better globalRef usage detection - Object.assign(browserifyOpts, sesify.args) - - // ensure browserify uses full paths - browserifyOpts.fullPaths = true - - // record dependencies used in bundle - fs.mkdirSync('./sesify', { recursive: true }) - browserifyOpts.plugin.push([ - 'deps-dump', - { - filename: `./sesify/deps-${bundleName}.json`, - }, - ]) - - const sesifyConfigPath = `./sesify/${bundleName}.json` - - // add sesify plugin - browserifyOpts.plugin.push([ - sesify, - { - writeAutoConfig: sesifyConfigPath, - }, - ]) - - // remove html comments that SES is alergic to - const removeHtmlComment = makeStringTransform( - 'remove-html-comment', - { excludeExtension: ['.json'] }, - (content, _, cb) => { - const result = content.split('-->').join('-- >') - cb(null, result) - }, - ) - browserifyOpts.transform.push([removeHtmlComment, { global: true }]) - } - function generateBundler(opts, performBundle) { const browserifyOpts = assign({}, watchify.args, { plugin: [], @@ -323,21 +282,6 @@ function createScriptTasks({ browserPlatforms, livereload }) { fullPaths: opts.devMode, }) - const bundleName = opts.filename.split('.')[0] - - // activate sesify - const activateAutoConfig = Boolean(process.env.SESIFY_AUTOGEN) - // const activateSesify = activateAutoConfig - const activateSesify = - activateAutoConfig && ['background'].includes(bundleName) - if (activateSesify) { - configureBundleForSesify({ browserifyOpts, bundleName }) - } - - if (!activateSesify) { - browserifyOpts.plugin.push('browserify-derequire') - } - if (!opts.buildLib) { if (opts.devMode && opts.filename === 'ui.js') { browserifyOpts.entries = [ diff --git a/development/metamaskbot-build-announce.js b/development/metamaskbot-build-announce.js index 1bea36d73..d029e4fc5 100755 --- a/development/metamaskbot-build-announce.js +++ b/development/metamaskbot-build-announce.js @@ -58,10 +58,6 @@ async function start() { const coverageUrl = `${BUILD_LINK_BASE}/coverage/index.html` const coverageLink = `Report` - // links to bundle browser builds - const depVizUrl = `${BUILD_LINK_BASE}/build-artifacts/deps-viz/background/index.html` - const depVizLink = `background` - // link to artifacts const allArtifactsUrl = `https://circleci.com/gh/MetaMask/metamask-extension/${CIRCLE_BUILD_NUM}#artifacts/containers/0` @@ -69,7 +65,6 @@ async function start() { `builds: ${buildLinks}`, `bundle viz: ${bundleLinks}`, `code coverage: ${coverageLink}`, - `dep viz: ${depVizLink}`, `all artifacts`, ] const hiddenContent = `