diff --git a/.travis.yml b/.travis.yml index 6723a19e1..ef6755ec5 100755 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,7 @@ script: - ./utils/bin/jq-linux -s '.[0] * .[1]' config/config.json config/config.ci.json > /tmp/config.json - cp /tmp/config.json ./config/config.json - nvm exec 12.18.0 npm run build.ci + - nvm exec 12.18.0 npm run size.check - nvm exec 12.18.0 npm run test:ci cache: diff --git a/package.json b/package.json index 0144dda78..2536822a8 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "build.prod": "cross-env NODE_ENV=production next build", "build.dev": "cross-env NODE_ENV=dev next build", "build.ci": "cross-env NODE_ENV=ci next build", + "size.check": "bundlewatch --config size-limit.config.json", "serve": "cross-env NODE_ENV=production next start -p ${SERVE_PORT}", "serve.dev": "cross-env NODE_ENV=dev SERVE_PORT=${SERVE_PORT} node server", "serve.prod": "cross-env NODE_ENV=production SERVE_PORT=${SERVE_PORT} node server", @@ -29,7 +30,8 @@ "test:cover": "npm run test -- --coverage", "test:e2e": "cypress open", "cy:run": "./node_modules/.bin/cypress run --key 60eb2dd7-724d-4b39-bd12-f434f3465866 --record", - "test:ci": "start-server-and-test ci http://localhost:3000 cy:run", + "cy:run:free": "./node_modules/.bin/cypress run", + "test:ci": "start-server-and-test ci http://localhost:3000 cy:run:free", "coveralls": "cat ./coverage/lcov.info | coveralls" }, "config": { @@ -137,6 +139,7 @@ "babel-eslint": "^10.0.2", "babel-jest": "^23.6.0", "babel-plugin-styled-components": "1.10.7", + "bundlewatch": "^0.2.7", "commitizen": "3.1.2", "coveralls": "3.0.6", "cypress": "4.12.1", diff --git a/size-limit.config.json b/size-limit.config.json new file mode 100644 index 000000000..be2b7ffbc --- /dev/null +++ b/size-limit.config.json @@ -0,0 +1,48 @@ +{ + "files": [ + { + "path": ".next/server/pages/community.js", + "maxSize": "280 kB" + }, + { + "path": ".next/server/pages/user.js", + "maxSize": "280 kB" + }, + { + "path": ".next/server/pages/discovery.js", + "maxSize": "280 kB" + }, + { + "path": ".next/server/pages/cool-guide.js", + "maxSize": "280 kB" + }, + { + "path": ".next/server/pages/interview.js", + "maxSize": "280 kB" + }, + { + "path": ".next/server/pages/recipes.js", + "maxSize": "280 kB" + }, + { + "path": ".next/server/pages/job.js", + "maxSize": "280 kB" + }, + { + "path": ".next/server/pages/meetups.js", + "maxSize": "280 kB" + }, + { + "path": ".next/server/pages/sponsor.js", + "maxSize": "280 kB" + }, + { + "path": ".next/server/pages/works.js", + "maxSize": "280 kB" + }, + { + "path": ".next/server/pages/trending.js", + "maxSize": "280 kB" + } + ] +} diff --git a/yarn.lock b/yarn.lock index 21f867e12..e7d296588 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2799,6 +2799,13 @@ aws4@^1.8.0: version "1.10.0" resolved "https://registry.npm.taobao.org/aws4/download/aws4-1.10.0.tgz#a17b3a8ea811060e74d47d306122400ad4497ae2" +axios@^0.19.0: + version "0.19.2" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27" + integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA== + dependencies: + follow-redirects "1.5.10" + axobject-query@^2.0.2: version "2.1.2" resolved "https://registry.npm.taobao.org/axobject-query/download/axobject-query-2.1.2.tgz#2bdffc0371e643e5f03ba99065d5179b9ca79799" @@ -3321,7 +3328,23 @@ builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.npm.taobao.org/builtin-status-codes/download/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" -bytes@3.1.0: +bundlewatch@^0.2.7: + version "0.2.7" + resolved "https://registry.yarnpkg.com/bundlewatch/-/bundlewatch-0.2.7.tgz#978b63c0dafbbef0e3c4a4a26e471fcda6dd5791" + integrity sha512-tTf6TZHowf2kqHMv9nk7ORDdyU8d4OCF5qjkm8jeZfY9hsOdoyvDq3xtPSw+I8eQJJhkdUvcIMp4Cd3GkUAsrA== + dependencies: + axios "^0.19.0" + bytes "^3.0.0" + chalk "^4.0.0" + ci-env "^1.14.0" + commander "^5.0.0" + glob "^7.1.2" + gzip-size "^5.1.1" + jsonpack "^1.1.5" + lodash.merge "^4.6.1" + read-pkg-up "^7.0.1" + +bytes@3.1.0, bytes@^3.0.0: version "3.1.0" resolved "https://registry.npm.taobao.org/bytes/download/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" @@ -3679,6 +3702,11 @@ chrome-trace-event@^1.0.2: dependencies: tslib "^1.9.0" +ci-env@^1.14.0: + version "1.16.0" + resolved "https://registry.yarnpkg.com/ci-env/-/ci-env-1.16.0.tgz#e97f3b5001a8daf7da6e46f418bc6892a238704d" + integrity sha512-ucF9caQEX5wQlY449KZBIJPx91+kRg9tJ3tWSc4+KzrvC5KNiPm/3g1noP8VhdI3046+Vw3jLmKAD0fjCRJTmw== + ci-info@^2.0.0: version "2.0.0" resolved "https://registry.npm.taobao.org/ci-info/download/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" @@ -3871,6 +3899,11 @@ commander@^4.1.1: resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== +commander@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae" + integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg== + commitizen@3.1.2: version "3.1.2" resolved "https://registry.npm.taobao.org/commitizen/download/commitizen-3.1.2.tgz?cache=0&sync_timestamp=1588686522729&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcommitizen%2Fdownload%2Fcommitizen-3.1.2.tgz#29ddd8b39396923e9058a0e4840cbeef144290be" @@ -4770,6 +4803,13 @@ debug@4, debug@4.1.1, debug@^4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: dependencies: ms "^2.1.1" +debug@=3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== + dependencies: + ms "2.0.0" + debug@^3.1.0: version "3.2.6" resolved "https://registry.npm.taobao.org/debug/download/debug-3.2.6.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdebug%2Fdownload%2Fdebug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" @@ -6147,6 +6187,13 @@ flux@^3.1.3: fbemitter "^2.0.0" fbjs "^0.8.0" +follow-redirects@1.5.10: + version "1.5.10" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a" + integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ== + dependencies: + debug "=3.1.0" + for-in@^1.0.1, for-in@^1.0.2: version "1.0.2" resolved "https://registry.npm.taobao.org/for-in/download/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" @@ -6583,7 +6630,7 @@ growly@^1.3.0: version "1.3.0" resolved "https://registry.npm.taobao.org/growly/download/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" -gzip-size@^5.0.0: +gzip-size@^5.0.0, gzip-size@^5.1.1: version "5.1.1" resolved "https://registry.npm.taobao.org/gzip-size/download/gzip-size-5.1.1.tgz#cb9bee692f87c0612b232840a873904e4c135274" dependencies: @@ -8074,6 +8121,11 @@ jsonify@~0.0.0: version "0.0.0" resolved "https://registry.npm.taobao.org/jsonify/download/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" +jsonpack@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/jsonpack/-/jsonpack-1.1.5.tgz#d42b0dcfd91ac58ef3110f96d2c599404c3dc27c" + integrity sha1-1CsNz9kaxY7zEQ+W0sWZQEw9wnw= + jsonparse@^1.2.0: version "1.3.1" resolved "https://registry.npm.taobao.org/jsonparse/download/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" @@ -8380,6 +8432,11 @@ lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.npm.taobao.org/lodash.memoize/download/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" +lodash.merge@^4.6.1: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + lodash.once@^4.1.1: version "4.1.1" resolved "https://registry.npm.taobao.org/lodash.once/download/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac"