From 7082d5a2db5c1e5f49a62aecd90b6858f957da5e Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Fri, 18 Oct 2019 14:36:59 -0700 Subject: [PATCH] Don't build non-experimental www bundles (#17139) Reduces the likelihood we'll accidentally sync the wrong ones. --- scripts/rollup/build.js | 24 ++++++++++++++---------- scripts/rollup/validate/index.js | 11 +++++++---- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/scripts/rollup/build.js b/scripts/rollup/build.js index 34184efab6..7148b52187 100644 --- a/scripts/rollup/build.js +++ b/scripts/rollup/build.js @@ -25,6 +25,8 @@ const {asyncCopyTo, asyncRimRaf} = require('./utils'); const codeFrame = require('babel-code-frame'); const Wrappers = require('./wrappers'); +const __EXPERIMENTAL__ = process.env.RELEASE_CHANNEL === 'experimental'; + // Errors in promises should be fatal. let loggedErrors = new Set(); process.on('unhandledRejection', err => { @@ -304,8 +306,7 @@ function getPlugins( bundleType, globalName, moduleType, - pureExternalModules, - isExperimentalBuild + pureExternalModules ) { const findAndRecordErrorCodes = extractErrorCodes(errorCodeOpts); const forks = Modules.getForks(bundleType, entry, moduleType); @@ -363,7 +364,7 @@ function getPlugins( __PROFILE__: isProfiling || !isProduction ? 'true' : 'false', __UMD__: isUMDBundle ? 'true' : 'false', 'process.env.NODE_ENV': isProduction ? "'production'" : "'development'", - __EXPERIMENTAL__: isExperimentalBuild, + __EXPERIMENTAL__, }), // We still need CommonJS for external deps like object-assign. commonjs(), @@ -487,8 +488,6 @@ async function createBundle(bundle, bundleType) { module => !importSideEffects[module] ); - const isExperimentalBuild = process.env.RELEASE_CHANNEL === 'experimental'; - const rollupConfig = { input: resolvedEntry, treeshake: { @@ -512,8 +511,7 @@ async function createBundle(bundle, bundleType) { bundleType, bundle.global, bundle.moduleType, - pureExternalModules, - isExperimentalBuild + pureExternalModules ), // We can't use getters in www. legacy: @@ -656,9 +654,6 @@ async function buildEverything() { [bundle, NODE_DEV], [bundle, NODE_PROD], [bundle, NODE_PROFILING], - [bundle, FB_WWW_DEV], - [bundle, FB_WWW_PROD], - [bundle, FB_WWW_PROFILING], [bundle, RN_OSS_DEV], [bundle, RN_OSS_PROD], [bundle, RN_OSS_PROFILING], @@ -666,6 +661,15 @@ async function buildEverything() { [bundle, RN_FB_PROD], [bundle, RN_FB_PROFILING] ); + + if (__EXPERIMENTAL__) { + // www uses experimental builds only. + bundles.push( + [bundle, FB_WWW_DEV], + [bundle, FB_WWW_PROD], + [bundle, FB_WWW_PROFILING] + ); + } } if (!shouldExtractErrors && process.env.CIRCLE_NODE_TOTAL) { diff --git a/scripts/rollup/validate/index.js b/scripts/rollup/validate/index.js index 2e7ce76bc0..364c7f26c3 100644 --- a/scripts/rollup/validate/index.js +++ b/scripts/rollup/validate/index.js @@ -54,10 +54,6 @@ function checkFilesExist(bundle) { } const bundles = [ - { - format: 'fb', - filePatterns: [`./build/facebook-www/*.js`], - }, { format: 'rn', filePatterns: [`./build/react-native/implementations/*.js`], @@ -75,4 +71,11 @@ const bundles = [ }, ]; +if (process.env.RELEASE_CHANNEL === 'experimental') { + bundles.push({ + format: 'fb', + filePatterns: [`./build/facebook-www/*.js`], + }); +} + bundles.map(checkFilesExist).map(lint);