Skip to content

Commit

Permalink
feat: Remove --performance option from yarn rw build (#10453)
Browse files Browse the repository at this point in the history
**Problem**
This PR removes the `--performance` flag from the `yarn rw build`
command. This also removes the associated logic, webpack config, and its
associated dependency.

Specifically `babel-timing`. The [GitHub
repo](https://github.com/toomuchdesign/babel-timing) has not been
committed to in 3 years. The constraints it adds to resolving other
dependencies are potentially holding back security-related dependency
upgrades.

**Changes**
1. Removed the `--performance` flag and the logic performed when the
flag was passed
3. Removed the webpack config used for the `--performance` behaviour
4. Removed the `babel-timing` dependency

**Notes**
It is important to take into account the usage of this command when we
consider removing it. From looking at our anonymised telemetry this flag
has been used less than a dozen times in the last 6 months. Where it has
been used it was used in projects that are using vite - the results of
this flag are related to webpack builds not vite so this would be
misleading/useless in this case anyway.
  • Loading branch information
Josh-Walker-GM authored Apr 19, 2024
1 parent b3d324c commit bfadc2a
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 2,222 deletions.
5 changes: 5 additions & 0 deletions .changesets/10453.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- feat: Remove `--performance` option from `yarn rw build` (#10453) by @Josh-Walker-GM

This change removes the `--performance` flag from the `yarn rw build` command. It will no longer be available to use and the CLI will no longer accept this flag being passed in.

Additionally, the associated webpack config (`@redwoodjs/core/config/webpack.perf.js`) has been removed so it can no longer be imported if you were doing so.
6 changes: 0 additions & 6 deletions packages/cli/src/commands/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ export const builder = (yargs) => {
default: true,
description: 'Generate the Prisma client',
})
.option('performance', {
alias: 'perf',
type: 'boolean',
default: false,
description: 'Measure build performance',
})
.middleware(() => {
const check = checkNodeVersion()

Expand Down
14 changes: 0 additions & 14 deletions packages/cli/src/commands/buildHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { generatePrismaCommand } from '../lib/generatePrismaClient'
export const handler = async ({
side = ['api', 'web'],
verbose = false,
performance = false,
stats = false,
prisma = true,
prerender,
Expand All @@ -28,7 +27,6 @@ export const handler = async ({
command: 'build',
side: JSON.stringify(side),
verbose,
performance,
stats,
prisma,
prerender,
Expand All @@ -39,18 +37,6 @@ export const handler = async ({
const useFragments = rwjsConfig.graphql?.fragments
const useTrustedDocuments = rwjsConfig.graphql?.trustedDocuments

if (performance) {
console.log('Measuring Web Build Performance...')
execa.sync(
`yarn cross-env NODE_ENV=production webpack --config ${require.resolve(
'@redwoodjs/core/config/webpack.perf.js',
)}`,
{ stdio: 'inherit', shell: true, cwd: rwjsPaths.web.base },
)
// We do not want to continue building...
return
}

if (stats) {
console.log('Building Web Stats...')
execa.sync(
Expand Down
30 changes: 0 additions & 30 deletions packages/core/config/webpack.perf.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"@redwoodjs/testing": "workspace:*",
"@redwoodjs/web-server": "workspace:*",
"babel-loader": "^9.1.3",
"babel-timing": "0.9.1",
"copy-webpack-plugin": "11.0.0",
"core-js": "3.36.1",
"css-loader": "6.10.0",
Expand Down
Loading

0 comments on commit bfadc2a

Please sign in to comment.