Skip to content

Commit

Permalink
Merge branch 'update-rollup' of https://github.com/ymqy/react; branch…
Browse files Browse the repository at this point in the history
… 'main' of https://github.com/facebook/react into update-rollup
  • Loading branch information
ymqy committed Mar 19, 2023
2 parents 6162fbe + 842bd78 commit bb89255
Show file tree
Hide file tree
Showing 410 changed files with 20,514 additions and 19,854 deletions.
28 changes: 25 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,33 @@ jobs:
- setup_node_modules
- run:
name: Download artifacts for base revision
# TODO: The download-experimental-build.js script works by fetching
# artifacts from CI. CircleCI recently updated this endpoint to
# require an auth token. This is a problem for PR branches, where
# sizebot needs to run, because we don't want to leak the token to
# arbitrary code written by an outside contributor.
#
# This only affects PR branches. CI workflows that run on the main
# branch are allowed to access environment variables, because only those
# with push access can land code in main.
#
# As a temporary workaround, we'll fetch the assets from a mirror.
# Need to figure out a longer term solution for this.
#
# Original code
#
# command: |
# git fetch origin main
# cd ./scripts/release && yarn && cd ../../
# scripts/release/download-experimental-build.js --commit=$(git merge-base HEAD origin/main) --allowBrokenCI
# mv ./build ./base-build
#
# Workaround. Fetch the artifacts from react-builds.vercel.app. This
# is the same app that hosts the sizebot diff previews.
command: |
git fetch origin main
cd ./scripts/release && yarn && cd ../../
scripts/release/download-experimental-build.js --commit=$(git merge-base HEAD origin/main) --allowBrokenCI
curl -L --retry 60 --retry-delay 10 --retry-max-time 600 https://react-builds.vercel.app/api/commits/$(git merge-base HEAD origin/main)/artifacts/build.tgz | tar -xz
mv ./build ./base-build
- run:
# TODO: The `download-experimental-build` script copies the npm
# packages into the `node_modules` directory. This is a historical
Expand Down
2 changes: 1 addition & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"packages": ["packages/react", "packages/react-dom", "packages/scheduler"],
"buildCommand": "download-build-in-codesandbox-ci",
"node": "14",
"node": "18",
"publishDirectory": {
"react": "build/oss-experimental/react",
"react-dom": "build/oss-experimental/react-dom",
Expand Down
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ module.exports = {
'packages/react-native-renderer/**/*.js',
'packages/eslint-plugin-react-hooks/**/*.js',
'packages/jest-react/**/*.js',
'packages/internal-test-utils/**/*.js',
'packages/**/__tests__/*.js',
'packages/**/npm/*.js',
],
Expand Down
38 changes: 28 additions & 10 deletions .github/workflows/commit_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
steps:
- name: Download and unzip artifacts
uses: actions/github-script@v6
env:
CIRCLECI_TOKEN: ${{secrets.CIRCLECI_TOKEN_DIFFTRAIN}}
with:
script: |
const cp = require('child_process');
Expand Down Expand Up @@ -58,10 +60,10 @@ jobs:
const ciBuildId = /\/facebook\/react\/([0-9]+)/.exec(
status.target_url,
)[1];
console.log(`CircleCI build id found: ${ciBuildId}`);
if (Number.parseInt(ciBuildId, 10) + '' === ciBuildId) {
artifactsUrl =
`https://circleci.com/api/v1.1/project/github/facebook/react/${ciBuildId}/artifacts`;
console.log(`Found artifactsUrl: ${artifactsUrl}`);
break spinloop;
} else {
throw new Error(`${ciBuildId} isn't a number`);
Expand All @@ -80,13 +82,21 @@ jobs:
await sleep(60_000);
}
if (artifactsUrl != null) {
const res = await fetch(artifactsUrl);
const {CIRCLECI_TOKEN} = process.env;
const res = await fetch(artifactsUrl, {
headers: {
'Circle-Token': CIRCLECI_TOKEN
}
});
const data = await res.json();
if (!Array.isArray(data) && data.message != null) {
throw `CircleCI returned: ${data.message}`;
}
for (const artifact of data) {
if (artifact.path === 'build.tgz') {
console.log(`Downloading and unzipping ${artifact.url}`);
await execHelper(
`curl -L ${artifact.url} | tar -xvz`
`curl -L ${artifact.url} -H "Circle-Token: ${CIRCLECI_TOKEN}" | tar -xvz`
);
}
}
Expand All @@ -96,8 +106,8 @@ jobs:
- name: Strip @license from eslint plugin and react-refresh
run: |
sed -i -e 's/ @license React*//' \
build/oss-stable/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js \
build/oss-stable/react-refresh/cjs/react-refresh-babel.development.js
build/oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js \
build/oss-experimental/react-refresh/cjs/react-refresh-babel.development.js
- name: Move relevant files into compiled
run: |
mkdir -p ./compiled
Expand All @@ -111,22 +121,21 @@ jobs:
mv build/WARNINGS ./compiled/facebook-www/WARNINGS
# Copy eslint-plugin-react-hooks into facebook-www
mv build/oss-stable/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js \
mv build/oss-experimental/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js \
./compiled/facebook-www/eslint-plugin-react-hooks.js
# Copy unstable_server-external-runtime.js into facebook-www
mv build/oss-stable/react-dom/unstable_server-external-runtime.js \
./compiled/facebook-www/unstable_server-external-runtime.js
# Copy react-refresh-babel.development.js into babel-plugin-react-refresh
mv build/oss-stable/react-refresh/cjs/react-refresh-babel.development.js \
mv build/oss-experimental/react-refresh/cjs/react-refresh-babel.development.js \
./compiled/babel-plugin-react-refresh/index.js
ls -R ./compiled
- name: Add REVISION files
- name: Add REVISION file
run: |
echo ${{ github.sha }} >> ./compiled/facebook-www/REVISION
cp ./compiled/facebook-www/REVISION ./compiled/facebook-www/REVISION_TRANSFORMS
- uses: actions/upload-artifact@v3
with:
name: compiled
Expand All @@ -146,13 +155,22 @@ jobs:
name: compiled
path: compiled/
- run: git status -u
- name: Check if only the REVISION file has changed
id: check_should_commit
run: |
if git status --porcelain | grep -qv '/REVISION$'; then
echo "should_commit=true" >> "$GITHUB_OUTPUT"
else
echo "should_commit=false" >> "$GITHUB_OUTPUT"
fi
- name: Commit changes to branch
if: steps.check_should_commit.outputs.should_commit == 'true'
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: |
${{ github.event.head_commit.message }}
DiffTrain build for commit ${{ github.sha }}.
DiffTrain build for [${{ github.sha }}](https://github.com/facebook/react/commit/${{ github.sha }})
branch: builds/facebook-www
commit_user_name: ${{ github.actor }}
commit_user_email: ${{ github.actor }}@users.noreply.github.com
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v14.17.6
v16.19.1
1 change: 0 additions & 1 deletion fixtures/flight/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

# production
/build
/dist
.eslintcache

# misc
Expand Down
66 changes: 0 additions & 66 deletions fixtures/flight/config/getHttpsConfig.js

This file was deleted.

2 changes: 1 addition & 1 deletion fixtures/flight/config/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const fs = require('fs');
const path = require('path');
const paths = require('./paths');
const chalk = require('react-dev-utils/chalk');
const chalk = require('chalk');
const resolve = require('resolve');

/**
Expand Down
2 changes: 0 additions & 2 deletions fixtures/flight/config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,13 @@ module.exports = {
appPath: resolveApp('.'),
appBuild: resolveApp(buildPath),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appIndexJs: resolveModule(resolveApp, 'src/index'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'),
appTsConfig: resolveApp('tsconfig.json'),
appJsConfig: resolveApp('jsconfig.json'),
yarnLockFile: resolveApp('yarn.lock'),
testsSetup: resolveModule(resolveApp, 'src/setupTests'),
proxySetup: resolveApp('src/setupProxy.js'),
appNodeModules: resolveApp('node_modules'),
appWebpackCache: resolveApp('node_modules/.cache'),
appTsBuildInfoFile: resolveApp('node_modules/.cache/tsconfig.tsbuildinfo'),
Expand Down
Loading

0 comments on commit bb89255

Please sign in to comment.