Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure bundle analyzer #2836

Merged
merged 12 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/lerna.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
- name: 'Version and publish' # Interesting step
env:
GH_TOKEN: ${{ secrets.LERNA_FGPAT }}
CODECOV_TOKEN: ${{ secrets.CODECOV }}
# branch is protected so this must be an admin token, this will expire on 03/01/2024
# replacement should be done by a service account with a fine-grained personal access token
run: |
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ jobs:

- name: Run tests # Run tests of all packages
run: npx lerna exec npm run ci:lint --parallel

- name: Run build # Run tests of all packages
run: npx lerna exec npm run build --parallel
env:
CODECOV_TOKEN: ${{ secrets.CODECOV }}
test:
runs-on: ubuntu-latest
env:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/ui-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,17 @@ jobs:
export DEPLOY_URL=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})
echo "DEPLOY_URL=$DEPLOY_URL" >> $GITHUB_ENV
echo "::set-output name=url::$DEPLOY_URL"
env:
CODECOV_TOKEN: ${{ secrets.CODECOV }}
- name: Deploy to Vercel (Output Prod)
if: ${{ format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }}
run: |
vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
vercel build --token=${{ secrets.VERCEL_TOKEN }} --prod
vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} --prod

env:
CODECOV_TOKEN: ${{ secrets.CODECOV }}

- name: Update PR Description
if: ${{ github.event_name == 'pull_request' && format('refs/heads/{0}', github.event.repository.default_branch) != github.ref }}
uses: actions/github-script@v3
Expand Down
15 changes: 15 additions & 0 deletions docs/bridge/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import * as path from "path";
import {codecovWebpackPlugin} from "@codecov/webpack-plugin";

const config: Config = {
title: 'Synapse Bridge Docs',
Expand Down Expand Up @@ -152,6 +153,20 @@ const config: Config = {
};
},
}),
() => ({
name: 'bundle-analyzer',
configureWebpack() {
return {
plugins: [
codecovWebpackPlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: "docs-bridge",
trajan0x marked this conversation as resolved.
Show resolved Hide resolved
uploadToken: process.env.CODECOV_TOKEN,
}),
]
};
}
}),
],
};

