@samitouri / QOS-React-2 / commits / 398d449c48

Fix the print warnings script (#9344)

Dan Abramov committed Apr 5, 2017 at 18:54 UTC 398d449c4803cf126c616a4c99a8caad75314508
11 files changed +28 -19
package.json
+3 -2
@@ -109,7 +109,8 @@
109 "jest": {
110 "modulePathIgnorePatterns": [
111 "/.module-cache/",
112 - "/react/build/"
112 + "/react/build/",
113 + "/react/scripts/rollup/shims/"
114 ],
115 "rootDir": "",
116 "transform": {
@@ -130,7 +131,7 @@
131 "roots": [
132 "<rootDir>/eslint-rules",
133 "<rootDir>/mocks",
133 - "<rootDir>/scripts/error-codes",
134 + "<rootDir>/scripts",
135 "<rootDir>/src",
136 "node_modules/fbjs"
137 ],
scripts/circleci/test_entry_point.sh
+1
@@ -31,6 +31,7 @@ if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
31 COMMANDS_TO_RUN+=('node ./scripts/tasks/flow')
32 COMMANDS_TO_RUN+=('node ./scripts/tasks/jest')
33 COMMANDS_TO_RUN+=('./scripts/circleci/build.sh')
34 + COMMANDS_TO_RUN+=('./scripts/circleci/test_print_warnings.sh')
35 COMMANDS_TO_RUN+=('./scripts/circleci/track_stats.sh')
36 fi
37
scripts/circleci/test_print_warnings.sh new
+7
@@ -0,0 +1,7 @@
1 +#!/bin/bash
2 +
3 +set -e
4 +
5 +WARNINGS=$(node scripts/print-warnings/print-warnings.js)
6 +echo "$WARNINGS"
7 +test ! -z "$WARNINGS"
scripts/error-codes/dev-expression-with-codes.js
+1 -1
@@ -8,7 +8,7 @@
8 */
9 'use strict';
10
11 -var evalToString = require('./evalToString');
11 +var evalToString = require('../shared/evalToString');
12 var existingErrorMap = require('./codes.json');
13 var invertObject = require('./invertObject');
14
scripts/error-codes/extract-errors.js
+1 -1
@@ -12,7 +12,7 @@ const babylon = require('babylon');
12 const fs = require('fs');
13 const path = require('path');
14 const traverse = require('babel-traverse').default;
15 -const evalToString = require('./evalToString');
15 +const evalToString = require('../shared/evalToString');
16 const invertObject = require('./invertObject');
17
18 const babylonOptions = {
scripts/fiber/tests-passing.txt
+5 -5
@@ -31,17 +31,17 @@ scripts/error-codes/__tests__/dev-expression-with-codes-test.js
31 * should warn in non-test envs if the error message cannot be found
32 * should not warn in test env if the error message cannot be found
33
34 -scripts/error-codes/__tests__/evalToString-test.js
35 -* should support StringLiteral
36 -* should support string concat (`+`)
37 -* should throw when it finds other types
38 -
34 scripts/error-codes/__tests__/invertObject-test.js
35 * should return an empty object for an empty input
36 * should invert key-values
37 * should take the last value when there're duplications in vals
38 * should preserve the original order
39
40 +scripts/shared/__tests__/evalToString-test.js
41 +* should support StringLiteral
42 +* should support string concat (`+`)
43 +* should throw when it finds other types
44 +
45 src/isomorphic/__tests__/React-test.js
46 * should log a deprecation warning once when using React.createMixin
47
scripts/print-warnings/README.md new
+1
@@ -0,0 +1 @@
1 +We use this script to extract all messages from `warning()` calls. They don't get substituted with anything in the source or the build. We only do this so we can have a copy of these messages in our internal repository and can spot accidental changes to them.
scripts/print-warnings/print-warnings.js renamed
+9 -9
@@ -13,10 +13,9 @@ const fs = require('fs');
13 const through = require('through2');
14 const traverse = require('babel-traverse').default;
15 const gs = require('glob-stream');
16 +const Bundles = require('../rollup/bundles');
17
17 -const evalToString = require('./evalToString');
18 -
19 -const paths = require('../../gulpfile').paths;
18 +const evalToString = require('../shared/evalToString');
19
20 const babylonOptions = {
21 sourceType: 'module',
@@ -62,12 +61,13 @@ function transform(file, enc, cb) {
61 });
62 }
63
65 -const sourcePaths = [].concat(
66 - paths.react.src,
67 - paths.reactDOM.src,
68 - paths.reactNative.src,
69 - paths.reactTestRenderer.src
70 -);
64 +const sourcePaths = Bundles.bundles
65 + .filter(
66 + bundle =>
67 + bundle.bundleTypes.indexOf(Bundles.bundleTypes.FB_DEV) !== -1 ||
68 + bundle.bundleTypes.indexOf(Bundles.bundleTypes.FB_PROD) !== -1
69 + )
70 + .reduce((allPaths, bundle) => [...allPaths, ...bundle.paths], []);
71
72 gs(sourcePaths).pipe(
73 through.obj(transform, cb => {
scripts/rollup/bundles.js
-1
@@ -54,7 +54,6 @@ const bundles = [
54 name: 'react',
55 paths: [
56 'src/umd/ReactUMDEntry.js',
57 - 'src/umd/ReactWithAddonsUMDEntry.js',
57 'src/umd/shims/**/*.js',
58
59 'src/isomorphic/**/*.js',
scripts/shared/__tests__/evalToString-test.js renamed
scripts/shared/evalToString.js renamed