Skip to content

Commit

Permalink
Remove WARNINGS file from FB (facebook#27820)
Browse files Browse the repository at this point in the history
The test was migrated to the generated JS file that allows Jest to track
the dependencies, we can now remove this file generation.
  • Loading branch information
kassens authored and AndyPengc12 committed Apr 15, 2024
1 parent 2d1ff9b commit 82fa9ea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
3 changes: 1 addition & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ jobs:
- run:
command: |
mkdir -p ./build/__test_utils__
node ./scripts/print-warnings/print-warnings.js > build/WARNINGS
node ./scripts/print-warnings/print-warnings.js --js > build/__test_utils__/ReactAllWarnings.js
node ./scripts/print-warnings/print-warnings.js > build/__test_utils__/ReactAllWarnings.js
- persist_to_workspace:
root: .
paths:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/commit_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ jobs:
mkdir ./compiled
mv build/facebook-www ./compiled
# Move WARNINGS to facebook-www
# Move ReactAllWarnings.js to facebook-www
mkdir ./compiled/facebook-www/__test_utils__
mv build/WARNINGS ./compiled/facebook-www/WARNINGS
mv build/__test_utils__/ReactAllWarnings.js ./compiled/facebook-www/__test_utils__/ReactAllWarnings.js
# Move eslint-plugin-react-hooks into facebook-www
Expand Down
18 changes: 5 additions & 13 deletions scripts/print-warnings/print-warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,10 @@ gs([
'!**/node_modules/**/*.js',
]).pipe(
through.obj(transform, cb => {
if (process.argv[2] === '--js') {
const warningsArray = Array.from(warnings);
warningsArray.sort();
process.stdout.write(
`/**
const warningsArray = Array.from(warnings);
warningsArray.sort();
process.stdout.write(
`/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
Expand All @@ -92,14 +91,7 @@ gs([
export default ${JSON.stringify(warningsArray, null, 2)};
`
);
} else {
process.stdout.write(
Array.from(warnings, warning => JSON.stringify(warning))
.sort()
.join('\n') + '\n'
);
}
);
cb();
})
);

0 comments on commit 82fa9ea

Please sign in to comment.