Expand Down
1 change: 1 addition & 0 deletions docs/bridge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"typecheck": "tsc"
},
"dependencies": {
"@codecov/webpack-plugin": "^0.0.1-beta.10",
"@docusaurus/core": "3.1.1",
"@docusaurus/logger": "3.1.1",
"@docusaurus/plugin-content-docs": "3.1.1",
Expand Down
1 change: 1 addition & 0 deletions packages/contracts-rfq/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"solhint": "^3.3.6"
},
"scripts": {
"build": " ",
"build:contracts": "forge build",
"build:slither": "forge build --out=out --build-info --force",
"test:coverage": "echo 'Please use foundry'",
Expand Down
9 changes: 9 additions & 0 deletions packages/explorer-ui/next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { codecovWebpackPlugin } = require('@codecov/webpack-plugin')

/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
Expand All @@ -18,6 +20,13 @@ const nextConfig = {
test: /\.tsx?$/,
use: 'ts-loader',
})
config.plugins.push(
codecovWebpackPlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: 'explorer-ui',
uploadToken: process.env.CODECOV_TOKEN,
})
)
return config
},
eslint: {
Expand Down
2 changes: 2 additions & 0 deletions packages/explorer-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
},
"dependencies": {
"@apollo/client": "^3.6.2",
"@codecov/webpack-plugin": "^0.0.1-beta.10",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@ethersproject/address": "^5.6.1",
Expand Down Expand Up @@ -71,6 +72,7 @@
},
"devDependencies": {
"@babel/core": "^7.20.7",
"@codecov/webpack-plugin": "^0.0.1-beta.10",
"@storybook/addon-actions": "^6.5.15",
"@storybook/addon-essentials": "^6.5.15",
"@storybook/addon-interactions": "^6.5.15",
Expand Down
2 changes: 1 addition & 1 deletion packages/rest-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"ci:lint": "npm run lint:check",
"build:go": " ",
"build:slither": " ",
"build": "echo 'please run build api'",
"build": "npm run build api && echo 'please run build api'",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the build script command.

The build script command appears to be a placeholder and should be updated with the actual build command.

-  "build": "npm run build api && echo 'please run build api'",
+  "build": "npm run build:api && <actual-build-command>"

Committable suggestion was skipped due to low confidence.

"build:api": "yarn add @synapsecns/sdk-router && tsc",
"postinstall": "npm run build"
},
Expand Down
1 change: 1 addition & 0 deletions packages/sdk-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
},
"module": "dist/sdk-v2.esm.js",
"devDependencies": {
"@codecov/rollup-plugin": "^0.0.1-beta.10",
"@ethersproject/providers": "^5.7.0",
"@types/big.js": "^4.0.5",
"@types/jest": "^24.0.25",
Expand Down
14 changes: 14 additions & 0 deletions packages/sdk-router/tsdx.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { codecovRollupPlugin } from '@codecov/rollup-plugin'

module.exports = {
rollup(config, options) {
config.plugins.push(
codecovRollupPlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: 'sdk-router',
uploadToken: process.env.CODECOV_TOKEN,
})
)
return config
},
}
1 change: 1 addition & 0 deletions packages/solidity-devops/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"remappings.txt"
],
"scripts": {
"build": " ",
"build:go": " ",
"build:slither": " ",
"ci:lint": "npm run lint:check",
Expand Down
1 change: 1 addition & 0 deletions packages/synapse-constants/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@codecov/webpack-plugin": "^0.0.1-beta.10",
"copyfiles": "^2.4.1",
"ethers": "5.7.2",
"lodash": "^4.17.21"
Expand Down
9 changes: 9 additions & 0 deletions packages/synapse-constants/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const path = require('path')

const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin')
const { codecovWebpackPlugin } = require('@codecov/webpack-plugin')

module.exports = {
mode: 'production',
Expand All @@ -11,6 +12,14 @@ module.exports = {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
plugins: [
// Put the Codecov Webpack plugin after all other plugins
codecovWebpackPlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: 'synapse-constants',
uploadToken: process.env.CODECOV_TOKEN,
}),
],

resolve: {
extensions: ['.ts', '.tsx', '.js'],
Expand Down
8 changes: 8 additions & 0 deletions packages/synapse-interface/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require('path')
const { codecovWebpackPlugin } = require('@codecov/webpack-plugin')

/** @type {import('next').NextConfig} */
const nextConfig = {
Expand All @@ -22,6 +23,13 @@ const nextConfig = {
'.json',
'.nvmrc',
]
config.plugins.push(
codecovWebpackPlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧠 logic: Potential issue: Ensure CODECOV_TOKEN is securely managed and not exposed.

bundleName: 'explorer-ui',
uploadToken: process.env.CODECOV_TOKEN,
})
)
return config
},
eslint: {
Expand Down
1 change: 1 addition & 0 deletions packages/synapse-interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
},
"dependencies": {
"@cloudflare/next-on-pages": "^1.11.0",
"@codecov/webpack-plugin": "^0.0.1-beta.10",
"@ethersproject/bignumber": "5.7.0",
"@ethersproject/providers": "5.7.2",
"@ethersproject/units": "5.7.0",
Expand Down
1 change: 1 addition & 0 deletions packages/widget/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"typescript": "^5.3.2"
},
"dependencies": {
"@codecov/rollup-plugin": "^0.0.1-beta.10",
"@ethersproject/providers": "^5.7.2",
"@ethersproject/units": "^5.7.0",
"@reduxjs/toolkit": "^2.0.1",
Expand Down
6 changes: 6 additions & 0 deletions packages/widget/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import json from '@rollup/plugin-json'
import terser from '@rollup/plugin-terser'
import peerDepsExternal from 'rollup-plugin-peer-deps-external'
import sourcemaps from 'rollup-plugin-sourcemaps'
import { codecovRollupPlugin } from "@codecov/rollup-plugin";

import packageJson from './package.json' assert { type: 'json' }

Expand Down Expand Up @@ -51,6 +52,11 @@ export default [
json(),
terser(),
sourcemaps(),
codecovRollupPlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: "widget",
uploadToken: process.env.CODECOV_TOKEN,
}),
],
watch: {
buildDelay: 200,
Expand Down
Loading
Loading