Skip to content

Commit

Permalink
relative-ci config
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeKarow committed Apr 24, 2024
1 parent eac1f8e commit c7e3624
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/app/.eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.spec.ts
webpack-stats.json
2 changes: 2 additions & 0 deletions apps/app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ yarn-error.log*

# Sentry Auth Token
.sentryclirc

webpack-stats.json
1 change: 1 addition & 0 deletions apps/app/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ pnpm-lock.yaml
.DS_Store
.eslintignore
.trace/*.json
webpack-stats.json
22 changes: 22 additions & 0 deletions apps/app/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/* eslint-disable node/no-process-env */

import filterWebpackStats from '@bundle-stats/plugin-webpack-filter'
import bundleAnalyze from '@next/bundle-analyzer'
import { PrismaPlugin } from '@prisma/nextjs-monorepo-workaround-plugin'
import { RelativeCiAgentWebpackPlugin } from '@relative-ci/agent'
import { withSentryConfig } from '@sentry/nextjs'
import { I18NextHMRPlugin } from 'i18next-hmr/webpack'
import routes from 'nextjs-routes/config'
import { StatsWriterPlugin } from 'webpack-stats-plugin'

import path from 'path'
import { fileURLToPath } from 'url'
Expand Down Expand Up @@ -68,6 +70,26 @@ const nextConfig = {
}
if (!dev && !isServer) {
config.plugins.push(new RelativeCiAgentWebpackPlugin())
config.plugins.push(
new StatsWriterPlugin({
filename: '../webpack-stats.json',
stats: {
assets: true,
chunks: true,
modules: true,
},
transform: (webpackStats) => {
if (filterWebpackStats instanceof Function) {
const filteredSource = filterWebpackStats(webpackStats)
return JSON.stringify(filteredSource)
} else if (filterWebpackStats.default instanceof Function) {
const filteredSource = filterWebpackStats.default(webpackStats)
return JSON.stringify(filteredSource)
}
return JSON.stringify(webpackStats)
},
})
)
}
if (dev && !isServer) {
/** WDYR */
Expand Down
4 changes: 3 additions & 1 deletion apps/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"zod": "3.23.3"
},
"devDependencies": {
"@bundle-stats/plugin-webpack-filter": "4.12.2",
"@hookform/devtools": "4.3.1",
"@playwright/test": "1.43.1",
"@prisma/nextjs-monorepo-workaround-plugin": "5.13.0",
Expand Down Expand Up @@ -136,7 +137,8 @@
"trpc-playground": "1.0.4",
"type-fest": "4.16.0",
"typescript": "5.4.5",
"webpack-bundle-analyzer": "4.10.2"
"webpack-bundle-analyzer": "4.10.2",
"webpack-stats-plugin": "1.1.3"
},
"ct3aMetadata": {
"initVersion": "5.10.1"
Expand Down
11 changes: 11 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c7e3624

Please sign in to comment.