Skip to content

Commit

Permalink
fix(babel): use caret to specify some package versions (#9174)
Browse files Browse the repository at this point in the history
the previous babel fix (#9144)
to issues like #9156 and
#9073 was only a temporary
solution and didn't work for all users. after more thinking, i'm pretty
sure that the root of the problem is that we pin the version of the
babel packages we depend on.

take a redwood app that was just created from `yarn create redwood-app`.
most redwood projects request a specific version of a babel package. for
example, for `@babel/core`, redwood packages say they want `7.22.17`.
the redwood packages aren't the only ones that want `@babel/core`, but
they use a caret when they ask for the version, like `^7.22.5`

at the outset, yarn can usually make everyone happy with one version.
but say a new version of `@babel/core` comes out, `7.22.19`. and then a
user installs storybook, or some other package that depends on
`@babel/core`. the problem is that yarn checks npm to see if there's a
new version, and if there is, it updates the caret versions like
`^7.22.5` to resolve to the new one. but all the redwood packages are
insisting they want `7.22.17`, not `7.22.19`, so yarn has to keep both
around and now, when it comes to hoisting, has a choice to make: which
version of `@babel/core` is at `node_modules/@babel/core`? more packages
are ok with `7.22.19` so it wins out, and `7.22.17` gets buried into the
redwood package's node_modules.

to figure out which babel packages need the caret, i relied on a
combination of `yarn info -R --dependents ${packageName}`, `yarn why
${packageName}`, and `find ./node_modules -type d -path
'*/${packageName}'`.

the next steps for this are to get it into canary so i can confirm.
  • Loading branch information
jtoar authored Sep 15, 2023
1 parent 66a0e4a commit dc86db5
Show file tree
Hide file tree
Showing 49 changed files with 198 additions and 203 deletions.
5 changes: 0 additions & 5 deletions constraints.pro
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ gen_enforced_dependency(WorkspaceCwd, DependencyIdent, DependencyRange2, Depende
workspace_has_dependency(OtherWorkspaceCwd, DependencyIdent, DependencyRange2, DependencyType2),
DependencyRange \= DependencyRange2.

% Prevents a dependency from having a caret in its version
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, TargetDependencyRange, DependencyType) :-
workspace_has_dependency(WorkspaceCwd, DependencyIdent, CurrentDependencyRange, DependencyType),
atom_concat('^', TargetDependencyRange, CurrentDependencyRange).

% Enforce that all workspaces building with Babel depend on '@babel/runtime-corejs3' and 'core-js'.
gen_enforced_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, 'dependencies') :-
member(DependencyIdent, [
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@
"@actions/exec": "1.1.1",
"@actions/glob": "0.4.0",
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@babel/generator": "7.22.15",
"@babel/node": "7.22.15",
"@babel/plugin-proposal-decorators": "7.22.15",
"@babel/plugin-transform-class-properties": "7.22.5",
"@babel/plugin-transform-class-properties": "^7.22.5",
"@babel/plugin-transform-nullish-coalescing-operator": "7.22.11",
"@babel/plugin-transform-private-methods": "7.22.5",
"@babel/plugin-transform-private-property-in-object": "7.22.11",
"@babel/plugin-transform-react-jsx": "7.22.15",
"@babel/plugin-transform-private-methods": "^7.22.5",
"@babel/plugin-transform-private-property-in-object": "^7.22.11",
"@babel/plugin-transform-react-jsx": "^7.22.15",
"@babel/plugin-transform-runtime": "7.22.15",
"@babel/preset-env": "7.22.15",
"@babel/preset-react": "7.22.15",
"@babel/preset-typescript": "7.22.15",
"@babel/preset-env": "^7.22.15",
"@babel/preset-react": "^7.22.15",
"@babel/preset-typescript": "^7.22.15",
"@babel/runtime-corejs3": "7.22.15",
"@faker-js/faker": "8.0.2",
"@npmcli/arborist": "6.2.10",
Expand All @@ -73,7 +73,7 @@
"@types/ncp": "2.0.5",
"@types/prompts": "2.4.4",
"all-contributors-cli": "6.26.1",
"babel-jest": "29.7.0",
"babel-jest": "^29.7.0",
"babel-plugin-auto-import": "1.1.0",
"babel-plugin-remove-code": "0.0.6",
"boxen": "5.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@types/aws-lambda": "8.10.119",
"@types/lodash": "4.14.195",
"@types/qs": "6.9.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@types/aws-lambda": "8.10.119",
"@types/jsonwebtoken": "9.0.2",
"@types/memjs": "1",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/auth0/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@redwoodjs/api": "6.0.7",
"@types/jsonwebtoken": "9.0.2",
"jest": "29.7.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/auth0/setup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@types/yargs": "17.0.24",
"jest": "29.7.0",
"typescript": "5.2.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/auth0/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"devDependencies": {
"@auth0/auth0-spa-js": "2.1.1",
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@types/react": "18.2.14",
"jest": "29.7.0",
"react": "0.0.0-experimental-e5205658f-20230913",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@redwoodjs/api": "6.0.7",
"@types/aws-lambda": "8.10.119",
"@types/jsonwebtoken": "9.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@types/yargs": "17.0.24",
"jest": "29.7.0",
"typescript": "5.2.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"devDependencies": {
"@azure/msal-browser": "2.38.1",
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@types/netlify-identity-widget": "1.9.3",
"@types/react": "18.2.14",
"jest": "29.7.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/clerk/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@redwoodjs/api": "6.0.7",
"@types/aws-lambda": "8.10.119",
"jest": "29.7.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/clerk/setup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@types/yargs": "17.0.24",
"jest": "29.7.0",
"typescript": "5.2.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/clerk/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@clerk/clerk-react": "4.22.0",
"@clerk/types": "3.46.1",
"@types/react": "18.2.14",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/custom/setup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@types/yargs": "17.0.24",
"jest": "29.7.0",
"typescript": "5.2.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/dbAuth/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@redwoodjs/api": "6.0.7",
"@simplewebauthn/server": "7.3.1",
"@types/crypto-js": "4.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/dbAuth/setup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@simplewebauthn/typescript-types": "7.0.0",
"@types/secure-random-password": "0.2.1",
"@types/yargs": "17.0.24",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/dbAuth/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@simplewebauthn/typescript-types": "7.0.0",
"@types/react": "18.2.14",
"jest": "29.7.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/firebase/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@redwoodjs/api": "6.0.7",
"@types/aws-lambda": "8.10.119",
"jest": "29.7.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/firebase/setup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@types/yargs": "17.0.24",
"jest": "29.7.0",
"typescript": "5.2.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/firebase/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@types/react": "18.2.14",
"firebase": "10.3.0",
"jest": "29.7.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/netlify/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@redwoodjs/api": "6.0.7",
"@types/aws-lambda": "8.10.119",
"@types/jsonwebtoken": "9.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/netlify/setup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@types/yargs": "17.0.24",
"jest": "29.7.0",
"typescript": "5.2.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/netlify/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@types/netlify-identity-widget": "1.9.3",
"@types/react": "18.2.14",
"jest": "29.7.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/supabase/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@redwoodjs/api": "6.0.7",
"@types/aws-lambda": "8.10.119",
"@types/jsonwebtoken": "9.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/supabase/setup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@types/yargs": "17.0.24",
"jest": "29.7.0",
"typescript": "5.2.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/supabase/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@supabase/supabase-js": "2.26.0",
"@types/react": "18.2.14",
"jest": "29.7.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/supertokens/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@redwoodjs/api": "6.0.7",
"@types/jsonwebtoken": "9.0.2",
"jest": "29.7.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/supertokens/setup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@types/yargs": "17.0.24",
"jest": "29.7.0",
"typescript": "5.2.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/supertokens/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@types/react": "18.2.14",
"jest": "29.7.0",
"react": "0.0.0-experimental-e5205658f-20230913",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "14.0.0",
"jest": "29.7.0",
Expand Down
22 changes: 11 additions & 11 deletions packages/babel-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@
"test:watch": "run test --watch"
},
"dependencies": {
"@babel/core": "7.22.17",
"@babel/parser": "7.22.16",
"@babel/plugin-transform-class-properties": "7.22.5",
"@babel/plugin-transform-private-methods": "7.22.5",
"@babel/plugin-transform-private-property-in-object": "7.22.11",
"@babel/plugin-transform-react-jsx": "7.22.15",
"@babel/core": "^7.22.17",
"@babel/parser": "^7.22.16",
"@babel/plugin-transform-class-properties": "^7.22.5",
"@babel/plugin-transform-private-methods": "^7.22.5",
"@babel/plugin-transform-private-property-in-object": "^7.22.11",
"@babel/plugin-transform-react-jsx": "^7.22.15",
"@babel/plugin-transform-runtime": "7.22.15",
"@babel/preset-env": "7.22.15",
"@babel/preset-react": "7.22.15",
"@babel/preset-typescript": "7.22.15",
"@babel/register": "7.22.15",
"@babel/preset-env": "^7.22.15",
"@babel/preset-react": "^7.22.15",
"@babel/preset-typescript": "^7.22.15",
"@babel/register": "^7.22.15",
"@babel/runtime-corejs3": "7.22.15",
"@babel/traverse": "7.22.17",
"@babel/traverse": "^7.22.17",
"@redwoodjs/project-config": "6.0.7",
"babel-plugin-auto-import": "1.1.0",
"babel-plugin-graphql-tag": "3.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"test:watch": "yarn test --watch"
},
"dependencies": {
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@babel/runtime-corejs3": "7.22.15",
"@opentelemetry/api": "1.4.1",
"@redwoodjs/project-config": "6.0.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
},
"devDependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@types/crypto-js": "4.1.1",
"jest": "29.7.0",
"typescript": "5.2.2"
Expand Down
8 changes: 4 additions & 4 deletions packages/codemods/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
},
"dependencies": {
"@babel/cli": "7.22.15",
"@babel/core": "7.22.17",
"@babel/parser": "7.22.16",
"@babel/plugin-transform-typescript": "7.22.15",
"@babel/core": "^7.22.17",
"@babel/parser": "^7.22.16",
"@babel/plugin-transform-typescript": "^7.22.15",
"@babel/runtime-corejs3": "7.22.15",
"@babel/traverse": "7.22.17",
"@babel/traverse": "^7.22.17",
"@iarna/toml": "2.2.5",
"@redwoodjs/project-config": "6.0.7",
"@svgr/core": "8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@redwoodjs/project-config": "6.0.7",
"@redwoodjs/testing": "6.0.7",
"@redwoodjs/web-server": "6.0.7",
"babel-loader": "9.1.3",
"babel-loader": "^9.1.3",
"babel-timing": "0.9.1",
"copy-webpack-plugin": "11.0.0",
"core-js": "3.32.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/create-redwood-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"yargs": "17.7.2"
},
"devDependencies": {
"@babel/core": "7.22.17",
"@babel/plugin-transform-typescript": "7.22.15",
"@babel/core": "^7.22.17",
"@babel/plugin-transform-typescript": "^7.22.15",
"@types/babel__core": "7.20.1",
"esbuild": "0.19.2",
"jest": "29.7.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"build": "echo 'Nothing to build..'"
},
"dependencies": {
"@babel/core": "7.22.17",
"@babel/core": "^7.22.17",
"@babel/eslint-parser": "7.22.15",
"@babel/eslint-plugin": "7.22.10",
"@redwoodjs/eslint-plugin": "6.0.7",
Expand Down
Loading

0 comments on commit dc86db5

Please sign in to comment.