rsnext/scripts/sync-react.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

233 lines
6.7 KiB
JavaScript
Raw Normal View History

Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
// @ts-check
const path = require('path')
const fsp = require('fs/promises')
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
const execa = require('execa')
/** @type {any} */
const fetch = require('node-fetch')
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
// Use this script to update Next's vendored copy of React and related packages:
//
// Basic usage (defaults to most recent React canary version):
// pnpm run sync-react
//
// Update package.json but skip installing the dependencies automatically:
// pnpm run sync-react --no-install
async function sync(channel = 'next') {
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
const noInstall = readBoolArg(process.argv, 'no-install')
const useExperimental = channel === 'experimental'
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
let newVersionStr = readStringArg(process.argv, 'version')
if (newVersionStr === null) {
const { stdout, stderr } = await execa(
'npm',
[
'view',
useExperimental ? 'react@experimental' : 'react@next',
'version',
],
{
// Avoid "Usage Error: This project is configured to use pnpm".
cwd: '/tmp',
}
)
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
if (stderr) {
console.error(stderr)
throw new Error('Failed to read latest React canary version from npm.')
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
}
newVersionStr = stdout.trim()
}
const newVersionInfo = extractInfoFromReactVersion(newVersionStr)
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
if (!newVersionInfo) {
throw new Error(
`New react version does not match expected format: ${newVersionStr}
Choose a React canary version from npm: https://www.npmjs.com/package/react?activeTab=versions
Or, run this command with no arguments to use the most recently published version.
`
)
}
newVersionInfo.releaseLabel = channel
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
const cwd = process.cwd()
const pkgJson = JSON.parse(
await fsp.readFile(path.join(cwd, 'package.json'), 'utf-8')
)
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
const devDependencies = pkgJson.devDependencies
const baseVersionStr = devDependencies[
useExperimental ? 'react-experimental-builtin' : 'react-builtin'
].replace(/^npm:react@/, '')
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
const baseVersionInfo = extractInfoFromReactVersion(baseVersionStr)
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
if (!baseVersionInfo) {
throw new Error(
'Base react version does not match expected format: ' + baseVersionStr
)
}
Upgrade React to 18.3.0-canary-b7972822b-20230503 (#49158) Includes the following upstream changes: - [b7972822b](https://github.com/facebook/react/commits/b7972822b) useOptimisticState -> useOptimistic ([#26772](https://github.com/facebook/react/pull/26772)) (Andrew Clark) - [388686f29](https://github.com/facebook/react/commits/388686f29) Add "canary" to list of allowed npm dist tags ([#26767](https://github.com/facebook/react/pull/26767)) (Andrew Clark) - [8a25302c6](https://github.com/facebook/react/commits/8a25302c6) fix[dynamic-scripts-injection]: unregister content scripts before registration ([#26765](https://github.com/facebook/react/pull/26765)) (Ruslan Lesiutin) - [2c2476834](https://github.com/facebook/react/commits/2c2476834) Rename "next" prerelease channel to "canary" ([#26761](https://github.com/facebook/react/pull/26761)) (Andrew Clark) - [fa4314841](https://github.com/facebook/react/commits/fa4314841) Remove deprecated workflow key from Circle config ([#26762](https://github.com/facebook/react/pull/26762)) (Andrew Clark) - [5dd90c562](https://github.com/facebook/react/commits/5dd90c562) Use content hash for react-native builds ([#26734](https://github.com/facebook/react/pull/26734)) (Samuel Susla) - [559e83aeb](https://github.com/facebook/react/commits/559e83aeb) [Fizz] Allow an action provide a custom set of props to use for progressive enhancement ([#26749](https://github.com/facebook/react/pull/26749)) (Sebastian Markbåge) - [67f4fb021](https://github.com/facebook/react/commits/67f4fb021) Allow forms to skip hydration of hidden inputs ([#26735](https://github.com/facebook/react/pull/26735)) (Sebastian Markbåge) - [8ea96ef84](https://github.com/facebook/react/commits/8ea96ef84) [Fizz] Encode external fizz runtime into chunks eagerly ([#26752](https://github.com/facebook/react/pull/26752)) (Josh Story) - [491aec5d6](https://github.com/facebook/react/commits/491aec5d6) Implement experimental_useOptimisticState ([#26740](https://github.com/facebook/react/pull/26740)) (Andrew Clark) - [9545e4810](https://github.com/facebook/react/commits/9545e4810) Add nonce support to bootstrap scripts and external runtime ([#26738](https://github.com/facebook/react/pull/26738)) (Dan Ott) - [86b0e9199](https://github.com/facebook/react/commits/86b0e9199) Gate DevTools test to fix CI ([#26742](https://github.com/facebook/react/pull/26742)) (Andrew Clark) - [b12bea62d](https://github.com/facebook/react/commits/b12bea62d) Preinits should support a nonce option ([#26744](https://github.com/facebook/react/pull/26744)) (Josh Story) - [efbd68511](https://github.com/facebook/react/commits/efbd68511) Remove unused `initialStatus` parameter from `useHostTransitionStatus` ([#26743](https://github.com/facebook/react/pull/26743)) (Sebastian Silbermann) - [18282f881](https://github.com/facebook/react/commits/18282f881) Fix: Update while suspended fails to interrupt ([#26739](https://github.com/facebook/react/pull/26739)) (Andrew Clark) - [540bab085](https://github.com/facebook/react/commits/540bab085) Implement experimental_useFormStatus ([#26722](https://github.com/facebook/react/pull/26722)) (Andrew Clark) ---------
2023-05-03 23:03:19 +02:00
const {
sha: newSha,
releaseLabel: newReleaseLabel,
dateString: newDateString,
} = newVersionInfo
const {
sha: baseSha,
releaseLabel: baseReleaseLabel,
dateString: baseDateString,
} = baseVersionInfo
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
console.log(`Updating "react@${channel}" to ${newSha}...\n`)
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
if (newSha === baseSha) {
console.log('Already up to date.')
return
}
for (const [dep, version] of Object.entries(devDependencies)) {
Upgrade React to 18.3.0-canary-b7972822b-20230503 (#49158) Includes the following upstream changes: - [b7972822b](https://github.com/facebook/react/commits/b7972822b) useOptimisticState -> useOptimistic ([#26772](https://github.com/facebook/react/pull/26772)) (Andrew Clark) - [388686f29](https://github.com/facebook/react/commits/388686f29) Add "canary" to list of allowed npm dist tags ([#26767](https://github.com/facebook/react/pull/26767)) (Andrew Clark) - [8a25302c6](https://github.com/facebook/react/commits/8a25302c6) fix[dynamic-scripts-injection]: unregister content scripts before registration ([#26765](https://github.com/facebook/react/pull/26765)) (Ruslan Lesiutin) - [2c2476834](https://github.com/facebook/react/commits/2c2476834) Rename "next" prerelease channel to "canary" ([#26761](https://github.com/facebook/react/pull/26761)) (Andrew Clark) - [fa4314841](https://github.com/facebook/react/commits/fa4314841) Remove deprecated workflow key from Circle config ([#26762](https://github.com/facebook/react/pull/26762)) (Andrew Clark) - [5dd90c562](https://github.com/facebook/react/commits/5dd90c562) Use content hash for react-native builds ([#26734](https://github.com/facebook/react/pull/26734)) (Samuel Susla) - [559e83aeb](https://github.com/facebook/react/commits/559e83aeb) [Fizz] Allow an action provide a custom set of props to use for progressive enhancement ([#26749](https://github.com/facebook/react/pull/26749)) (Sebastian Markbåge) - [67f4fb021](https://github.com/facebook/react/commits/67f4fb021) Allow forms to skip hydration of hidden inputs ([#26735](https://github.com/facebook/react/pull/26735)) (Sebastian Markbåge) - [8ea96ef84](https://github.com/facebook/react/commits/8ea96ef84) [Fizz] Encode external fizz runtime into chunks eagerly ([#26752](https://github.com/facebook/react/pull/26752)) (Josh Story) - [491aec5d6](https://github.com/facebook/react/commits/491aec5d6) Implement experimental_useOptimisticState ([#26740](https://github.com/facebook/react/pull/26740)) (Andrew Clark) - [9545e4810](https://github.com/facebook/react/commits/9545e4810) Add nonce support to bootstrap scripts and external runtime ([#26738](https://github.com/facebook/react/pull/26738)) (Dan Ott) - [86b0e9199](https://github.com/facebook/react/commits/86b0e9199) Gate DevTools test to fix CI ([#26742](https://github.com/facebook/react/pull/26742)) (Andrew Clark) - [b12bea62d](https://github.com/facebook/react/commits/b12bea62d) Preinits should support a nonce option ([#26744](https://github.com/facebook/react/pull/26744)) (Josh Story) - [efbd68511](https://github.com/facebook/react/commits/efbd68511) Remove unused `initialStatus` parameter from `useHostTransitionStatus` ([#26743](https://github.com/facebook/react/pull/26743)) (Sebastian Silbermann) - [18282f881](https://github.com/facebook/react/commits/18282f881) Fix: Update while suspended fails to interrupt ([#26739](https://github.com/facebook/react/pull/26739)) (Andrew Clark) - [540bab085](https://github.com/facebook/react/commits/540bab085) Implement experimental_useFormStatus ([#26722](https://github.com/facebook/react/pull/26722)) (Andrew Clark) ---------
2023-05-03 23:03:19 +02:00
if (version.endsWith(`${baseReleaseLabel}-${baseSha}-${baseDateString}`)) {
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
devDependencies[dep] = version.replace(
Upgrade React to 18.3.0-canary-b7972822b-20230503 (#49158) Includes the following upstream changes: - [b7972822b](https://github.com/facebook/react/commits/b7972822b) useOptimisticState -> useOptimistic ([#26772](https://github.com/facebook/react/pull/26772)) (Andrew Clark) - [388686f29](https://github.com/facebook/react/commits/388686f29) Add "canary" to list of allowed npm dist tags ([#26767](https://github.com/facebook/react/pull/26767)) (Andrew Clark) - [8a25302c6](https://github.com/facebook/react/commits/8a25302c6) fix[dynamic-scripts-injection]: unregister content scripts before registration ([#26765](https://github.com/facebook/react/pull/26765)) (Ruslan Lesiutin) - [2c2476834](https://github.com/facebook/react/commits/2c2476834) Rename "next" prerelease channel to "canary" ([#26761](https://github.com/facebook/react/pull/26761)) (Andrew Clark) - [fa4314841](https://github.com/facebook/react/commits/fa4314841) Remove deprecated workflow key from Circle config ([#26762](https://github.com/facebook/react/pull/26762)) (Andrew Clark) - [5dd90c562](https://github.com/facebook/react/commits/5dd90c562) Use content hash for react-native builds ([#26734](https://github.com/facebook/react/pull/26734)) (Samuel Susla) - [559e83aeb](https://github.com/facebook/react/commits/559e83aeb) [Fizz] Allow an action provide a custom set of props to use for progressive enhancement ([#26749](https://github.com/facebook/react/pull/26749)) (Sebastian Markbåge) - [67f4fb021](https://github.com/facebook/react/commits/67f4fb021) Allow forms to skip hydration of hidden inputs ([#26735](https://github.com/facebook/react/pull/26735)) (Sebastian Markbåge) - [8ea96ef84](https://github.com/facebook/react/commits/8ea96ef84) [Fizz] Encode external fizz runtime into chunks eagerly ([#26752](https://github.com/facebook/react/pull/26752)) (Josh Story) - [491aec5d6](https://github.com/facebook/react/commits/491aec5d6) Implement experimental_useOptimisticState ([#26740](https://github.com/facebook/react/pull/26740)) (Andrew Clark) - [9545e4810](https://github.com/facebook/react/commits/9545e4810) Add nonce support to bootstrap scripts and external runtime ([#26738](https://github.com/facebook/react/pull/26738)) (Dan Ott) - [86b0e9199](https://github.com/facebook/react/commits/86b0e9199) Gate DevTools test to fix CI ([#26742](https://github.com/facebook/react/pull/26742)) (Andrew Clark) - [b12bea62d](https://github.com/facebook/react/commits/b12bea62d) Preinits should support a nonce option ([#26744](https://github.com/facebook/react/pull/26744)) (Josh Story) - [efbd68511](https://github.com/facebook/react/commits/efbd68511) Remove unused `initialStatus` parameter from `useHostTransitionStatus` ([#26743](https://github.com/facebook/react/pull/26743)) (Sebastian Silbermann) - [18282f881](https://github.com/facebook/react/commits/18282f881) Fix: Update while suspended fails to interrupt ([#26739](https://github.com/facebook/react/pull/26739)) (Andrew Clark) - [540bab085](https://github.com/facebook/react/commits/540bab085) Implement experimental_useFormStatus ([#26722](https://github.com/facebook/react/pull/26722)) (Andrew Clark) ---------
2023-05-03 23:03:19 +02:00
`${baseReleaseLabel}-${baseSha}-${baseDateString}`,
`${newReleaseLabel}-${newSha}-${newDateString}`
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
)
}
}
await fsp.writeFile(
path.join(cwd, 'package.json'),
JSON.stringify(pkgJson, null, 2)
)
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
console.log('Successfully updated React dependencies in package.json.\n')
// Install the updated dependencies and build the vendored React files.
if (noInstall) {
console.log('Skipping install step because --no-install flag was passed.\n')
} else {
console.log('Installing dependencies...\n')
const installSubprocess = execa('pnpm', ['install'])
if (installSubprocess.stdout) {
installSubprocess.stdout.pipe(process.stdout)
}
try {
await installSubprocess
} catch (error) {
console.error(error)
throw new Error('Failed to install updated dependencies.')
}
console.log('Building vendored React files...\n')
const nccSubprocess = execa('pnpm', ['taskr', 'copy_vendor_react'], {
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
cwd: path.join(cwd, 'packages', 'next'),
})
if (nccSubprocess.stdout) {
nccSubprocess.stdout.pipe(process.stdout)
}
try {
await nccSubprocess
} catch (error) {
console.error(error)
throw new Error('Failed to run ncc.')
}
// Print extra newline after ncc output
console.log()
}
console.log(`Successfully updated React from ${baseSha} to ${newSha}.\n`)
// Fetch the changelog from GitHub and print it to the console.
try {
const changelog = await getChangelogFromGitHub(baseSha, newSha)
if (changelog === null) {
console.log(
`GitHub reported no changes between ${baseSha} and ${newSha}.`
)
} else {
console.log(`### React upstream changes\n\n${changelog}\n\n`)
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
}
} catch (error) {
console.error(error)
console.log(
'\nFailed to fetch changelog from GitHub. Changes were applied, anyway.\n'
)
}
if (noInstall) {
console.log(
`
To finish upgrading, complete the following steps:
- Install the updated dependencies: pnpm install
- Build the vendored React files: (inside packages/next dir) pnpm taskr ncc
Or run this command again without the --no-install flag to do both automatically.
`
)
}
}
function readBoolArg(argv, argName) {
return argv.indexOf('--' + argName) !== -1
}
function readStringArg(argv, argName) {
const argIndex = argv.indexOf('--' + argName)
return argIndex === -1 ? null : argv[argIndex + 1]
}
function extractInfoFromReactVersion(reactCanaryVersion) {
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
const match = reactCanaryVersion.match(
Upgrade React to 18.3.0-canary-b7972822b-20230503 (#49158) Includes the following upstream changes: - [b7972822b](https://github.com/facebook/react/commits/b7972822b) useOptimisticState -> useOptimistic ([#26772](https://github.com/facebook/react/pull/26772)) (Andrew Clark) - [388686f29](https://github.com/facebook/react/commits/388686f29) Add "canary" to list of allowed npm dist tags ([#26767](https://github.com/facebook/react/pull/26767)) (Andrew Clark) - [8a25302c6](https://github.com/facebook/react/commits/8a25302c6) fix[dynamic-scripts-injection]: unregister content scripts before registration ([#26765](https://github.com/facebook/react/pull/26765)) (Ruslan Lesiutin) - [2c2476834](https://github.com/facebook/react/commits/2c2476834) Rename "next" prerelease channel to "canary" ([#26761](https://github.com/facebook/react/pull/26761)) (Andrew Clark) - [fa4314841](https://github.com/facebook/react/commits/fa4314841) Remove deprecated workflow key from Circle config ([#26762](https://github.com/facebook/react/pull/26762)) (Andrew Clark) - [5dd90c562](https://github.com/facebook/react/commits/5dd90c562) Use content hash for react-native builds ([#26734](https://github.com/facebook/react/pull/26734)) (Samuel Susla) - [559e83aeb](https://github.com/facebook/react/commits/559e83aeb) [Fizz] Allow an action provide a custom set of props to use for progressive enhancement ([#26749](https://github.com/facebook/react/pull/26749)) (Sebastian Markbåge) - [67f4fb021](https://github.com/facebook/react/commits/67f4fb021) Allow forms to skip hydration of hidden inputs ([#26735](https://github.com/facebook/react/pull/26735)) (Sebastian Markbåge) - [8ea96ef84](https://github.com/facebook/react/commits/8ea96ef84) [Fizz] Encode external fizz runtime into chunks eagerly ([#26752](https://github.com/facebook/react/pull/26752)) (Josh Story) - [491aec5d6](https://github.com/facebook/react/commits/491aec5d6) Implement experimental_useOptimisticState ([#26740](https://github.com/facebook/react/pull/26740)) (Andrew Clark) - [9545e4810](https://github.com/facebook/react/commits/9545e4810) Add nonce support to bootstrap scripts and external runtime ([#26738](https://github.com/facebook/react/pull/26738)) (Dan Ott) - [86b0e9199](https://github.com/facebook/react/commits/86b0e9199) Gate DevTools test to fix CI ([#26742](https://github.com/facebook/react/pull/26742)) (Andrew Clark) - [b12bea62d](https://github.com/facebook/react/commits/b12bea62d) Preinits should support a nonce option ([#26744](https://github.com/facebook/react/pull/26744)) (Josh Story) - [efbd68511](https://github.com/facebook/react/commits/efbd68511) Remove unused `initialStatus` parameter from `useHostTransitionStatus` ([#26743](https://github.com/facebook/react/pull/26743)) (Sebastian Silbermann) - [18282f881](https://github.com/facebook/react/commits/18282f881) Fix: Update while suspended fails to interrupt ([#26739](https://github.com/facebook/react/pull/26739)) (Andrew Clark) - [540bab085](https://github.com/facebook/react/commits/540bab085) Implement experimental_useFormStatus ([#26722](https://github.com/facebook/react/pull/26722)) (Andrew Clark) ---------
2023-05-03 23:03:19 +02:00
/(?<semverVersion>.*)-(?<releaseLabel>.*)-(?<sha>.*)-(?<dateString>.*)$/
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
)
return match ? match.groups : null
}
async function getChangelogFromGitHub(baseSha, newSha) {
const pageSize = 50
let changelog = []
for (let currentPage = 0; ; currentPage++) {
const response = await fetch(
`https://api.github.com/repos/facebook/react/compare/${baseSha}...${newSha}?per_page=${pageSize}&page=${currentPage}`
)
if (!response.ok) {
throw new Error('Failed to fetch commit log from GitHub.')
}
const data = await response.json()
const { commits } = data
for (const { commit, sha } of commits) {
const title = commit.message.split('\n')[0] || ''
// The "title" looks like "[Fiber][Float] preinitialized stylesheets should support integrity option (#26881)"
const match = /\(#([0-9]+)\)$/.exec(title)
const prNum = match ? match[1] : ''
if (prNum) {
changelog.push(`- https://github.com/facebook/react/pull/${prNum}`)
} else {
changelog.push(
`- ${sha.slice(0, 9)} ${commit.message.split('\n')[0]} (${
commit.author.name
})`
)
}
Add script to automate updating vendored React version (#46663) Since we intend to update our vendored copy of React frequently, I wrote a script to automate the steps. Basic usage (defaults to most recent React canary version): ```sh pnpm run sync-react ``` Specify a canary version: ```sh pnpm run sync-react --version 18.3.0-next-41110021f-20230301 ``` Update package.json but skip installing the dependencies automatically: ```sh pnpm run sync-react --no-install ``` At the end it will print out a changelog so you can copy/paste it into the PR description. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-02 03:15:02 +01:00
}
if (commits.length !== pageSize) {
// If the number of commits is less than the page size, we've reached
// the end. Otherwise we'll keep fetching until we run out.
break
}
}
changelog.reverse()
return changelog.length > 0 ? changelog.join('\n') : null
}
sync('beta')
.then(() => sync('experimental'))
.catch((error) => {
console.error(error)
process.exit(1)
})