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

feat: Add concurrency to build and add terser minify #11123

Open
wants to merge 45 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3e635fe
feat: Add concurrency to build and add terser minify
memoyil Jan 8, 2025
95b3d0e
feat: Use esbuild minify
memoyil Jan 8, 2025
b98dea7
feat: add esbuild loader
memoyil Jan 8, 2025
2ae8ddb
feat: Improve eslint
memoyil Jan 8, 2025
ac76960
feat: Improve eslint report
memoyil Jan 8, 2025
0d64a92
feat: Revert report
memoyil Jan 8, 2025
855edbd
feat: Use cache workers
memoyil Jan 8, 2025
9854779
chore: Example change file
memoyil Jan 8, 2025
f43b9ee
chore: Use eslintd
memoyil Jan 8, 2025
2a819c4
chore: Use ts incremental
memoyil Jan 9, 2025
3e2bbad
chore: Remove ts incremental
memoyil Jan 9, 2025
fa49ba0
chore: Move ts incremental to base
memoyil Jan 9, 2025
ede7ad4
chore: Add ts build info
memoyil Jan 9, 2025
0fe6d11
revert: Changes
memoyil Jan 17, 2025
3e28ee2
perf: Enable worker threads
memoyil Jan 17, 2025
c211350
perf: Enable worker threads
memoyil Jan 17, 2025
704dddd
perf: Use biome
memoyil Jan 18, 2025
ed8a7d8
perf: Use biome
memoyil Jan 18, 2025
5df71f5
perf: Use thread-loader
memoyil Jan 19, 2025
54797fb
perf: Increase workers
memoyil Jan 19, 2025
bbe3f6a
perf: Move minify to all
memoyil Jan 19, 2025
8cf15ac
perf: Use terser minify
memoyil Jan 19, 2025
dabc84b
perf: Use server minification false
memoyil Jan 19, 2025
ebfb371
chore: Remove console
memoyil Jan 19, 2025
aec8e22
perf: Add lightning css
memoyil Jan 19, 2025
4bba820
perf: Add cpus
memoyil Jan 19, 2025
5a4ac52
chore: Remove workers
memoyil Jan 19, 2025
9ace41d
perf: Increase minify parallel
memoyil Jan 20, 2025
fec0dc2
perf: Enable build worker
memoyil Jan 20, 2025
5e262e9
perf: Enable turbo trace
memoyil Jan 20, 2025
636cbeb
perf: Remove query core transpilation
memoyil Jan 20, 2025
82d18c9
perf: Disable turbotrace
memoyil Jan 20, 2025
bfb5ccc
perf: Enable parallel
memoyil Jan 20, 2025
cfc701c
chore: Remove params
memoyil Jan 20, 2025
59afe5c
chore: Remove biome
memoyil Jan 20, 2025
0f1fc20
chore: Remove unused deps
memoyil Jan 20, 2025
fc1f893
chore: Remove unused deps
memoyil Jan 20, 2025
08725b1
perf: Take out test files
memoyil Jan 22, 2025
4065792
perf: Add test directory
memoyil Jan 22, 2025
8c901da
perf: Enable options
memoyil Jan 22, 2025
b1fd358
perf: Exclude
memoyil Jan 22, 2025
eb0c92b
perf: Exclude
memoyil Jan 22, 2025
85f0314
perf: Exclude
memoyil Jan 22, 2025
7f5895f
perf: Add / remove exclude
memoyil Jan 22, 2025
21fef9e
chore: update lock
memoyil Jan 26, 2025
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
3 changes: 2 additions & 1 deletion apps/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@ethersproject/providers": "^5.0.0"
},
"devDependencies": {
"cypress": "8.3.1"
"cypress": "8.3.1",
"start-server-and-test": "^1.14.0"
}
}
57 changes: 32 additions & 25 deletions apps/web/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { withSentryConfig } from '@sentry/nextjs'
import { createVanillaExtractPlugin } from '@vanilla-extract/next-plugin'
import vercelToolbarPlugin from '@vercel/toolbar/plugins/next'
import path from 'path'
import os from 'os'
import { fileURLToPath } from 'url'
import { RetryChunkLoadPlugin } from 'webpack-retry-chunk-load-plugin'

