-
Notifications
You must be signed in to change notification settings - Fork 648
feat(project): update project to use React 18 #2661
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
ec8089a
chore(project): add script to set react version
joshblack 175714e
chore: add ci check for test and type-check
joshblack b4c872b
chore: update workflow syntax
joshblack 4b59e81
chore: update install step
joshblack 61f9730
chore: add fail-fast option
joshblack 8e77628
chore: add types packages to set-react-version
joshblack f1ff3ec
refactor(project): update TypeScript definitions for React 18
joshblack 89a38c6
chore: update slots types
joshblack 987964b
chore: add ts-ignore for package that needs to be updated for react 18
joshblack d051d9c
chore: add changeset
joshblack 474cac4
chore: update ActionMenu story to use React.createElement
joshblack 442fd91
chore: update unused import
joshblack 70acaf1
test(ThemeProvider): update test to use userEvents
joshblack 4140673
test(helpers): add TextEncoder for useMedia
joshblack b4b2a8d
test(MarkdownEditor): update tests for MarkdownEditor
joshblack b2d5520
test: update TextInputWithTokens test
joshblack 58f0102
test(MarkdownEditor): enable skipped tests
joshblack 23ec248
chore: add spy for console.error() in test
joshblack 3feefab
chore: add globals for react version
joshblack 914d222
chore: remove storybook-addon-html
joshblack 6385ace
chore: update storybook deps
joshblack 976d26f
chore: remove conditional install step from ci.yml
joshblack 325345f
Revert "chore: remove conditional install step from ci.yml"
joshblack 5b4850b
feat(project): update to React 18 for development
joshblack fa1a5a9
ci: update install step to use 18 by default
joshblack 0d77e0c
chore: update lockfile
joshblack 3f1504d
chore: update eslint to warn on useSSRSafeId
joshblack 013bfdc
feat(project): add useId hook
joshblack c4c4221
feat(project): update useSSRSafeId to useId
joshblack 4cc7e2e
chore: disable eslint violations
joshblack 5aa9a4d
test: map useId() to useSSRSafeId() in test
joshblack 6d78c16
test(storybook): update interaction tests for UnderlineNav
joshblack 1efba24
chore: add changeset
joshblack f8bc3c0
Merge branch 'main' of github.com:primer/react into ci/add-react-18-test
joshblack 2e99494
fix(PageHeader): add PropsWithChildren to ParentLinkProps
joshblack 41c96c4
chore: update workflow file
joshblack 9f25f74
chore(eslint): remove inferred type annotation
joshblack 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 hidden or 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 hidden or 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,88 @@ | ||
| 'use strict' | ||
|
|
||
| const fs = require('node:fs/promises') | ||
| const os = require('node:os') | ||
| const path = require('node:path') | ||
|
|
||
| const versions = new Map([ | ||
| [ | ||
| '17', | ||
| { | ||
| devDependencies: [ | ||
| { | ||
| name: 'react', | ||
| version: '17.0.2', | ||
| }, | ||
| { | ||
| name: 'react-dom', | ||
| version: '17.0.2', | ||
| }, | ||
| { | ||
| name: 'react-test-renderer', | ||
| version: '17.0.2', | ||
| }, | ||
| { | ||
| name: '@testing-library/react', | ||
| version: '12.1.5', | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| [ | ||
| '18', | ||
| { | ||
| devDependencies: [ | ||
| { | ||
| name: '@types/react', | ||
| version: '18.0.26', | ||
| }, | ||
| { | ||
| name: '@types/react-dom', | ||
| version: '18.0.9', | ||
| }, | ||
| { | ||
| name: 'react', | ||
| version: '18.2.0', | ||
| }, | ||
| { | ||
| name: 'react-dom', | ||
| version: '18.2.0', | ||
| }, | ||
| { | ||
| name: 'react-test-renderer', | ||
| version: '18.2.0', | ||
| }, | ||
| { | ||
| name: '@testing-library/react', | ||
| version: '13.4.0', | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| ]) | ||
|
|
||
| async function main(version = 17) { | ||
| if (!versions.has(version)) { | ||
| throw new Error(`No React version defined for input: ${version}`) | ||
| } | ||
|
|
||
| const {devDependencies} = versions.get(version) | ||
| const packageJsonPath = path.resolve(__dirname, '..', 'package.json') | ||
| const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8')) | ||
|
|
||
| for (const dependency of devDependencies) { | ||
| packageJson.devDependencies[dependency.name] = dependency.version | ||
| } | ||
|
|
||
| const contents = `${JSON.stringify(packageJson, null, 2)}${os.EOL}` | ||
| await fs.writeFile(packageJsonPath, contents) | ||
| } | ||
|
|
||
| const [version] = process.argv.slice(2) | ||
|
|
||
| // eslint-disable-next-line github/no-then | ||
| main(version).catch(error => { | ||
| // eslint-disable-next-line no-console | ||
| console.log(error) | ||
| process.exit(1) | ||
| }) | ||
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.
Uh oh!
There was an error while loading. Please reload this page.