Skip to content

Commit

Permalink
build: test
Browse files Browse the repository at this point in the history
  • Loading branch information
ninenan committed Aug 19, 2021
1 parent 86d0ee7 commit bdcef88
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 4 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@vue/eslint-config-typescript": "^7.0.0",
"@vue/test-utils": "^2.0.0-0",
"commitizen": "^4.2.3",
"compression-webpack-plugin": "^6.0.1",
"cookie-parser": "^1.4.5",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.3.1",
Expand All @@ -62,6 +63,7 @@
"svg-sprite-loader": "^6.0.7",
"typescript": "~4.1.5",
"vue-jest": "^5.0.0-0",
"webpack-bundle-analyzer": "^4.4.2",
"xsrf": "^1.0.0"
}
}
}
24 changes: 24 additions & 0 deletions vue.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const registerRouter = require("./backend/router");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
.BundleAnalyzerPlugin;
const CompressionWebpackPlugin = require("compression-webpack-plugin");
const IS_PROD = ["production", "prod"].includes(process.env.NODE_ENV);
const path = require("path");
const resolve = (dir) => path.join(__dirname, dir);
const productionGzipExtensions = /\.(js|css|json|txt|html|ico|svg)(\?.*)?$/i;

module.exports = {
productionSourceMap: false,

css: {
extract: IS_PROD,
sourceMap: false,
Expand Down Expand Up @@ -46,6 +52,24 @@ module.exports = {
.set("@store", resolve("src/store"))
.set("@helpers", resolve("src/helpers"))
.set("@api", resolve("src/api"));

config.plugin("compression-webpack-plugin").use(BundleAnalyzerPlugin);
},

configureWebpack: (config) => {
const plugins = [];
if (IS_PROD) {
plugins.push(
new CompressionWebpackPlugin({
filename: "[path].gz[query]",
algorithm: "gzip",
test: productionGzipExtensions,
threshold: 10240,
minRatio: 0.8,
})
);
}
config.plugins = [...config.plugins, ...plugins];
},

devServer: {
Expand Down
142 changes: 139 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,19 @@
"@nodelib/fs.scandir" "2.1.4"
fastq "^1.6.0"

"@npmcli/move-file@^1.0.1":
version "1.1.2"
resolved "https://registry.npm.taobao.org/@npmcli/move-file/download/@npmcli/move-file-1.1.2.tgz?cache=0&sync_timestamp=1613067446844&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40npmcli%2Fmove-file%2Fdownload%2F%40npmcli%2Fmove-file-1.1.2.tgz#1a82c3e372f7cae9253eb66d72543d6b8685c674"
integrity sha1-GoLD43L3yuklPrZtclQ9a4aFxnQ=
dependencies:
mkdirp "^1.0.4"
rimraf "^3.0.2"

"@polka/url@^1.0.0-next.17":
version "1.0.0-next.17"
resolved "https://registry.nlark.com/@polka/url/download/@polka/url-1.0.0-next.17.tgz?cache=0&sync_timestamp=1628901980511&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40polka%2Furl%2Fdownload%2F%40polka%2Furl-1.0.0-next.17.tgz#25fdbdfd282c2f86ddf3fcefbd98be99cd2627e2"
integrity sha1-Jf29/SgsL4bd8/zvvZi+mc0mJ+I=

"@soda/friendly-errors-webpack-plugin@^1.7.1":
version "1.8.0"
resolved "https://registry.npm.taobao.org/@soda/friendly-errors-webpack-plugin/download/@soda/friendly-errors-webpack-plugin-1.8.0.tgz?cache=0&sync_timestamp=1607927401282&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40soda%2Ffriendly-errors-webpack-plugin%2Fdownload%2F%40soda%2Ffriendly-errors-webpack-plugin-1.8.0.tgz#84751d82a93019d5c92c0cf0e45ac59087cd2240"
Expand Down Expand Up @@ -2179,6 +2192,11 @@ acorn-walk@^7.1.1:
resolved "https://registry.nlark.com/acorn-walk/download/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc"
integrity sha1-DeiJpgEgOQmw++B7iTjcIdLpZ7w=

acorn-walk@^8.0.0:
version "8.1.1"
resolved "https://registry.nlark.com/acorn-walk/download/acorn-walk-8.1.1.tgz#3ddab7f84e4a7e2313f6c414c5b7dac85f4e3ebc"
integrity sha1-Pdq3+E5KfiMT9sQUxbfayF9OPrw=

acorn@^5.5.3:
version "5.7.4"
resolved "https://registry.nlark.com/acorn/download/acorn-5.7.4.tgz?cache=0&sync_timestamp=1619690236645&other_urls=https%3A%2F%2Fregistry.nlark.com%2Facorn%2Fdownload%2Facorn-5.7.4.tgz#3e8d8a9947d0599a1796d10225d7432f4a4acf5e"
Expand All @@ -2194,6 +2212,11 @@ acorn@^7.1.0, acorn@^7.1.1, acorn@^7.4.0:
resolved "https://registry.nlark.com/acorn/download/acorn-7.4.1.tgz?cache=0&sync_timestamp=1619690236645&other_urls=https%3A%2F%2Fregistry.nlark.com%2Facorn%2Fdownload%2Facorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa"
integrity sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=

acorn@^8.0.4:
version "8.4.1"
resolved "https://registry.nlark.com/acorn/download/acorn-8.4.1.tgz#56c36251fc7cabc7096adc18f05afe814321a28c"
integrity sha1-VsNiUfx8q8cJatwY8Fr+gUMhoow=

address@^1.1.2:
version "1.1.2"
resolved "https://registry.npm.taobao.org/address/download/address-1.1.2.tgz#bf1116c9c758c51b7a933d296b72c221ed9428b6"
Expand Down Expand Up @@ -3035,6 +3058,29 @@ cacache@^13.0.1:
ssri "^7.0.0"
unique-filename "^1.1.1"

cacache@^15.0.5:
version "15.2.0"
resolved "https://registry.nlark.com/cacache/download/cacache-15.2.0.tgz?cache=0&sync_timestamp=1621949655085&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcacache%2Fdownload%2Fcacache-15.2.0.tgz#73af75f77c58e72d8c630a7a2858cb18ef523389"
integrity sha1-c69193xY5y2MYwp6KFjLGO9SM4k=
dependencies:
"@npmcli/move-file" "^1.0.1"
chownr "^2.0.0"
fs-minipass "^2.0.0"
glob "^7.1.4"
infer-owner "^1.0.4"
lru-cache "^6.0.0"
minipass "^3.1.1"
minipass-collect "^1.0.2"
minipass-flush "^1.0.5"
minipass-pipeline "^1.2.2"
mkdirp "^1.0.3"
p-map "^4.0.0"
promise-inflight "^1.0.1"
rimraf "^3.0.2"
ssri "^8.0.1"
tar "^6.0.2"
unique-filename "^1.1.1"

cache-base@^1.0.1:
version "1.0.1"
resolved "https://registry.npm.taobao.org/cache-base/download/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2"
Expand Down Expand Up @@ -3462,6 +3508,11 @@ commander@^2.12.1, commander@^2.18.0, commander@^2.19.0, commander@^2.20.0:
resolved "https://registry.npm.taobao.org/commander/download/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
integrity sha1-/UhehMA+tIgcIHIrpIA16FMa6zM=

commander@^6.2.0:
version "6.2.1"
resolved "https://registry.nlark.com/commander/download/commander-6.2.1.tgz?cache=0&sync_timestamp=1627359190297&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcommander%2Fdownload%2Fcommander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c"
integrity sha1-B5LraC37wyWZm7K4T93duhEKxzw=

commander@~1.1.1:
version "1.1.1"
resolved "https://registry.npm.taobao.org/commander/download/commander-1.1.1.tgz?cache=0&sync_timestamp=1616364348904&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcommander%2Fdownload%2Fcommander-1.1.1.tgz#50d1651868ae60eccff0a2d9f34595376bc6b041"
Expand Down Expand Up @@ -3516,6 +3567,17 @@ compressible@~2.0.16:
dependencies:
mime-db ">= 1.43.0 < 2"

compression-webpack-plugin@^6.0.1:
version "6.1.1"
resolved "https://registry.nlark.com/compression-webpack-plugin/download/compression-webpack-plugin-6.1.1.tgz?cache=0&sync_timestamp=1624626650884&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcompression-webpack-plugin%2Fdownload%2Fcompression-webpack-plugin-6.1.1.tgz#ae8e4b2ffdb7396bb776e66918d751a20d8ccf0e"
integrity sha1-ro5LL/23OWu3duZpGNdRog2Mzw4=
dependencies:
cacache "^15.0.5"
find-cache-dir "^3.3.1"
schema-utils "^3.0.0"
serialize-javascript "^5.0.1"
webpack-sources "^1.4.3"

compression@^1.7.4:
version "1.7.4"
resolved "https://registry.npm.taobao.org/compression/download/compression-1.7.4.tgz#95523eff170ca57c29a0ca41e6fe131f41e5bb8f"
Expand Down Expand Up @@ -4373,7 +4435,7 @@ dotenv@^8.2.0:
resolved "https://registry.npm.taobao.org/dotenv/download/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a"
integrity sha1-l+YZJZradQ7qPk6j4mvO6lQksWo=

duplexer@^0.1.1:
duplexer@^0.1.1, duplexer@^0.1.2:
version "0.1.2"
resolved "https://registry.npm.taobao.org/duplexer/download/duplexer-0.1.2.tgz#3abe43aef3835f8ae077d136ddce0f276b0400e6"
integrity sha1-Or5DrvODX4rgd9E23c4PJ2sEAOY=
Expand Down Expand Up @@ -5607,6 +5669,13 @@ gzip-size@^5.0.0:
duplexer "^0.1.1"
pify "^4.0.1"

gzip-size@^6.0.0:
version "6.0.0"
resolved "https://registry.nlark.com/gzip-size/download/gzip-size-6.0.0.tgz#065367fd50c239c0671cbcbad5be3e2eeb10e462"
integrity sha1-BlNn/VDCOcBnHLy61b4+LusQ5GI=
dependencies:
duplexer "^0.1.2"

handle-thing@^2.0.0:
version "2.0.1"
resolved "https://registry.npm.taobao.org/handle-thing/download/handle-thing-2.0.1.tgz#857f79ce359580c340d43081cc648970d0bb234e"
Expand Down Expand Up @@ -7783,7 +7852,7 @@ mime@1.6.0:
resolved "https://registry.npm.taobao.org/mime/download/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
integrity sha1-Ms2eXGRVO9WNGaVor0Uqz/BJgbE=

mime@^2.4.4:
mime@^2.3.1, mime@^2.4.4:
version "2.5.2"
resolved "https://registry.npm.taobao.org/mime/download/mime-2.5.2.tgz#6e3dc6cc2b9510643830e5f19d5cb753da5eeabe"
integrity sha1-bj3GzCuVEGQ4MOXxnVy3U9pe6r4=
Expand Down Expand Up @@ -8367,7 +8436,7 @@ open@^6.3.0:
dependencies:
is-wsl "^1.1.0"

opener@^1.5.1:
opener@^1.5.1, opener@^1.5.2:
version "1.5.2"
resolved "https://registry.npm.taobao.org/opener/download/opener-1.5.2.tgz#5d37e1f35077b9dcac4301372271afdeb2a13598"
integrity sha1-XTfh81B3udysQwE3InGv3rKhNZg=
Expand Down Expand Up @@ -8470,6 +8539,13 @@ p-map@^3.0.0:
dependencies:
aggregate-error "^3.0.0"

p-map@^4.0.0:
version "4.0.0"
resolved "https://registry.nlark.com/p-map/download/p-map-4.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fp-map%2Fdownload%2Fp-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b"
integrity sha1-uy+Vpe2i7BaOySdOBqdHw+KQTSs=
dependencies:
aggregate-error "^3.0.0"

p-reduce@^1.0.0:
version "1.0.0"
resolved "https://registry.npm.taobao.org/p-reduce/download/p-reduce-1.0.0.tgz#18c2b0dd936a4690a529f8231f58a0fdb6a47dfa"
Expand Down Expand Up @@ -10029,6 +10105,13 @@ serialize-javascript@^4.0.0:
dependencies:
randombytes "^2.1.0"

serialize-javascript@^5.0.1:
version "5.0.1"
resolved "https://registry.nlark.com/serialize-javascript/download/serialize-javascript-5.0.1.tgz#7886ec848049a462467a97d3d918ebb2aaf934f4"
integrity sha1-eIbshIBJpGJGepfT2Rjrsqr5NPQ=
dependencies:
randombytes "^2.1.0"

serve-index@^1.9.1:
version "1.9.1"
resolved "https://registry.npm.taobao.org/serve-index/download/serve-index-1.9.1.tgz#d3768d69b1e7d82e5ce050fff5b453bea12a9239"
Expand Down Expand Up @@ -10141,6 +10224,15 @@ simple-swizzle@^0.2.2:
dependencies:
is-arrayish "^0.3.1"

sirv@^1.0.7:
version "1.0.14"
resolved "https://registry.nlark.com/sirv/download/sirv-1.0.14.tgz?cache=0&sync_timestamp=1628901980666&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsirv%2Fdownload%2Fsirv-1.0.14.tgz#b826343f573e12653c5b3c3080a3a2a6a06595cd"
integrity sha1-uCY0P1c+EmU8WzwwgKOipqBllc0=
dependencies:
"@polka/url" "^1.0.0-next.17"
mime "^2.3.1"
totalist "^1.0.0"

sisteransi@^1.0.5:
version "1.0.5"
resolved "https://registry.nlark.com/sisteransi/download/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed"
Expand Down Expand Up @@ -10368,6 +10460,13 @@ ssri@^7.0.0, ssri@^7.1.0:
figgy-pudding "^3.5.1"
minipass "^3.1.1"

ssri@^8.0.1:
version "8.0.1"
resolved "https://registry.nlark.com/ssri/download/ssri-8.0.1.tgz?cache=0&sync_timestamp=1621364647836&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fssri%2Fdownload%2Fssri-8.0.1.tgz#638e4e439e2ffbd2cd289776d5ca457c4f51a2af"
integrity sha1-Y45OQ54v+9LNKJd21cpFfE9Roq8=
dependencies:
minipass "^3.1.1"

stable@^0.1.8:
version "0.1.8"
resolved "https://registry.npm.taobao.org/stable/download/stable-0.1.8.tgz#836eb3c8382fe2936feaf544631017ce7d47a3cf"
Expand Down Expand Up @@ -10739,6 +10838,18 @@ tapable@^1.0.0, tapable@^1.1.3:
resolved "https://registry.npm.taobao.org/tapable/download/tapable-1.1.3.tgz?cache=0&sync_timestamp=1607088824436&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftapable%2Fdownload%2Ftapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2"
integrity sha1-ofzMBrWNth/XpF2i2kT186Pme6I=

tar@^6.0.2:
version "6.1.10"
resolved "https://registry.nlark.com/tar/download/tar-6.1.10.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ftar%2Fdownload%2Ftar-6.1.10.tgz#8a320a74475fba54398fa136cd9883aa8ad11175"
integrity sha1-ijIKdEdfulQ5j6E2zZiDqorREXU=
dependencies:
chownr "^2.0.0"
fs-minipass "^2.0.0"
minipass "^3.0.0"
minizlib "^2.1.1"
mkdirp "^1.0.3"
yallist "^4.0.0"

tar@^6.1.0:
version "6.1.0"
resolved "https://registry.nlark.com/tar/download/tar-6.1.0.tgz?cache=0&sync_timestamp=1618847020118&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ftar%2Fdownload%2Ftar-6.1.0.tgz#d1724e9bcc04b977b18d5c573b333a2207229a83"
Expand Down Expand Up @@ -10932,6 +11043,11 @@ toposort@^1.0.0:
resolved "https://registry.npm.taobao.org/toposort/download/toposort-1.0.7.tgz#2e68442d9f64ec720b8cc89e6443ac6caa950029"
integrity sha1-LmhELZ9k7HILjMieZEOsbKqVACk=

totalist@^1.0.0:
version "1.1.0"
resolved "https://registry.nlark.com/totalist/download/totalist-1.1.0.tgz#a4d65a3e546517701e3e5c37a47a70ac97fe56df"
integrity sha1-pNZaPlRlF3AePlw3pHpwrJf+Vt8=

tough-cookie@^2.3.3, tough-cookie@^2.3.4, tough-cookie@~2.5.0:
version "2.5.0"
resolved "https://registry.npm.taobao.org/tough-cookie/download/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2"
Expand Down Expand Up @@ -11573,6 +11689,21 @@ webpack-bundle-analyzer@^3.8.0:
opener "^1.5.1"
ws "^6.0.0"

webpack-bundle-analyzer@^4.4.2:
version "4.4.2"
resolved "https://registry.nlark.com/webpack-bundle-analyzer/download/webpack-bundle-analyzer-4.4.2.tgz?cache=0&sync_timestamp=1621259099265&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fwebpack-bundle-analyzer%2Fdownload%2Fwebpack-bundle-analyzer-4.4.2.tgz#39898cf6200178240910d629705f0f3493f7d666"
integrity sha1-OYmM9iABeCQJENYpcF8PNJP31mY=
dependencies:
acorn "^8.0.4"
acorn-walk "^8.0.0"
chalk "^4.1.0"
commander "^6.2.0"
gzip-size "^6.0.0"
lodash "^4.17.20"
opener "^1.5.2"
sirv "^1.0.7"
ws "^7.3.1"

webpack-chain@^6.4.0:
version "6.5.1"
resolved "https://registry.npm.taobao.org/webpack-chain/download/webpack-chain-6.5.1.tgz#4f27284cbbb637e3c8fbdef43eef588d4d861206"
Expand Down Expand Up @@ -11985,6 +12116,11 @@ ws@^7.0.0:
resolved "https://registry.npm.taobao.org/ws/download/ws-7.4.5.tgz#a484dd851e9beb6fdb420027e3885e8ce48986c1"
integrity sha1-pITdhR6b62/bQgAn44hejOSJhsE=

ws@^7.3.1:
version "7.5.3"
resolved "https://registry.nlark.com/ws/download/ws-7.5.3.tgz?cache=0&sync_timestamp=1629264380805&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fws%2Fdownload%2Fws-7.5.3.tgz#160835b63c7d97bfab418fc1b8a9fced2ac01a74"
integrity sha1-Fgg1tjx9l7+rQY/BuKn87SrAGnQ=

xml-name-validator@^3.0.0:
version "3.0.0"
resolved "https://registry.npm.taobao.org/xml-name-validator/download/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a"
Expand Down

0 comments on commit bdcef88

Please sign in to comment.