diff --git a/aio/package.json b/aio/package.json index 7db2bb4eb6..70e78091c8 100644 --- a/aio/package.json +++ b/aio/package.json @@ -13,6 +13,9 @@ "test": "yarn check-env && ng test --sourcemap=false", "pree2e": "yarn ~~update-webdriver", "e2e": "yarn check-env && ng e2e --no-webdriver-update", + "pretest-pwa-score-local": "yarn build", + "test-pwa-score-local": "concurrently --kill-others --success first \"http-server dist -p 4200 --silent\" \"yarn test-pwa-score -- http://localhost:4200 90\"", + "test-pwa-score": "node scripts/test-pwa-score", "deploy-preview": "scripts/deploy-preview.sh", "deploy-staging": "scripts/deploy-staging.sh", "check-env": "node ../tools/check-environment.js", @@ -50,6 +53,7 @@ "@types/node": "~6.0.60", "canonical-path": "^0.0.2", "codelyzer": "~2.0.0", + "concurrently": "^3.4.0", "dgeni": "^0.4.7", "dgeni-packages": "0.17.0", "entities": "^1.1.1", @@ -59,6 +63,7 @@ "fs-extra": "^2.1.1", "globby": "^6.1.0", "html": "^1.0.0", + "http-server": "^0.9.0", "jasmine-core": "~2.5.2", "jasmine-spec-reporter": "~3.2.0", "jsdom": "^9.12.0", @@ -68,6 +73,7 @@ "karma-coverage-istanbul-reporter": "^0.2.0", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", + "lighthouse": "^1.6.3", "lodash": "^4.17.4", "protractor": "~5.1.0", "remark": "^7.0.0", diff --git a/aio/scripts/deploy-preview.sh b/aio/scripts/deploy-preview.sh index 9c94d7da4f..48119de1ff 100755 --- a/aio/scripts/deploy-preview.sh +++ b/aio/scripts/deploy-preview.sh @@ -6,14 +6,17 @@ set +x -eu -o pipefail INPUT_DIR=dist/ OUTPUT_FILE=/tmp/snapshot.tar.gz -AIO_BUILDS_HOST=https://ngbuilds.io -UPLOAD_URL=$AIO_BUILDS_HOST/create-build/$TRAVIS_PULL_REQUEST/$TRAVIS_PULL_REQUEST_SHA +AIO_BUILDS_DOMAIN=ngbuilds.io +UPLOAD_URL=https://$AIO_BUILDS_DOMAIN/create-build/$TRAVIS_PULL_REQUEST/$TRAVIS_PULL_REQUEST_SHA +DEPLOYED_URL=https://pr$TRAVIS_PULL_REQUEST-$TRAVIS_PULL_REQUEST_SHA.$AIO_BUILDS_DOMAIN cd "`dirname $0`/.." -yarn run build +# Build the app +yarn build tar --create --gzip --directory "$INPUT_DIR" --file "$OUTPUT_FILE" . +# Deploy to staging exec 3>&1 httpCode=$( curl --include --location --request POST --silent --write-out "\nHTTP_CODE: %{http_code}\n" \ @@ -30,4 +33,7 @@ if [ $httpCode -lt 200 ] || ([ $httpCode -ge 400 ] && [ $httpCode -ne 409 ]); th exit 1 fi +# Run PWA-score tests +yarn test-pwa-score -- "$DEPLOYED_URL" "$MIN_PWA_SCORE_PREVIEW" + cd - diff --git a/aio/scripts/deploy-staging.sh b/aio/scripts/deploy-staging.sh index a33ee0f09b..bb8dc47d59 100644 --- a/aio/scripts/deploy-staging.sh +++ b/aio/scripts/deploy-staging.sh @@ -5,6 +5,7 @@ set +x -eu -o pipefail FIREBASE_PROJECT_ID=aio-staging +DEPLOYED_URL=https://$FIREBASE_PROJECT_ID.firebaseapp.com cd "`dirname $0`/.." @@ -15,4 +16,7 @@ yarn build firebase use "$FIREBASE_PROJECT_ID" --token "$FIREBASE_TOKEN" firebase deploy --message "Commit: $TRAVIS_COMMIT" --non-interactive --token "$FIREBASE_TOKEN" +# Run PWA-score tests +yarn test-pwa-score -- "$DEPLOYED_URL" "$MIN_PWA_SCORE_STAGING" + cd - diff --git a/aio/scripts/test-pwa-score.js b/aio/scripts/test-pwa-score.js new file mode 100644 index 0000000000..756665e6f4 --- /dev/null +++ b/aio/scripts/test-pwa-score.js @@ -0,0 +1,106 @@ +#!/bin/env node + +/** + * Usage: + * node scripts/test-pwa-score [ []] + * + * Defaults: + * url: http://localhost:4200 + * minScore: 90 + * + * (Ignores HTTPS-related audits, when run for HTTP URL.) + */ + +// Imports +const lighthouse = require('lighthouse'); +const ChromeLauncher = require('lighthouse/lighthouse-cli/chrome-launcher').ChromeLauncher; +const Printer = require('lighthouse/lighthouse-cli/printer'); +const config = require('lighthouse/lighthouse-core/config/default.json'); + +// Constants +const FLAGS = {output: 'json'}; + +// Specify the path to Chrome on Travis +if (process.env.TRAVIS) { + process.env.LIGHTHOUSE_CHROMIUM_PATH = process.env.CHROME_BIN; +} + +// Run +_main(process.argv.slice(2)); + +// Functions - Definitions +function _main(args) { + const {url, minScore} = parseInput(args); + const isOnHttp = /^http:/.test(url); + + console.log(`Running PWA audit for '${url}'...`); + + if (isOnHttp) { + ignoreHttpsAudits(config.aggregations); + } + + launchChromeAndRunLighthouse(url, FLAGS, config). + then(getScore). + then(score => evaluateScore(minScore, score)). + catch(onError); +} + +function evaluateScore(expectedScore, actualScore) { + console.log('Lighthouse PWA score:'); + console.log(` - Expected: ${expectedScore} / 100 (or higher)`); + console.log(` - Actual: ${actualScore} / 100`); + + if (actualScore < expectedScore) { + throw new Error(`PWA score is too low. (${actualScore} < ${expectedScore})`); + } +} + +function getScore(results) { + const scoredAggregations = results.aggregations.filter(a => a.scored); + const total = scoredAggregations.reduce((sum, a) => sum + a.total, 0); + + return Math.round((total / scoredAggregations.length) * 100); +} + +function ignoreHttpsAudits(aggregations) { + const httpsAudits = [ + 'is-on-https', + 'redirects-http' + ]; + + console.info(`Ignoring HTTPS-related audits (${httpsAudits.join(', ')})...`); + + aggregations.forEach(aggregation => + aggregation.items.forEach(item => + httpsAudits.map(key => item.audits[key]).forEach(audit => + // Ugly hack to ignore HTTPS-related audits (i.e. simulate them passing). + // Only meant for use during development. + audit && (audit.expectedValue = !audit.expectedValue)))); +} + +function launchChromeAndRunLighthouse(url, flags, config) { + const launcher = new ChromeLauncher({autoSelectChrome: true}); + + return launcher.run(). + then(() => lighthouse(url, flags, config)). + then(results => launcher.kill().then(() => results)). + catch(err => launcher.kill().then(() => { throw err; }, () => { throw err; })); +} + +function onError(err) { + console.error(err); + process.exit(1); +} + +function parseInput(args) { + const url = args[0]; + const minScore = Number(args[1]); + + if (!url) { + onError('Invalid arguments: not specified.'); + } else if (isNaN(minScore)) { + onError('Invalid arguments: not specified or not a number.'); + } + + return {url, minScore}; +} diff --git a/aio/yarn.lock b/aio/yarn.lock index 647b86a591..3c09edefa3 100644 --- a/aio/yarn.lock +++ b/aio/yarn.lock @@ -275,10 +275,18 @@ ansi-html@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/ansi-html/-/ansi-html-0.0.7.tgz#813584021962a9e9e6fd039f940d12f56ca7859e" +ansi-regex@^0.2.0, ansi-regex@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-0.2.1.tgz#0d8e946967a3d8143f93e24e298525fc1b2235f9" + ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" +ansi-styles@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-1.1.0.tgz#eaecbf66cd706882760b2f4691582b8f55d7a7de" + ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" @@ -495,6 +503,16 @@ aws4@^1.2.1: version "1.6.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" +axe-core@2.1.7: + version "2.1.7" + resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-2.1.7.tgz#4f66f2b3ee3b58ec2d3db4339dd124c5b33b79c3" + +babar@0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/babar/-/babar-0.0.3.tgz#2f394d4a5918f7e1ae9e5408e9a96f3f935ee1e2" + dependencies: + colors "~0.6.2" + babel-code-frame@^6.11.0, babel-code-frame@^6.16.0, babel-code-frame@^6.20.0, babel-code-frame@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" @@ -916,6 +934,16 @@ center-align@^0.1.1: align-text "^0.1.3" lazy-cache "^1.0.3" +chalk@0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-0.5.1.tgz#663b3a648b68b55d04690d49167aa837858f2174" + dependencies: + ansi-styles "^1.1.0" + escape-string-regexp "^1.0.0" + has-ansi "^0.1.0" + strip-ansi "^0.3.0" + supports-color "^0.2.0" + chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" @@ -992,6 +1020,14 @@ chokidar@^1.4.1, chokidar@^1.4.3, chokidar@^1.6.0: optionalDependencies: fsevents "^1.0.0" +chrome-devtools-frontend@1.0.401423: + version "1.0.401423" + resolved "https://registry.yarnpkg.com/chrome-devtools-frontend/-/chrome-devtools-frontend-1.0.401423.tgz#32a89b8d04e378a494be3c8d63271703be1c04ea" + +chrome-devtools-frontend@1.0.422034: + version "1.0.422034" + resolved "https://registry.yarnpkg.com/chrome-devtools-frontend/-/chrome-devtools-frontend-1.0.422034.tgz#071c8ce14466b7653032fcd1ad1a4a68d5e3cbd9" + cipher-base@^1.0.0, cipher-base@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.3.tgz#eeabf194419ce900da3018c207d212f2a6df0a07" @@ -1135,6 +1171,10 @@ colors@1.1.2, colors@^1.1.0, colors@^1.1.2, colors@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" +colors@~0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/colors/-/colors-0.6.2.tgz#2423fe6678ac0c5dae8852e5d0e5be08c997abcc" + combine-lists@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/combine-lists/-/combine-lists-1.0.1.tgz#458c07e09e0d900fc28b70a3fec2dacd1d2cb7f6" @@ -1153,6 +1193,10 @@ comma-separated-tokens@^1.0.1: dependencies: trim "0.0.1" +commander@2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.6.0.tgz#9df7e52fb2a0cb0fb89058ee80c3104225f37e1d" + commander@2.9.x, commander@^2.8.1, commander@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" @@ -1225,6 +1269,19 @@ concat-stream@^1.4.7, concat-stream@^1.5.2: readable-stream "^2.2.2" typedarray "^0.0.6" +concurrently@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-3.4.0.tgz#60662b3defde07375bae19aac0ab780ec748ba79" + dependencies: + chalk "0.5.1" + commander "2.6.0" + date-fns "^1.23.0" + lodash "^4.5.1" + rx "2.3.24" + spawn-command "^0.0.2-1" + supports-color "^3.2.3" + tree-kill "^1.1.0" + configstore@^1.0.0, configstore@^1.2.0: version "1.4.0" resolved "https://registry.yarnpkg.com/configstore/-/configstore-1.4.0.tgz#c35781d0501d268c25c54b8b17f6240e8a4fb021" @@ -1335,6 +1392,10 @@ core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" +corser@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/corser/-/corser-2.0.1.tgz#8eda252ecaab5840dcd975ceb90d9370c819ff87" + crc32-stream@~0.3.1: version "0.3.4" resolved "https://registry.yarnpkg.com/crc32-stream/-/crc32-stream-0.3.4.tgz#73bc25b45fac1db6632231a7bfce8927e9f06552" @@ -1567,6 +1628,10 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" +date-fns@^1.23.0: + version "1.28.2" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.28.2.tgz#19e4192d68875c0bf7c9537e3f296a8ec64853ef" + date-now@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" @@ -1666,6 +1731,13 @@ detect-indent@^4.0.0: dependencies: repeating "^2.0.0" +devtools-timeline-model@1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/devtools-timeline-model/-/devtools-timeline-model-1.1.6.tgz#7be51a73b55d727b597bb30dd1ed2e8e210639a5" + dependencies: + chrome-devtools-frontend "1.0.401423" + resolve "1.1.7" + dgeni-packages@0.17.0: version "0.17.0" resolved "https://registry.yarnpkg.com/dgeni-packages/-/dgeni-packages-0.17.0.tgz#b2e5117670e99109f664703af26a460a5064d6cc" @@ -1849,6 +1921,15 @@ ecdsa-sig-formatter@1.0.9: base64url "^2.0.0" safe-buffer "^5.0.1" +ecstatic@^1.4.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/ecstatic/-/ecstatic-1.4.1.tgz#32cb7b6fa2e290d58668674d115e8f0c3d567d6a" + dependencies: + he "^0.5.0" + mime "^1.2.11" + minimist "^1.1.0" + url-join "^1.0.0" + ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -2024,7 +2105,7 @@ escape-html@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: +escape-string-regexp@^1.0.0, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -2611,6 +2692,10 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" +gl-matrix@2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/gl-matrix/-/gl-matrix-2.3.2.tgz#aac808c74af7d5db05fe04cb60ca1a0fcb174d74" + glob-base@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" @@ -2764,6 +2849,16 @@ handle-thing@^1.2.4: version "1.2.5" resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-1.2.5.tgz#fd7aad726bf1a5fd16dfc29b2f7a6601d27139c4" +handlebars@4.0.5: + version "4.0.5" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.5.tgz#92c6ed6bb164110c50d4d8d0fbddc70806c6f8e7" + dependencies: + async "^1.4.0" + optimist "^0.6.1" + source-map "^0.4.4" + optionalDependencies: + uglify-js "^2.6" + handlebars@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-1.3.0.tgz#9e9b130a93e389491322d975cf3ec1818c37ce34" @@ -2791,6 +2886,12 @@ har-validator@~2.0.6: is-my-json-valid "^2.12.4" pinkie-promise "^2.0.0" +has-ansi@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-0.1.0.tgz#84f265aae8c0e6a88a12d7022894b7568894c62e" + dependencies: + ansi-regex "^0.2.0" + has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" @@ -2876,6 +2977,10 @@ he@1.1.x: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" +he@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/he/-/he-0.5.0.tgz#2c05ffaef90b68e860f3fd2b54ef580989277ee2" + header-case@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/header-case/-/header-case-1.0.0.tgz#d9e335909505d56051ec16a0106821889e910781" @@ -2993,13 +3098,26 @@ http-proxy-middleware@~0.17.1: lodash "^4.17.2" micromatch "^2.3.11" -http-proxy@^1.13.0, http-proxy@^1.16.2: +http-proxy@^1.13.0, http-proxy@^1.16.2, http-proxy@^1.8.1: version "1.16.2" resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.16.2.tgz#06dff292952bf64dbe8471fa9df73066d4f37742" dependencies: eventemitter3 "1.x.x" requires-port "1.x.x" +http-server@^0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/http-server/-/http-server-0.9.0.tgz#8f1b06bdc733618d4dc42831c7ba1aff4e06001a" + dependencies: + colors "1.0.3" + corser "~2.0.0" + ecstatic "^1.4.0" + http-proxy "^1.8.1" + opener "~1.4.0" + optimist "0.6.x" + portfinder "0.4.x" + union "~0.4.3" + http-signature@~1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" @@ -3044,6 +3162,10 @@ image-size@~0.5.0: version "0.5.1" resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.5.1.tgz#28eea8548a4b1443480ddddc1e083ae54652439f" +image-ssim@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/image-ssim/-/image-ssim-0.2.0.tgz#83b42c7a2e6e4b85505477fe6917f5dbc56420e5" + img-stats@^0.5.2: version "0.5.2" resolved "https://registry.yarnpkg.com/img-stats/-/img-stats-0.5.2.tgz#c203496c42f2d9eb2e5ab8232fa756bab32c9e2b" @@ -3512,6 +3634,10 @@ join-path@^1.0.0: url-join "0.0.1" valid-url "^1" +jpeg-js@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.1.2.tgz#135b992c0575c985cfa0f494a3227ed238583ece" + js-base64@^2.1.5, js-base64@^2.1.9: version "2.1.9" resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.1.9.tgz#f0e80ae039a4bd654b5f281fc93f04a914a7fcce" @@ -3587,7 +3713,7 @@ json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1: dependencies: jsonify "~0.0.0" -json-stringify-safe@~5.0.1: +json-stringify-safe@5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" @@ -3815,6 +3941,28 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +lighthouse@^1.6.3: + version "1.6.3" + resolved "https://registry.yarnpkg.com/lighthouse/-/lighthouse-1.6.3.tgz#099ef484d94d844fab7189ef105e1f33464326b6" + dependencies: + axe-core "2.1.7" + chrome-devtools-frontend "1.0.422034" + debug "2.2.0" + devtools-timeline-model "1.1.6" + gl-matrix "2.3.2" + handlebars "4.0.5" + json-stringify-safe "5.0.1" + marked "0.3.6" + metaviewport-parser "0.0.1" + mkdirp "0.5.1" + opn "4.0.2" + rimraf "2.2.8" + semver "5.3.0" + speedline "1.0.3" + whatwg-url "4.0.0" + ws "1.1.1" + yargs "3.32.0" + load-json-file@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" @@ -3924,7 +4072,7 @@ lodash@^3.10.0, lodash@^3.10.1, lodash@^3.8.0, lodash@~3.10.0, lodash@~3.10.1: version "3.10.1" resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" -lodash@^4.0.0, lodash@^4.11.1, lodash@^4.11.2, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.17.2, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.5.0, lodash@^4.6.1: +lodash@^4.0.0, lodash@^4.11.1, lodash@^4.11.2, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.17.2, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.5.0, lodash@^4.5.1, lodash@^4.6.1: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -3953,7 +4101,7 @@ loose-envify@^1.0.0: dependencies: js-tokens "^3.0.0" -loud-rejection@^1.0.0: +loud-rejection@^1.0.0, loud-rejection@^1.3.0: version "1.6.0" resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" dependencies: @@ -4011,7 +4159,7 @@ markdown-table@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-1.1.0.tgz#1f5ae61659ced8808d882554c32e8b3f38dd1143" -marked@^0.3.2: +marked@0.3.6, marked@^0.3.2: version "0.3.6" resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.6.tgz#b2c6c618fccece4ef86c4fc6cb8a7cbf5aeda8d7" @@ -4086,6 +4234,10 @@ merge-descriptors@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" +metaviewport-parser@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/metaviewport-parser/-/metaviewport-parser-0.0.1.tgz#9b28179659b76ff9d21de84ae25583257909b206" + methods@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" @@ -4161,7 +4313,7 @@ mkdirp-promise@^5.0.0: dependencies: mkdirp "*" -mkdirp@*, mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: +mkdirp@*, mkdirp@0.5.1, mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: @@ -4501,6 +4653,10 @@ open@^0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/open/-/open-0.0.5.tgz#42c3e18ec95466b6bf0dc42f3a2945c3f0cad8fc" +opener@~1.4.0: + version "1.4.3" + resolved "https://registry.yarnpkg.com/opener/-/opener-1.4.3.tgz#5c6da2c5d7e5831e8ffa3964950f8d6674ac90b8" + opn@4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/opn/-/opn-4.0.2.tgz#7abc22e644dff63b0a96d5ab7f2790c0f01abc95" @@ -4508,7 +4664,7 @@ opn@4.0.2: object-assign "^4.0.1" pinkie-promise "^2.0.0" -optimist@^0.6.1, optimist@~0.6.0, optimist@~0.6.1: +optimist@0.6.x, optimist@^0.6.1, optimist@~0.6.0, optimist@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" dependencies: @@ -4756,7 +4912,7 @@ pluralize@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" -portfinder@^0.4.0: +portfinder@0.4.x, portfinder@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-0.4.0.tgz#a3ffadffafe4fb98e0601a85eda27c27ce84ca1e" dependencies: @@ -5142,6 +5298,10 @@ qs@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/qs/-/qs-1.1.0.tgz#2845cd9df462b2db28a90370e142d492c5a45dde" +qs@~2.3.3: + version "2.3.3" + resolved "https://registry.yarnpkg.com/qs/-/qs-2.3.3.tgz#e9e85adbe75da0bbe4c8e0476a086290f863b404" + qs@~6.3.0: version "6.3.1" resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.1.tgz#918c0b3bcd36679772baf135b1acb4c1651ed79d" @@ -5507,6 +5667,10 @@ resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" +resolve@1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" + resolve@^1.1.6, resolve@^1.1.7: version "1.2.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.2.0.tgz#9589c3f2f6149d1417a40becc1663db6ec6bc26c" @@ -5544,7 +5708,7 @@ rimraf@2, rimraf@^2.2.8, rimraf@^2.3.3, rimraf@^2.4.3, rimraf@^2.4.4, rimraf@^2. dependencies: glob "^7.0.5" -rimraf@~2.2.6: +rimraf@2.2.8, rimraf@~2.2.6: version "2.2.8" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.2.8.tgz#e439be2aaee327321952730f99a8929e4fc50582" @@ -5590,6 +5754,10 @@ rx-lite@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" +rx@2.3.24: + version "2.3.24" + resolved "https://registry.yarnpkg.com/rx/-/rx-2.3.24.tgz#14f950a4217d7e35daa71bbcbe58eff68ea4b2b7" + rx@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782" @@ -5679,7 +5847,7 @@ semver-dsl@^1.0.1: dependencies: semver "^5.3.0" -"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@^5.0.1, semver@^5.0.3, semver@^5.1.0, semver@^5.2.0, semver@^5.3.0, semver@~5.3.0: +"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@5.3.0, semver@^5.0.1, semver@^5.0.3, semver@^5.1.0, semver@^5.2.0, semver@^5.3.0, semver@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" @@ -5911,6 +6079,10 @@ space-separated-tokens@^1.0.0: dependencies: trim "0.0.1" +spawn-command@^0.0.2-1: + version "0.0.2" + resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2.tgz#9544e1a43ca045f8531aac1a48cb29bdae62338e" + spdx-correct@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" @@ -5949,6 +6121,16 @@ spdy@^3.4.1: select-hose "^2.0.0" spdy-transport "^2.0.15" +speedline@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/speedline/-/speedline-1.0.3.tgz#ee1d98c18d583a2d8488aaded2db9334b943dbbd" + dependencies: + babar "0.0.3" + image-ssim "^0.2.0" + jpeg-js "^0.1.2" + loud-rejection "^1.3.0" + meow "^3.7.0" + sprintf-js@^1.0.3, sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" @@ -6054,6 +6236,12 @@ stringstream@~0.0.4: version "0.0.5" resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" +strip-ansi@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-0.3.0.tgz#25f48ea22ca79187f3174a4db8759347bb126220" + dependencies: + ansi-regex "^0.2.1" + strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" @@ -6147,6 +6335,10 @@ superstatic@^4.0: try-require "^1.0.0" update-notifier "^1.0.1" +supports-color@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-0.2.0.tgz#d92de2694eb3f67323973d7ae3d8b55b4c22190a" + supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" @@ -6342,6 +6534,10 @@ tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" +tree-kill@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.1.0.tgz#c963dcf03722892ec59cba569e940b71954d1729" + trim-lines@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/trim-lines/-/trim-lines-1.1.0.tgz#9926d03ede13ba18f7d42222631fb04c79ff26fe" @@ -6524,6 +6720,12 @@ unified@^6.0.0: x-is-function "^1.0.4" x-is-string "^0.1.0" +union@~0.4.3: + version "0.4.6" + resolved "https://registry.yarnpkg.com/union/-/union-0.4.6.tgz#198fbdaeba254e788b0efcb630bc11f24a2959e0" + dependencies: + qs "~2.3.3" + uniq@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" @@ -6657,6 +6859,10 @@ url-join@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/url-join/-/url-join-0.0.1.tgz#1db48ad422d3402469a87f7d97bdebfe4fb1e3c8" +url-join@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/url-join/-/url-join-1.1.0.tgz#741c6c2f4596c4830d6718460920d0c92202dc78" + url-loader@^0.5.7: version "0.5.7" resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-0.5.7.tgz#67e8779759f8000da74994906680c943a9b0925d" @@ -6944,6 +7150,13 @@ whatwg-encoding@^1.0.1: dependencies: iconv-lite "0.4.13" +whatwg-url@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.0.0.tgz#5be362f0b6e2f8760f7260df6e0e1df536f5479c" + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + whatwg-url@^4.3.0: version "4.7.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.7.0.tgz#202035ac1955b087cdd20fa8b58ded3ab1cd2af5" @@ -7147,7 +7360,7 @@ yargs-parser@^4.2.0: dependencies: camelcase "^3.0.0" -yargs@^3.32.0: +yargs@3.32.0, yargs@^3.32.0: version "3.32.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.32.0.tgz#03088e9ebf9e756b69751611d2a5ef591482c995" dependencies: diff --git a/scripts/ci/deploy.sh b/scripts/ci/deploy.sh index f9aaaa149d..b0155a588d 100755 --- a/scripts/ci/deploy.sh +++ b/scripts/ci/deploy.sh @@ -71,7 +71,7 @@ case ${CI_MODE} in ;; 0) # Preconditions met: Deploy - yarn run deploy-preview + yarn deploy-preview ;; esac fi @@ -82,7 +82,7 @@ case ${CI_MODE} in else # This is upstream master: Deploy to staging travisFoldStart "deploy.aio.staging" - yarn run deploy-staging + yarn deploy-staging travisFoldEnd "deploy.aio.staging" fi ) diff --git a/scripts/ci/env.sh b/scripts/ci/env.sh index 574c711fe2..d529cb376a 100755 --- a/scripts/ci/env.sh +++ b/scripts/ci/env.sh @@ -58,6 +58,12 @@ if [[ ${TRAVIS:-} ]]; then browserstack_optional) setEnvVar KARMA_JS_BROWSERS `node -e "console.log(require('/home/travis/build/angular/angular/browser-providers.conf').browserstackAliases.CI_OPTIONAL.join(','))"` ;; + aio) + # Due to network latency/server performance, the min accepted PWA score + # on previews is a little lower than on staging. + setEnvVar MIN_PWA_SCORE_PREVIEW 93 + setEnvVar MIN_PWA_SCORE_STAGING 95 + ;; esac else setEnvVar KARMA_JS_BROWSERS Chrome diff --git a/scripts/ci/test-aio.sh b/scripts/ci/test-aio.sh index febeefb1e3..cc86badba2 100755 --- a/scripts/ci/test-aio.sh +++ b/scripts/ci/test-aio.sh @@ -14,7 +14,7 @@ source ${thisDir}/_travis-fold.sh # Lint the code travisFoldStart "test.aio.lint" - yarn run lint + yarn lint travisFoldEnd "test.aio.lint" @@ -34,10 +34,16 @@ source ${thisDir}/_travis-fold.sh # Run e2e tests travisFoldStart "test.aio.e2e" - yarn run e2e + yarn e2e travisFoldEnd "test.aio.e2e" + # Run PWA-score tests + travisFoldStart "test.aio.pwaScore" + yarn test-pwa-score-local + travisFoldEnd "test.aio.pwaScore" + + # Run unit tests for aio/aio-builds-setup travisFoldStart "test.aio.aio-builds-setup" ./aio-builds-setup/scripts/test.sh