react-with-addons build

This creates a new standalone build which should have everything the
default build has, plus a little extra. This is not a sustainable long
term solution (we shouldn't make people choose like this) but it fixes
the problem we have in the short term.

This also removes the terrible react-transitions build. This is better
anway.

Fixes #369
This commit is contained in:
Paul O’Shannessy
2013-10-08 16:49:11 -07:00
parent f658c32df1
commit 2e6092b217
4 changed files with 63 additions and 10 deletions
+4 -2
View File
@@ -68,9 +68,10 @@ module.exports = function(grunt) {
});
grunt.registerTask('build:basic', ['jsx:debug', 'version-check', 'browserify:basic']);
grunt.registerTask('build:addons', ['jsx:debug', 'browserify:addons']);
grunt.registerTask('build:transformer', ['jsx:debug', 'browserify:transformer']);
grunt.registerTask('build:transitions', ['jsx:debug', 'browserify:transitions']);
grunt.registerTask('build:min', ['jsx:release', 'version-check', 'browserify:min']);
grunt.registerTask('build:addons-min', ['jsx:debug', 'browserify:addonsMin']);
grunt.registerTask('build:test', [
'jsx:jasmine',
'jsx:test',
@@ -89,9 +90,10 @@ module.exports = function(grunt) {
'version-check',
'browserify:basic',
'browserify:transformer',
'browserify:transitions',
'browserify:addons',
'jsx:release',
'browserify:min',
'browserify:addonsMin',
'copy:react_docs',
'compare_size'
]);
+17 -7
View File
@@ -37,14 +37,16 @@ function minify(src) {
// TODO: move this out to another build step maybe.
function bannerify(src) {
var version = grunt.config.data.pkg.version;
return LICENSE_TEMPLATE.replace('@PACKAGE@', this.data.standalone)
var packageName = this.data.packageName || this.data.standalone;
return LICENSE_TEMPLATE.replace('@PACKAGE@', packageName)
.replace('@VERSION@', version) +
'\n' + src;
}
function simpleBannerify(src) {
var version = grunt.config.data.pkg.version;
return SIMPLE_TEMPLATE.replace('@PACKAGE@', this.data.standalone)
var packageName = this.data.packageName || this.data.standalone;
return SIMPLE_TEMPLATE.replace('@PACKAGE@', packageName)
.replace('@VERSION@', version) +
'\n' + src;
}
@@ -76,19 +78,27 @@ var transformer = {
after: [simpleBannerify]
};
var transitions = {
var addons = {
entries: [
'./build/modules/ReactTransitionGroup.js'
'./build/modules/ReactWithAddons.js'
],
outfile: './build/react-transitiongroup.js',
outfile: './build/react-with-addons.js',
debug: false,
standalone: 'ReactTransitionGroup',
standalone: 'React',
packageName: 'React (with addons)',
after: [simpleBannerify]
};
var addonsMin = grunt.util._.merge({}, addons, {
outfile: './build/react-with-addons.min.js',
debug: false,
after: [minify, bannerify]
});
module.exports = {
basic: basic,
min: min,
transformer: transformer,
transitions: transitions
addons: addons,
addonsMin: addonsMin
};
+1 -1
View File
@@ -4,7 +4,7 @@ var grunt = require('grunt');
var rootIDs = [
"React",
"ReactTransitionGroup"
"ReactWithAddons"
];
var getDebugConfig = function() {
+41
View File
@@ -0,0 +1,41 @@
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactWithAddons
*/
/**
* This module exists purely in the open source project, and is meant as a way
* to create a separate standalone build of React. This build has "addons", or
* functionality we've built and think might be useful but doesn't have a good
* place to live inside React core.
*/
"use strict";
var LinkedStateMixin = require('LinkedStateMixin');
var React = require('React');
var ReactTransitionGroup = require('ReactTransitionGroup');
var cx = require('cx');
React.addons = {
classSet: cx,
LinkedStateMixin: LinkedStateMixin,
TransitionGroup: ReactTransitionGroup
};
module.exports = React;