From 4cae32842fc8d376fad6891b8327752a8d9b51c1 Mon Sep 17 00:00:00 2001 From: Wei Zhu Date: Mon, 18 Nov 2019 12:47:55 +0800 Subject: [PATCH] chore: add packtracker back --- package.json | 2 +- webpack.config.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 915483f65b..d5227380cc 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "scripts": { "api-collection": "antd-tools run api-collection", "authors": "git log --format='%aN <%aE>' | sort -u | grep -v 'users.noreply.github.com' | grep -v 'gitter.im' | grep -v '.local>' | grep -v 'alibaba-inc.com' | grep -v 'alipay.com' | grep -v 'taobao.com' > AUTHORS.txt", - "build": "node -e 'console.log(process.env)' && npm run compile && npm run dist", + "build": "npm run compile && npm run dist", "bundlesize": "bundlesize", "check-commit": "node ./scripts/check-commit.js", "compile": "antd-tools run compile", diff --git a/webpack.config.js b/webpack.config.js index cc2abb9a25..98a98f795c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,6 +1,7 @@ /* eslint no-param-reassign: 0 */ // This config is for building dist files const getWebpackConfig = require('@ant-design/tools/lib/getWebpackConfig'); +const PacktrackerPlugin = require('@packtracker/webpack-plugin'); const { webpack } = getWebpackConfig; @@ -35,6 +36,18 @@ if (process.env.RUN_ENV === 'PRODUCTION') { ignoreMomentLocale(config); externalMoment(config); addLocales(config); + // skip codesandbox ci + if (!process.env.CSB_REPO) { + // https://docs.packtracker.io/uploading-your-webpack-stats/webpack-plugin + config.plugins.push( + new PacktrackerPlugin({ + project_token: '8adbb892-ee4a-4d6f-93bb-a03219fb6778', + upload: process.env.CI === 'true', + fail_build: true, + exclude_assets: name => !['antd.min.js', 'antd.min.css'].includes(name), + }), + ); + } }); }