From c0169bd85dff53cadbaf57063fa68beadf839cba Mon Sep 17 00:00:00 2001 From: Ryan Ghods Date: Mon, 8 Jun 2020 17:15:19 -0700 Subject: [PATCH 1/4] change from surge to netlify --- .github/PULL_REQUEST_TEMPLATE.md | 4 +--- .github/workflows/build.yml | 2 -- README.md | 4 +++- TESTING.md | 2 +- package.json | 1 - scripts/e2e.cdn.sh | 18 ++++-------------- scripts/html/index.html | 4 ---- 7 files changed, 9 insertions(+), 26 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index a37f8ea11eb..1b7a2c6b21a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -29,6 +29,4 @@ Fixes #(issue) - [ ] I ran `npm run build-all` and tested the resulting files from `dist` folder in a browser. - [ ] I have updated the `CHANGELOG.md` file in the root folder. - [ ] I have tested my code on the live network. -- [ ] The browser visual inspection check looks ok: [sudden-playground.surge.sh][1] - -[1]: http://sudden-playground.surge.sh/ +- [ ] I have checked the Deploy Preview and it looks correct. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a8fe6da33a4..736605140ec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,8 +51,6 @@ jobs: CI: true DISPLAY: :99.0 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} - SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }} BUNDLESIZE_GITHUB_TOKEN: ${{ secrets.BUNDLESIZE_GITHUB_TOKEN }} steps: - uses: actions/setup-node@v1 diff --git a/README.md b/README.md index b6c0e34ce5c..a1db37ca5df 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ # web3.js - Ethereum JavaScript API -[![Gitter][gitter-image]][gitter-url] [![StackExchange][stackexchange-image]][stackexchange-url] [![NPM Package Version][npm-image-version]][npm-url] [![NPM Package Downloads][npm-image-downloads]][npm-url] [![Build Status][actions-image]][actions-url] [![Dev Dependency Status][deps-dev-image]][deps-dev-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Lerna][lerna-image]][lerna-url] +[![Gitter][gitter-image]][gitter-url] [![StackExchange][stackexchange-image]][stackexchange-url] [![NPM Package Version][npm-image-version]][npm-url] [![NPM Package Downloads][npm-image-downloads]][npm-url] [![Build Status][actions-image]][actions-url] [![Dev Dependency Status][deps-dev-image]][deps-dev-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Lerna][lerna-image]][lerna-url] [![Netlify Status][netlify-image]][netlify-url] This is the Ethereum [JavaScript API][docs] which connects to the [Generic JSON-RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC) spec. @@ -181,5 +181,7 @@ This project adheres to the [Release Guidelines](./REVIEW.md). [gitter-url]: https://gitter.im/ethereum/web3.js [lerna-image]: https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg [lerna-url]: https://lerna.js.org/ +[netlify-image]: https://api.netlify.com/api/v1/badges/1fc64933-d170-4939-8bdb-508ecd205519/deploy-status +[netlify-url]: https://app.netlify.com/sites/web3-staging/deploys [stackexchange-image]: https://img.shields.io/badge/web3js-stackexchange-brightgreen [stackexchange-url]: https://ethereum.stackexchange.com/questions/tagged/web3js diff --git a/TESTING.md b/TESTING.md index 4417ff11861..bc15ae115c9 100644 --- a/TESTING.md +++ b/TESTING.md @@ -17,7 +17,7 @@ These should pass for PRs to merge: | typescript | dtslint | -- | TS type definitions tests | | dependencies | depcheck | -- | Verifies every dependency is listed correctly in the module package | | bundle | test:e2e:min | [e2e.minified.js][3] | Verifies minified bundle loads in a headless browser *without* being webpacked / browserified | :white_check_mark: | -| cdn | test:e2e:cdn | [e2e.cdn.sh][4]| Visual inspection check: publishes an (un-webpacked) site that uses web3.min.js at http://sudden-playground.surge.sh/ | :white_check_mark: | +| cdn | test:e2e:cdn | [e2e.cdn.sh][4]| Visual inspection check: publishes an (un-webpacked) site that uses web3.min.js at https://web3-staging.netlify.app/ | :white_check_mark: | | windows | -- | [e2e.windows.sh][5] | Verifies Web3 installs on Windows OS / Node 12 and can connect to Infura over wss and https | :white_check_mark: | diff --git a/package.json b/package.json index 134cc1ec4a6..6d933679bdb 100644 --- a/package.json +++ b/package.json @@ -142,7 +142,6 @@ "puppeteer": "^1.20.0", "regenerator-runtime": "^0.13.3", "sandboxed-module": "^2.0.3", - "surge": "^0.21.3", "typescript": "^3.8.3", "underscore": "^1.9.1", "vinyl-source-stream": "^2.0.0", diff --git a/scripts/e2e.cdn.sh b/scripts/e2e.cdn.sh index 1bbd84315c3..96f3b508050 100755 --- a/scripts/e2e.cdn.sh +++ b/scripts/e2e.cdn.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash # -------------------------------------------------------------------- -# Publishes a small test site that uses the packages/web3/dist/min +# Prepares a small test site that uses the packages/web3/dist/min # -------------------------------------------------------------------- if [ -z "$CI" ]; then echo "======================================================================" - echo "This script publishes a test site with surge.sh. Only run in CI." + echo "This script prepares a test site for Netlify. Only run in CI. " echo "======================================================================" exit 1 @@ -15,21 +15,11 @@ if [ -z "$CI" ]; then fi echo "======================================================================" -echo "Publishing test site with surge.sh. See link below. " +echo "Preparing test site for web3-staging.netlify.app " echo "======================================================================" # Mark file with current commit and branch sed -i "s|__COMMIT_HASH__|$GITHUB_SHA|g" scripts/html/index.html sed -i "s|__BRANCH__|$GITHUB_REF|g" scripts/html/index.html -cp packages/web3/dist/web3.min.js scripts/html -cd scripts -(echo "" && exit && cat ) | npx surge --domain sudden-playground.surge.sh html - -# Might be running locally in development -rm html/web3.min.js - -# Sometimes surge.sh fails with an auth error because it's generated a name which -# is already taken (or something?) This test is just meant to be a visual -# inspection check if/when there are doubts - we don't want it crash CI alot. -exit 0 +cp packages/web3/dist/web3.min.js scripts/html \ No newline at end of file diff --git a/scripts/html/index.html b/scripts/html/index.html index 80a65886634..1793b921c28 100644 --- a/scripts/html/index.html +++ b/scripts/html/index.html @@ -11,10 +11,6 @@

