Remove TEST env

This commit is contained in:
Dan Abramov
2017-03-29 17:20:23 +01:00
parent 272a6d4cb0
commit 7e7ca633b5
3 changed files with 17 additions and 31 deletions
+7 -11
View File
@@ -60,10 +60,10 @@ function getAliases(paths, bundleType, isRenderer) {
const facebookWWW = 'facebook-www';
// bundle types for shorthand
const { UMD_DEV, UMD_PROD, NODE_DEV, NODE_PROD, FB_DEV, FB_PROD, FB_TEST, RN } = bundleTypes;
const { UMD_DEV, UMD_PROD, NODE_DEV, NODE_PROD, FB_DEV, FB_PROD, RN } = bundleTypes;
function getBanner(bundleType, hasteName) {
if (bundleType === FB_DEV || bundleType === FB_PROD || bundleType === FB_TEST || bundleType === RN) {
if (bundleType === FB_DEV || bundleType === FB_PROD || bundleType === RN) {
let hasteFinalName = hasteName;
switch (bundleType) {
case FB_DEV:
@@ -87,7 +87,7 @@ function getBanner(bundleType, hasteName) {
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ${hasteFinalName}${ bundleType === FB_TEST ? '-test' : '' }
* @providesModule ${hasteFinalName}
*/${bundleType === FB_DEV ? fbDevCode : ''}
`
);
@@ -138,7 +138,7 @@ function handleRollupWarnings(warning) {
function updateBundleConfig(config, filename, format, bundleType, hasteName) {
let dest = config.destDir + filename;
if (bundleType === FB_DEV || bundleType === FB_PROD || bundleType === FB_TEST) {
if (bundleType === FB_DEV || bundleType === FB_PROD) {
dest = `${config.destDir}${facebookWWW}/${filename}`;
} else if (bundleType === UMD_DEV || bundleType === UMD_PROD) {
dest = `${config.destDir}dist/${filename}`;
@@ -170,7 +170,6 @@ function getFormat(bundleType) {
case NODE_PROD:
case FB_DEV:
case FB_PROD:
case FB_TEST:
case RN:
return `cjs`;
}
@@ -192,8 +191,6 @@ function getFilename(name, hasteName, bundleType) {
return `${hasteName}-dev.js`;
case FB_PROD:
return `${hasteName}-prod.js`;
case FB_TEST:
return `${hasteName}-test.js`;
}
}
@@ -334,7 +331,7 @@ function copyBundleIntoNodePackage(packageName, filename, bundleType) {
function createNodePackage(bundleType, packageName, filename) {
// the only case where we don't want to copy the package is for FB bundles
if (bundleType !== FB_DEV && bundleType !== FB_TEST && bundleType !== FB_PROD) {
if (bundleType !== FB_DEV && bundleType !== FB_PROD) {
return copyNodePackageTemplate(packageName).then(
() => copyBundleIntoNodePackage(packageName, filename, bundleType)
);
@@ -362,7 +359,7 @@ function getPlugins(entry, babelOpts, paths, filename, bundleType, isRenderer) {
stripEnvVariables(true)
)
);
} else if (bundleType === UMD_DEV || bundleType === NODE_DEV || bundleType === FB_DEV || bundleType === FB_TEST) {
} else if (bundleType === UMD_DEV || bundleType === NODE_DEV || bundleType === FB_DEV) {
plugins.push(
replace(
stripEnvVariables(false)
@@ -406,7 +403,7 @@ function createBundle({
const filename = getFilename(name, hasteName, bundleType);
const format = getFormat(bundleType);
return rollup({
entry: bundleType === FB_DEV || bundleType === FB_PROD || bundleType === FB_TEST ? fbEntry : entry,
entry: bundleType === FB_DEV || bundleType === FB_PROD ? fbEntry : entry,
external: getExternalModules(externals, bundleType, isRenderer),
onwarn: handleRollupWarnings,
plugins: getPlugins(entry, babelOpts, paths, filename, bundleType, isRenderer),
@@ -441,7 +438,6 @@ rimraf('build', async () => {
await createBundle(bundle, NODE_PROD);
await createBundle(bundle, FB_DEV);
await createBundle(bundle, FB_PROD);
await createBundle(bundle, FB_TEST);
await createBundle(bundle, RN);
}
if (argv.extractErrors) {
+6 -7
View File
@@ -9,11 +9,10 @@ const bundleTypes = {
NODE_PROD: 'NODE_PROD',
FB_DEV: 'FB_DEV',
FB_PROD: 'FB_PROD',
FB_TEST: 'FB_TEST',
RN: 'RN',
};
const { UMD_DEV, UMD_PROD, NODE_DEV, NODE_PROD, FB_DEV, FB_PROD, FB_TEST, RN } = bundleTypes;
const { UMD_DEV, UMD_PROD, NODE_DEV, NODE_PROD, FB_DEV, FB_PROD, RN } = bundleTypes;
const babelOptsReact = {
exclude: 'node_modules/**',
@@ -31,7 +30,7 @@ const bundles = [
/******* Isomorphic *******/
{
babelOpts: babelOptsReact,
bundleTypes: [UMD_DEV, UMD_PROD, NODE_DEV, NODE_PROD, FB_DEV, FB_PROD, FB_TEST],
bundleTypes: [UMD_DEV, UMD_PROD, NODE_DEV, NODE_PROD, FB_DEV, FB_PROD],
config: {
destDir: 'build/',
moduleName: 'React',
@@ -87,7 +86,7 @@ const bundles = [
},
{
babelOpts: babelOptsReact,
bundleTypes: [UMD_DEV, UMD_PROD, NODE_DEV, NODE_PROD, FB_DEV, FB_PROD, FB_TEST],
bundleTypes: [UMD_DEV, UMD_PROD, NODE_DEV, NODE_PROD, FB_DEV, FB_PROD],
config: {
destDir: 'build/',
globals: {
@@ -116,7 +115,7 @@ const bundles = [
{
babelOpts: babelOptsReact,
// TODO: deal with the Node version of react-dom-server package
bundleTypes: [UMD_DEV, UMD_PROD, FB_DEV, FB_PROD, FB_TEST],
bundleTypes: [UMD_DEV, UMD_PROD, FB_DEV, FB_PROD],
config: {
destDir: 'build/',
globals: {
@@ -150,7 +149,7 @@ const bundles = [
babelOpts: babelOptsReactART,
// TODO: we merge react-art repo into this repo so the NODE_DEV and NODE_PROD
// builds sync up to the building of the package directories
bundleTypes: [FB_DEV, FB_PROD, FB_TEST],
bundleTypes: [FB_DEV, FB_PROD],
config: {
destDir: 'build/',
globals: {
@@ -184,7 +183,7 @@ const bundles = [
babelOpts: babelOptsReactART,
// TODO: we merge react-art repo into this repo so the NODE_DEV and NODE_PROD
// builds sync up to the building of the package directories
bundleTypes: [UMD_DEV, UMD_PROD, FB_DEV, FB_PROD, FB_TEST],
bundleTypes: [UMD_DEV, UMD_PROD, FB_DEV, FB_PROD],
config: {
destDir: 'build/',
globals: {
+4 -13
View File
@@ -13,7 +13,7 @@ const exclude = [
];
// bundle types for shorthand
const { UMD_DEV, UMD_PROD, NODE_DEV, NODE_PROD, FB_DEV, FB_PROD, FB_TEST, RN } = bundleTypes;
const { UMD_DEV, UMD_PROD, NODE_DEV, NODE_PROD, FB_DEV, FB_PROD, RN } = bundleTypes;
// these are the FBJS modules that are used throughout our bundles
const fbjsModules = [
@@ -69,7 +69,7 @@ function createModuleMap(paths, extractErrors, bundleType) {
});
// if this is FB, we want to remove ReactCurrentOwner, so we can
// handle it with a different case
if (bundleType === FB_DEV || bundleType === FB_DEV || bundleType === FB_TEST) {
if (bundleType === FB_DEV || bundleType === FB_PROD) {
delete moduleMap.ReactCurrentOwner;
}
return moduleMap;
@@ -89,7 +89,6 @@ function getNodeModules(bundleType) {
case NODE_PROD:
case FB_DEV:
case FB_PROD:
case FB_TEST:
case RN:
return {};
}
@@ -149,7 +148,6 @@ function getExternalModules(externals, bundleType, isRenderer) {
break;
case FB_DEV:
case FB_PROD:
case FB_TEST:
externalModules.push(
...fbjsModules,
'react/lib/ReactCurrentOwner',
@@ -200,7 +198,6 @@ function getFbjsModuleAliases(bundleType) {
case NODE_PROD:
case FB_DEV:
case FB_PROD:
case FB_TEST:
case RN:
// for FB we don't want to bundle the above modules, instead keep them
// as external require() calls in the bundle
@@ -218,7 +215,6 @@ function replaceFbjsModuleAliases(bundleType) {
return {};
case FB_DEV:
case FB_PROD:
case FB_TEST:
// additionally we add mappings for "react"
// so they work correctly on FB, this will change soon
return {
@@ -235,12 +231,8 @@ const shimReactCurrentOwner = resolve('./scripts/rollup/shims/rollup/ReactCurren
const realReactCurrentOwner = resolve('./src/isomorphic/classic/element/ReactCurrentOwner.js');
function getReactCurrentOwnerModuleAlias(bundleType, isRenderer) {
if (bundleType === FB_DEV || bundleType === FB_DEV || bundleType === FB_TEST) {
// In FB bundles, we preserve an inline require to ReactCurrentOwner.
// See the explanation in FB version of ReactCurrentOwner in www.
return {
// 'ReactCurrentOwner': 'react/lib/ReactCurrentOwner',
};
if (bundleType === FB_DEV || bundleType === FB_DEV) {
return {};
}
if (isRenderer) {
return {
@@ -298,7 +290,6 @@ function replaceDevOnlyStubbedModules(bundleType) {
case UMD_DEV:
case NODE_DEV:
case FB_DEV:
case FB_TEST:
case RN:
return {};
case FB_PROD: