-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Enable yarn 3 for Redwood projects #4444
Merged
Merged
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
d14490d
get redwood working
redwoodjsbot 8b54fe7
get storybook working
redwoodjsbot 7b11c48
get lint working
redwoodjsbot a5b89f2
get build working
redwoodjsbot 714e294
Update packages/cli/src/lib/generatePrismaClient.js
jtoar 1c6045a
get dev working
redwoodjsbot 7fa682d
get test working
redwoodjsbot d700136
get type-check working
redwoodjsbot 1d93acb
get upgrade working
redwoodjsbot 03a4beb
get setup ui tailwindcss working
redwoodjsbot 5ee4f29
get rwfw working
redwoodjsbot 9bae87e
get crwa working
redwoodjsbot 8bf0a2b
[wip] get contributing flow and ci working
redwoodjsbot f7a7738
use project:deps:yarn3 script to link
redwoodjsbot c5f4439
rm non-interactive flag
redwoodjsbot 66e18d6
revert engines req
redwoodjsbot ac50664
add script preamble
redwoodjsbot 5def5a0
handle project:deps:yarn3 script on v1
redwoodjsbot 411a384
handle upgrade on v1
redwoodjsbot f5ea110
handle type-check on v1
redwoodjsbot 076a112
get build --stats, --perf working
redwoodjsbot 5da7111
Merge branch 'main' into ds-upgrade-projects-to-yarn-3
thedavidprice 5d8d1a9
update yarn.lock
thedavidprice 45105f2
revert test project to yarn 1
redwoodjsbot 31358db
test-project: use same yarn release
redwoodjsbot 12d72f9
revert to using deps to link test project
redwoodjsbot ac62acd
[wip] add codemod
redwoodjsbot 9ea6015
refactor e2e to run codemod, make it optional
redwoodjsbot c36a87d
try reverting test project fix
redwoodjsbot 6009ab1
consider yarn3 deps temporary
redwoodjsbot 3abc9af
iterate on ci
redwoodjsbot f4bce34
Revert "try reverting test project fix"
redwoodjsbot de6bc2f
fix bin permissions
redwoodjsbot 656932e
get sb --build working
redwoodjsbot 790d008
get serverless working
redwoodjsbot f9803f6
get test working
redwoodjsbot 4f91533
finalizing things
redwoodjsbot 50503d9
make project:deps:yarn3 a little cleaner
redwoodjsbot 00a41c8
finalize e2e
redwoodjsbot bd10f97
get rw g types working
redwoodjsbot ebb021f
fix failing windows test
redwoodjsbot 44d1d9f
Merge branch 'main' into ds-upgrade-projects-to-yarn-3
jtoar cb97ddd
fix ci
redwoodjsbot 900de0c
fix regex, rm file
redwoodjsbot a14c7c0
Merge branch 'main' into ds-upgrade-projects-to-yarn-3
jtoar 51e03ba
Merge branch 'main' into ds-upgrade-projects-to-yarn-3
thedavidprice 8e4c774
fix(yarn3): Update cwd for yarn 1 backwards compatibility in bins
dac09 653df96
Merge branch 'main' of github.com:redwoodjs/redwood into ds-upgrade-p…
dac09 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env node | ||
import { createRequire } from 'module' | ||
|
||
const requireFromCli = createRequire( | ||
require.resolve('@redwoodjs/cli/package.json') | ||
) | ||
|
||
const bins = requireFromCli('./package.json')['bin'] | ||
|
||
// Ensure we run all commands from the base of the RW project | ||
// even if you invoke from ./web or ./api | ||
const rwProjectRoot = requireFromCli('./dist/lib/index.js').getPaths().base | ||
process.chdir(rwProjectRoot) | ||
|
||
requireFromCli(bins['redwood']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env node | ||
import { createRequire } from 'module' | ||
|
||
const requireFromCli = createRequire( | ||
require.resolve('@redwoodjs/cli/package.json') | ||
) | ||
|
||
const bins = requireFromCli('./package.json')['bin'] | ||
|
||
// Ensure we run all commands from the base of the RW project | ||
// even if you invoke from ./web or ./api | ||
const rwProjectRoot = requireFromCli('./dist/lib/index.js').getPaths().base | ||
process.chdir(rwProjectRoot) | ||
|
||
requireFromCli(bins['rwfw']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env node | ||
import { createRequire } from 'module' | ||
|
||
const requireFromTypeScript = createRequire( | ||
require.resolve('typescript/package.json') | ||
) | ||
|
||
const bins = requireFromTypeScript('./package.json')['bin'] | ||
|
||
requireFromTypeScript(bins['tsc']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ import terminalLink from 'terminal-link' | |
import { getProject } from '@redwoodjs/structure' | ||
import { errorTelemetry } from '@redwoodjs/telemetry' | ||
|
||
import { getCmdMajorVersion } from '../commands/upgrade' | ||
import { getPaths } from '../lib' | ||
import c from '../lib/colors' | ||
import { generatePrismaClient } from '../lib/generatePrismaClient' | ||
|
@@ -55,13 +56,17 @@ export const handler = async ({ sides, verbose, prisma, generate }) => { | |
const typeCheck = async () => { | ||
let conclusiveExitCode = 0 | ||
|
||
const yarnVersion = await getCmdMajorVersion('yarn') | ||
|
||
const tscForAllSides = sides.map((side) => { | ||
const projectDir = path.join(getPaths().base, side) | ||
// -s flag to suppress error output from yarn. For example yarn doc link on non-zero status. | ||
// Since it'll be printed anyways after the whole execution. | ||
return { | ||
cwd: projectDir, | ||
command: `yarn -s tsc --noEmit --skipLibCheck`, | ||
command: `yarn ${ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jtoar what if we created a helper for running yarn commands so all the logic is in one place? Something like |
||
yarnVersion > 1 ? '' : '-s' | ||
} tsc --noEmit --skipLibCheck`, | ||
} | ||
}) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/codemods/src/codemods/v0.48.x/upgradeYarn/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Upgrade Yarn | ||
|
||
This codemod upgrades Redwood projects from yarn 1 to yarn 3. | ||
|
||
The first thing it does is enable corepack: | ||
|
||
``` | ||
corepack enable | ||
``` | ||
|
||
Corepack is a new thing in the Node.js core—it essentially packages yarn with node so that it doesn't have to be installed separately. | ||
Its only available on node >= `v14.9.0`, so we check for that first. | ||
|
||
After enabling corepack, we set the yarn version: | ||
|
||
``` | ||
yarn set version stable | ||
``` | ||
|
||
Finally, before installing, we have to update `.yarnrc.yml` and `.gitignore`. | ||
We have to update the `.yarnc.yml` because we only support the `node_modules` install strategy. |
13 changes: 13 additions & 0 deletions
13
packages/codemods/src/codemods/v0.48.x/upgradeYarn/__testfixtures__/default/input/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.idea | ||
.DS_Store | ||
.env | ||
.netlify | ||
.redwood | ||
dev.db* | ||
dist | ||
dist-babel | ||
node_modules | ||
yarn-error.log | ||
web/public/mockServiceWorker.js | ||
web/types/graphql.d.ts | ||
api/types/graphql.d.ts |
Empty file.
24 changes: 24 additions & 0 deletions
24
...ges/codemods/src/codemods/v0.48.x/upgradeYarn/__testfixtures__/default/input/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"private": true, | ||
"workspaces": { | ||
"packages": [ | ||
"api", | ||
"web", | ||
"packages/*" | ||
] | ||
}, | ||
"devDependencies": { | ||
"@redwoodjs/core": "0.47.0" | ||
}, | ||
"eslintConfig": { | ||
"extends": "@redwoodjs/eslint-config", | ||
"root": true | ||
}, | ||
"engines": { | ||
"node": ">=14.17 <=16.x", | ||
"yarn": ">=1.15 <2" | ||
}, | ||
"prisma": { | ||
"seed": "yarn rw exec seed" | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...ages/codemods/src/codemods/v0.48.x/upgradeYarn/__testfixtures__/default/output/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.idea | ||
.DS_Store | ||
.env | ||
.netlify | ||
.redwood | ||
dev.db* | ||
dist | ||
dist-babel | ||
node_modules | ||
yarn-error.log | ||
web/public/mockServiceWorker.js | ||
web/types/graphql.d.ts | ||
api/types/graphql.d.ts | ||
.pnp.* | ||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions |
Empty file.
9 changes: 9 additions & 0 deletions
9
...ges/codemods/src/codemods/v0.48.x/upgradeYarn/__testfixtures__/default/output/.yarnrc.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
compressionLevel: 0 | ||
|
||
enableGlobalCache: true | ||
|
||
nmMode: hardlinks-local | ||
|
||
nodeLinker: node-modules | ||
|
||
yarnPath: .yarn/releases/yarn-3.2.0.cjs |
25 changes: 25 additions & 0 deletions
25
...es/codemods/src/codemods/v0.48.x/upgradeYarn/__testfixtures__/default/output/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"private": true, | ||
"workspaces": { | ||
"packages": [ | ||
"api", | ||
"web", | ||
"packages/*" | ||
] | ||
}, | ||
"devDependencies": { | ||
"@redwoodjs/core": "0.47.0" | ||
}, | ||
"eslintConfig": { | ||
"extends": "@redwoodjs/eslint-config", | ||
"root": true | ||
}, | ||
"engines": { | ||
"node": ">=14.17 <=16.x", | ||
"yarn": ">=1.15 <2" | ||
}, | ||
"prisma": { | ||
"seed": "yarn rw exec seed" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jtoar curious if you tried setup ui chakra-ui?