Latest Block

- -

Important: this test site is shared by all pull requests & is overwritten by the most recent run.

-

It's only informative when the PR ref number listed below matches your PR.

-

From bf01d4b1f574079082f81ffe91b5fa93567e4c1e Mon Sep 17 00:00:00 2001 From: Ryan Ghods Date: Mon, 8 Jun 2020 17:41:02 -0700 Subject: [PATCH 2/4] use env variables available from netlify --- scripts/e2e.cdn.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/e2e.cdn.sh b/scripts/e2e.cdn.sh index 96f3b508050..2f144724f74 100755 --- a/scripts/e2e.cdn.sh +++ b/scripts/e2e.cdn.sh @@ -19,7 +19,7 @@ echo "Preparing test site for web3-staging.netlify.app " echo "======================================================================" # Mark file with current commit and branch -sed -i "s|__COMMIT_HASH__|$GITHUB_SHA|g" scripts/html/index.html -sed -i "s|__BRANCH__|$GITHUB_REF|g" scripts/html/index.html +sed -i "s|__COMMIT_HASH__|$COMMIT_REF|g" scripts/html/index.html +sed -i "s|__BRANCH__|$BRANCH|g" scripts/html/index.html cp packages/web3/dist/web3.min.js scripts/html \ No newline at end of file From f85ad8752b0a3929054ad9c612b97007b4fbef25 Mon Sep 17 00:00:00 2001 From: Ryan Ghods Date: Mon, 8 Jun 2020 17:59:48 -0700 Subject: [PATCH 3/4] add bundle size to page --- scripts/e2e.cdn.sh | 14 ++++++++++---- scripts/html/index.html | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/e2e.cdn.sh b/scripts/e2e.cdn.sh index 2f144724f74..dcf6768dfbb 100755 --- a/scripts/e2e.cdn.sh +++ b/scripts/e2e.cdn.sh @@ -18,8 +18,14 @@ echo "======================================================================" echo "Preparing test site for web3-staging.netlify.app " echo "======================================================================" -# Mark file with current commit and branch -sed -i "s|__COMMIT_HASH__|$COMMIT_REF|g" scripts/html/index.html -sed -i "s|__BRANCH__|$BRANCH|g" scripts/html/index.html +cp packages/web3/dist/web3.min.js scripts/html + +cd scripts/html + +BUNDLE_SIZE=$(stat -f%z web3.min.js) + +# Mark file with current commit, branch, and bundle size. +sed -i "s|__COMMIT_HASH__|$COMMIT_REF|g" index.html +sed -i "s|__BRANCH__|$BRANCH|g" index.html +sed -i "s|__BUNDLE_SIZE__|$BUNDLE_SIZE|g" index.html -cp packages/web3/dist/web3.min.js scripts/html \ No newline at end of file diff --git a/scripts/html/index.html b/scripts/html/index.html index 1793b921c28..c3b54a37b78 100644 --- a/scripts/html/index.html +++ b/scripts/html/index.html @@ -13,6 +13,7 @@

Latest Block

+

From f07a4182d223d221477eb10db3688d95bf19d11e Mon Sep 17 00:00:00 2001 From: Ryan Ghods Date: Mon, 8 Jun 2020 18:18:38 -0700 Subject: [PATCH 4/4] fix size cmd --- scripts/e2e.cdn.sh | 2 +- scripts/html/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/e2e.cdn.sh b/scripts/e2e.cdn.sh index dcf6768dfbb..37ad6d32c41 100755 --- a/scripts/e2e.cdn.sh +++ b/scripts/e2e.cdn.sh @@ -22,7 +22,7 @@ cp packages/web3/dist/web3.min.js scripts/html cd scripts/html -BUNDLE_SIZE=$(stat -f%z web3.min.js) +BUNDLE_SIZE=$(wc -c web3.min.js | awk '{print $1}') # Mark file with current commit, branch, and bundle size. sed -i "s|__COMMIT_HASH__|$COMMIT_REF|g" index.html diff --git a/scripts/html/index.html b/scripts/html/index.html index c3b54a37b78..3ff8a06bfa6 100644 --- a/scripts/html/index.html +++ b/scripts/html/index.html @@ -25,7 +25,7 @@

Latest Block

document.getElementById("today").innerHTML = "Today is " + Date(block.timestamp); document.getElementById("commitHash").innerHTML = "Merge commit hash: " + "__COMMIT_HASH__"; document.getElementById("branch").innerHTML = "Branch: " + "__BRANCH__"; - document.getElementById("bundleSize").innerHTML = "Bundle Size: " + "__BUNDLE_SIZE__" + " bytes"; + document.getElementById("bundleSize").innerHTML = "Bundle size: " + "__BUNDLE_SIZE__" + " bytes"; } writeBlock();