Skip to content

Commit

Permalink
Update to Node v14 (#9514)
Browse files Browse the repository at this point in the history
* manual rebase against develop

* Update .nvmrc
  • Loading branch information
kumavis authored Feb 3, 2021
1 parent df5f789 commit b98cef1
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 364 deletions.
19 changes: 11 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions .circleci/scripts/chrome-install.sh
Original file line number Diff line number Diff line change
@@ -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"
13 changes: 0 additions & 13 deletions .circleci/scripts/create-sesify-viz

This file was deleted.

1 change: 0 additions & 1 deletion .circleci/scripts/deps-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v10.18.1
v14
56 changes: 0 additions & 56 deletions development/build/scripts.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const fs = require('fs')
const gulp = require('gulp')
const watch = require('gulp-watch')
const pify = require('pify')
Expand All @@ -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,
Expand Down Expand Up @@ -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: [],
Expand All @@ -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 = [
Expand Down
5 changes: 0 additions & 5 deletions development/metamaskbot-build-announce.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,13 @@ async function start() {
const coverageUrl = `${BUILD_LINK_BASE}/coverage/index.html`
const coverageLink = `<a href="${coverageUrl}">Report</a>`

// links to bundle browser builds
const depVizUrl = `${BUILD_LINK_BASE}/build-artifacts/deps-viz/background/index.html`
const depVizLink = `<a href="${depVizUrl}">background</a>`

// link to artifacts
const allArtifactsUrl = `https://circleci.com/gh/MetaMask/metamask-extension/${CIRCLE_BUILD_NUM}#artifacts/containers/0`

const contentRows = [
`builds: ${buildLinks}`,
`bundle viz: ${bundleLinks}`,
`code coverage: ${coverageLink}`,
`dep viz: ${depVizLink}`,
`<a href="${allArtifactsUrl}">all artifacts</a>`,
]
const hiddenContent = `<ul>${contentRows
Expand Down
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"ethereumjs-abi": "^0.6.4",
"ethereumjs-tx": "1.3.7",
"ethereumjs-util": "5.1.0",
"ethereumjs-wallet": "^0.6.0",
"ethereumjs-wallet": "^0.6.4",
"ethers": "^5.0.8",
"ethjs": "^0.4.0",
"ethjs-contract": "^0.2.3",
Expand Down Expand Up @@ -168,7 +168,7 @@
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"reselect": "^3.0.1",
"rpc-cap": "^3.2.0",
"rpc-cap": "^3.2.1",
"safe-event-emitter": "^1.0.1",
"safe-json-stringify": "^1.2.0",
"single-call-balance-checker-abi": "^1.0.0",
Expand Down Expand Up @@ -210,7 +210,6 @@
"brfs": "^2.0.2",
"browserify": "^16.5.1",
"browserify-derequire": "^1.0.1",
"browserify-transform-tools": "^1.7.0",
"chai": "^4.1.0",
"chalk": "^3.0.0",
"chromedriver": "^79.0.0",
Expand Down Expand Up @@ -280,8 +279,6 @@
"selenium-webdriver": "4.0.0-alpha.7",
"serve-handler": "^6.1.2",
"ses": "0.11.0",
"sesify": "^4.2.1",
"sesify-viz": "^3.0.10",
"sinon": "^9.0.0",
"source-map": "^0.7.2",
"source-map-explorer": "^2.4.2",
Expand All @@ -296,7 +293,7 @@
"webpack": "^4.41.6"
},
"engines": {
"node": "^10.18.1",
"node": "^14.15.1",
"yarn": "^1.16.0"
},
"lavamoat": {
Expand Down
2 changes: 1 addition & 1 deletion test/unit-global/frozenPromise.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Should occur before anything else
import './globalPatch'
import 'ses/dist/lockdown.cjs'
import 'ses/lockdown'
import '../../app/scripts/runLockdown'
import assert from 'assert' /* eslint-disable-line import/first,import/order */

Expand Down
Loading

0 comments on commit b98cef1

Please sign in to comment.