Expand All @@ -31,7 +32,7 @@ const sentryWebpackPluginOptions =
validate: true,
hideSourceMaps: false,
tryRun: true,
disable: true
disable: true,
// https://github.com/getsentry/sentry-webpack-plugin#options.
}
: {
Expand All @@ -53,8 +54,14 @@ const config = {
styledComponents: true,
},
experimental: {
workerThreads: true,
parallelServerCompiles: true,
parallelServerBuildTraces: true,
webpackBuildWorker: true,
cpus: ((os.cpus() || { length: 2 }).length) - 1,
scrollRestoration: true,
fallbackNodePolyfills: false,
useLightningcss: true,
outputFileTracingRoot: path.join(__dirname, '../../'),
outputFileTracingExcludes: {
'*': [],
Expand All @@ -69,12 +76,10 @@ const config = {
'@pancakeswap/utils',
'@pancakeswap/widgets-internal',
'@pancakeswap/ifos',
'@pancakeswap/uikit',
// https://github.com/TanStack/query/issues/6560#issuecomment-1975771676
'@tanstack/query-core',
'@pancakeswap/uikit'
],
reactStrictMode: true,
swcMinify: false,
swcMinify: true,
images: {
contentDispositionType: 'attachment',
remotePatterns: [
Expand Down Expand Up @@ -224,30 +229,32 @@ const config = {
__SENTRY_TRACING__: false,
}),
)
webpackConfig.plugins.push(
new RetryChunkLoadPlugin({
cacheBust: `function() {
if (!isServer) {
webpackConfig.plugins.push(
new RetryChunkLoadPlugin({
cacheBust: `function() {
return 'cache-bust=' + Date.now();
}`,
retryDelay: `function(retryAttempt) {
retryDelay: `function(retryAttempt) {
return 2 ** (retryAttempt - 1) * 500;
}`,
maxRetries: 5,
}),
)
if (!isServer && webpackConfig.optimization.splitChunks) {
// webpack doesn't understand worker deps on quote worker, so we need to manually add them
// https://github.com/webpack/webpack/issues/16895
// eslint-disable-next-line no-param-reassign
webpackConfig.optimization.splitChunks.cacheGroups.workerChunks = {
chunks: 'all',
test(module) {
const resource = module.nameForCondition?.() ?? ''
return resource ? workerDeps.some((d) => resource.includes(d)) : false
},
priority: 31,
name: 'worker-chunks',
reuseExistingChunk: true,
maxRetries: 5,
}),
)
if (webpackConfig.optimization.splitChunks) {
// webpack doesn't understand worker deps on quote worker, so we need to manually add them
// https://github.com/webpack/webpack/issues/16895
// eslint-disable-next-line no-param-reassign
webpackConfig.optimization.splitChunks.cacheGroups.workerChunks = {
chunks: 'all',
test(module) {
const resource = module.nameForCondition?.() ?? ''
return resource ? workerDeps.some((d) => resource.includes(d)) : false
},
priority: 31,
name: 'worker-chunks',
reuseExistingChunk: true,
}
}
}
return webpackConfig
Expand Down
9 changes: 0 additions & 9 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"@datadog/browser-logs": "^5.8.0",
"@datadog/browser-rum": "^5.8.0",
"@gelatonetwork/limit-orders-lib": "^4.1.0",
"@gnosis.pm/safe-apps-wagmi": "^1.2.0",
"@kyberswap/pancake-liquidity-widgets": "1.0.6",
"@next/bundle-analyzer": "13.0.7",
"@orbs-network/twap-ui": "0.11.27",
Expand Down Expand Up @@ -90,12 +89,10 @@
"@web3inbox/react": "1.2.0",
"@yornaath/batshit": "^0.9.0",
"abortcontroller-polyfill": "1.7.5",
"ajv": "^6.12.3",
"bignumber.js": "^9.0.0",
"bottleneck": "^2.19.5",
"canvas-confetti": "^1.5.1",
"chart.js": "^4.4.0",
"clsx": "^1.2.1",
"cookies-next": "^2.1.1",
"core-js": "^3.37.0",
"crypto-js": "^4.2.0",
Expand Down Expand Up @@ -139,7 +136,6 @@
"styled-components": "6.0.7",
"styled-system": "^5.1.5",
"swiper": "^11.1.12",
"tiny-invariant": "^1.3.0",
"uuid": "^8.0.0",
"viem": "catalog:",
"wagmi": "catalog:",
Expand All @@ -165,7 +161,6 @@
"@types/react-redux": "^7.1.24",
"@types/react-transition-group": "^4.4.1",
"@types/react-window": "^1.8.8",
"@types/simplemde": "^1.11.7",
"@types/styled-system": "^5.1.17",
"@types/uuid": "^8.0.0",
"@vanilla-extract/vite-plugin": "^4.0.2",
Expand All @@ -182,15 +177,11 @@
"postcss-scss": "^4.0.3",
"postcss-syntax": "^0.36.2",
"prettier": "^2.8.3",
"serve": "^12.0.0",
"source-map-explorer": "^2.5.2",
"start-server-and-test": "^1.14.0",
"stylelint": "^14.5.3",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-recommended": "^7.0.0",
"stylelint-config-standard": "^25.0.0",
"stylelint-config-styled-components": "^0.1.1",
"tilg": "^0.1.1",
"typescript": "5.2.2",
"vite-tsconfig-paths": "^4.0.3",
"webpack-retry-chunk-load-plugin": "3.1.1"
Expand Down
10 changes: 9 additions & 1 deletion apps/web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
"@pancakeswap/uikit/*": ["../../packages/uikit/src/*"]
}
},
"exclude": ["**/node_modules", "**/.*/", "**/config/abi/types/", "**/abis/types/*.ts"],
"exclude": [
"**/node_modules",
"**/.*/",
"**/config/abi/types/",
"**/abis/types/*.ts",
"**/*.test.ts",
"./src/__tests__",
"./dist/**"
],
"include": ["next-env.d.ts", "./src/**/*.ts", "./src/**/*.tsx"]
}
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
"dev:gamification": "pnpm turbo run dev --filter=gamification... --concurrency=50",
"storybook": "turbo run start --filter=@pancakeswap/uikit...",
"build:storybook": "turbo run build:storybook --filter=@pancakeswap/uikit...",
"build": "turbo run build --filter=web...",
"build:blog": "turbo run build --filter=blog...",
"build:aptos": "turbo run build --filter=aptos-web...",
"build:bridge": "turbo run build --filter=bridge...",
"build:games": "turbo run build --filter=games...",
"build:packages": "turbo run build --filter=./packages/* --filter=./packages/routing-sdk/addons/*",
"build:gamification": "turbo run build --filter=gamification...",
"build": "turbo run build --filter=web... --concurrency=50",
"build:blog": "turbo run build --filter=blog... --concurrency=50",
"build:aptos": "turbo run build --filter=aptos-web... --concurrency=50",
"build:bridge": "turbo run build --filter=bridge... --concurrency=50",
"build:games": "turbo run build --filter=games... --concurrency=50",
"build:packages": "turbo run build --filter=./packages/* --filter=./packages/routing-sdk/addons/* --concurrency=50",
"build:gamification": "turbo run build --filter=gamification... --concurrency=50",
"start": "turbo run start --filter=web",
"test:config": "pnpm turbo run test:config --filter=web...[HEAD^1]",
"test:ci": "pnpm turbo run test --filter=[HEAD^1]",
Expand All @@ -39,7 +39,7 @@
"updateLPsAPR": "pnpm turbo run build --filter=@pancakeswap/farms && NODE_PATH=./apps/web/src tsx --tsconfig ./apps/web/tsconfig.json scripts/updateLPsAPR.ts",
"updateAptosLPsAPR": "pnpm turbo run build --filter=@pancakeswap/aptos-swap-sdk && NODE_PATH=./apps/aptos/src tsx --tsconfig ./apps/aptos/tsconfig.json scripts/updateAptosLpsAPR/index.ts",
"updateMerkl": "NODE_PATH=./apps/web/src tsx --tsconfig ./apps/web/tsconfig.json scripts/updateMerkl/index.ts",
"clean": "turbo run clean && rm -rf node_modules",
"clean": "turbo run clean && rm -rf node_modules --concurrency=50",
"changeset": "changeset",
"version-packages": "changeset version && pnpm i --lockfile-only",
"release-packages": "turbo run build --filter=./packages/* && changeset version && changeset publish",
Expand Down
2 changes: 1 addition & 1 deletion packages/achievements/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["./src"],
"exclude": ["**/*.test.ts"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"target": "es2020",
"esModuleInterop": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/blog/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["./src"],
"exclude": ["**/*.test.ts"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"target": "es2020",
"esModuleInterop": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/canonical-bridge/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
"target": "es2020"
},
"include": ["src"],
"exclude": ["node_modules", "src/**/*.stories.tsx"]
"exclude": ["node_modules", "src/**/*.stories.tsx", "./dist/**", "**/*.test.ts"]
}
2 changes: 1 addition & 1 deletion packages/chains/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["src"],
"exclude": ["./dist/**"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"target": "es2020",
"module": "esnext",
Expand Down
2 changes: 1 addition & 1 deletion packages/games/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["./src"],
"exclude": ["**/*.test.ts"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"target": "es2020",
"esModuleInterop": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/gauges/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["src"],
"exclude": ["./dist/**"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"target": "es2020",
"module": "esnext",
Expand Down
2 changes: 1 addition & 1 deletion packages/ifos/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["./src"],
"exclude": ["**/*.test.ts"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"module": "esnext",
"target": "es2020",
Expand Down
2 changes: 1 addition & 1 deletion packages/multicall/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["./src"],
"exclude": ["**/*.test.ts", "./dist/**"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["./**/*.ts"],
"exclude": ["**/*.test.ts", "dist"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"target": "es2020",
"outDir": "./dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/pcsx-sdk/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["src"],
"exclude": ["**/*.test.ts", "./dist/**"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/permit2-sdk/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "@pancakeswap/tsconfig/base",
"exclude": ["**/*.test.ts", "./dist/**"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"include": ["src"],
"compilerOptions": {
"outDir": "./dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/pools/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["./src"],
"exclude": ["**/*.test.ts", "./dist/**"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/position-managers/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["./src"],
"exclude": ["**/*.test.ts"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"target": "es2020",
"esModuleInterop": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/prediction/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["./src"],
"exclude": ["**/*.test.ts"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"module": "esnext",
"target": "es2020",
Expand Down
2 changes: 1 addition & 1 deletion packages/price-api-sdk/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["./src"],
"exclude": ["**/*.test.ts", "./dist/**"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/routing-sdk/addons/quoter/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["./src"],
"exclude": ["**/*.test.ts", "./dist/**"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/routing-sdk/addons/stable-swap/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["./src"],
"exclude": ["**/*.test.ts", "./dist/**"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/routing-sdk/addons/v2/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["./src"],
"exclude": ["**/*.test.ts", "./dist/**"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/routing-sdk/addons/v3/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["./src"],
"exclude": ["**/*.test.ts", "./dist/**"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/routing-sdk/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["./src"],
"exclude": ["**/*.test.ts", "./dist/**"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/smart-router/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@pancakeswap/tsconfig/base",
"include": ["./evm", "legacy-router"],
"exclude": ["**/*.test.ts", "./dist/**"],
"exclude": ["**/node_modules", "**/*.test.ts", "./dist/**"],
"compilerOptions": {
"rootDir": "./",
"outDir": "./dist",
Expand Down
Loading
Loading