diff --git a/package.json b/package.json index d62a325c60..c8ee3166d9 100644 --- a/package.json +++ b/package.json @@ -109,7 +109,8 @@ "jest": { "modulePathIgnorePatterns": [ "/.module-cache/", - "/react/build/" + "/react/build/", + "/react/scripts/rollup/shims/" ], "rootDir": "", "transform": { @@ -130,7 +131,7 @@ "roots": [ "/eslint-rules", "/mocks", - "/scripts/error-codes", + "/scripts", "/src", "node_modules/fbjs" ], diff --git a/scripts/circleci/test_entry_point.sh b/scripts/circleci/test_entry_point.sh index 2a4cbdf665..85a26c3761 100755 --- a/scripts/circleci/test_entry_point.sh +++ b/scripts/circleci/test_entry_point.sh @@ -31,6 +31,7 @@ if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then COMMANDS_TO_RUN+=('node ./scripts/tasks/flow') COMMANDS_TO_RUN+=('node ./scripts/tasks/jest') COMMANDS_TO_RUN+=('./scripts/circleci/build.sh') + COMMANDS_TO_RUN+=('./scripts/circleci/test_print_warnings.sh') COMMANDS_TO_RUN+=('./scripts/circleci/track_stats.sh') fi diff --git a/scripts/circleci/test_print_warnings.sh b/scripts/circleci/test_print_warnings.sh new file mode 100644 index 0000000000..27be0ace0a --- /dev/null +++ b/scripts/circleci/test_print_warnings.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +WARNINGS=$(node scripts/print-warnings/print-warnings.js) +echo "$WARNINGS" +test ! -z "$WARNINGS" diff --git a/scripts/error-codes/dev-expression-with-codes.js b/scripts/error-codes/dev-expression-with-codes.js index 560264878d..f5e359eded 100644 --- a/scripts/error-codes/dev-expression-with-codes.js +++ b/scripts/error-codes/dev-expression-with-codes.js @@ -8,7 +8,7 @@ */ 'use strict'; -var evalToString = require('./evalToString'); +var evalToString = require('../shared/evalToString'); var existingErrorMap = require('./codes.json'); var invertObject = require('./invertObject'); diff --git a/scripts/error-codes/extract-errors.js b/scripts/error-codes/extract-errors.js index 89f7743e07..b437a9cbde 100644 --- a/scripts/error-codes/extract-errors.js +++ b/scripts/error-codes/extract-errors.js @@ -12,7 +12,7 @@ const babylon = require('babylon'); const fs = require('fs'); const path = require('path'); const traverse = require('babel-traverse').default; -const evalToString = require('./evalToString'); +const evalToString = require('../shared/evalToString'); const invertObject = require('./invertObject'); const babylonOptions = { diff --git a/scripts/fiber/tests-passing.txt b/scripts/fiber/tests-passing.txt index a8e34c1158..0c658781d6 100644 --- a/scripts/fiber/tests-passing.txt +++ b/scripts/fiber/tests-passing.txt @@ -31,17 +31,17 @@ scripts/error-codes/__tests__/dev-expression-with-codes-test.js * should warn in non-test envs if the error message cannot be found * should not warn in test env if the error message cannot be found -scripts/error-codes/__tests__/evalToString-test.js -* should support StringLiteral -* should support string concat (`+`) -* should throw when it finds other types - scripts/error-codes/__tests__/invertObject-test.js * should return an empty object for an empty input * should invert key-values * should take the last value when there're duplications in vals * should preserve the original order +scripts/shared/__tests__/evalToString-test.js +* should support StringLiteral +* should support string concat (`+`) +* should throw when it finds other types + src/isomorphic/__tests__/React-test.js * should log a deprecation warning once when using React.createMixin diff --git a/scripts/print-warnings/README.md b/scripts/print-warnings/README.md new file mode 100644 index 0000000000..87cacefec4 --- /dev/null +++ b/scripts/print-warnings/README.md @@ -0,0 +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. diff --git a/scripts/error-codes/print-warnings.js b/scripts/print-warnings/print-warnings.js similarity index 83% rename from scripts/error-codes/print-warnings.js rename to scripts/print-warnings/print-warnings.js index 73ac5e2c1a..b861021450 100644 --- a/scripts/error-codes/print-warnings.js +++ b/scripts/print-warnings/print-warnings.js @@ -13,10 +13,9 @@ const fs = require('fs'); const through = require('through2'); const traverse = require('babel-traverse').default; const gs = require('glob-stream'); +const Bundles = require('../rollup/bundles'); -const evalToString = require('./evalToString'); - -const paths = require('../../gulpfile').paths; +const evalToString = require('../shared/evalToString'); const babylonOptions = { sourceType: 'module', @@ -62,12 +61,13 @@ function transform(file, enc, cb) { }); } -const sourcePaths = [].concat( - paths.react.src, - paths.reactDOM.src, - paths.reactNative.src, - paths.reactTestRenderer.src -); +const sourcePaths = Bundles.bundles + .filter( + bundle => + bundle.bundleTypes.indexOf(Bundles.bundleTypes.FB_DEV) !== -1 || + bundle.bundleTypes.indexOf(Bundles.bundleTypes.FB_PROD) !== -1 + ) + .reduce((allPaths, bundle) => [...allPaths, ...bundle.paths], []); gs(sourcePaths).pipe( through.obj(transform, cb => { diff --git a/scripts/rollup/bundles.js b/scripts/rollup/bundles.js index 6a68b36c3d..a9010f0d0d 100644 --- a/scripts/rollup/bundles.js +++ b/scripts/rollup/bundles.js @@ -54,7 +54,6 @@ const bundles = [ name: 'react', paths: [ 'src/umd/ReactUMDEntry.js', - 'src/umd/ReactWithAddonsUMDEntry.js', 'src/umd/shims/**/*.js', 'src/isomorphic/**/*.js', diff --git a/scripts/error-codes/__tests__/evalToString-test.js b/scripts/shared/__tests__/evalToString-test.js similarity index 100% rename from scripts/error-codes/__tests__/evalToString-test.js rename to scripts/shared/__tests__/evalToString-test.js diff --git a/scripts/error-codes/evalToString.js b/scripts/shared/evalToString.js similarity index 100% rename from scripts/error-codes/evalToString.js rename to scripts/shared/evalToString.js