Skip to content

Commit

Permalink
chore: add @codecov/webpack-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed Nov 23, 2024
1 parent 2ca00c8 commit 114a2f4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .fatherrc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
import { codecovWebpackPlugin } from '@codecov/webpack-plugin';
import { defineConfig } from 'father';

class CodecovWebpackPlugin {
private options;
constructor(options = {}) {
this.options = {
enableBundleAnalysis: true,
bundleName: 'webpack-bundle',
gitService: 'github',
disable: false,
...options,
};
}
apply(compiler: any) {
return codecovWebpackPlugin(this.options).apply(compiler);
}
}

export default defineConfig({
plugins: ['@rc-component/father-plugin'],
esm: {
Expand Down Expand Up @@ -31,5 +48,18 @@ export default defineConfig({
'@ant-design/cssinjs': 'antdCssinjs',
antd: 'antd',
},
chainWebpack: (memo) => {
if (process.env.NODE_ENV === 'production') {
memo.plugin('codecov').use(CodecovWebpackPlugin, [
{
enableBundleAnalysis: true,
bundleName: 'antdx',
uploadToken: process.env.CODECOV_TOKEN,
gitService: 'github',
},
]);
}
return memo;
},
},
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"devDependencies": {
"@ant-design/tools": "^18.0.2",
"@biomejs/biome": "^1.9.0",
"@codecov/webpack-plugin": "^1.4.0",
"@codesandbox/sandpack-react": "^2.19.8",
"@emotion/server": "^11.11.0",
"@happy-dom/jest-environment": "^15.7.4",
Expand Down

0 comments on commit 114a2f4

Please sign in to comment.