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
Paul O’Shannessy committed
Sep 24, 2013 at 12:55 UTC
2e6092b2171cf8f7ecdc2993a4f6f5e6ebc7becb
4 files changed
+63
-10
Gruntfile.js
+4
-2
@@ -68,9 +68,10 @@ module.exports = function(grunt) {
68
});
69
70
grunt.registerTask('build:basic', ['jsx:debug', 'version-check', 'browserify:basic']);
71
+ grunt.registerTask('build:addons', ['jsx:debug', 'browserify:addons']);
72
grunt.registerTask('build:transformer', ['jsx:debug', 'browserify:transformer']);
72
- grunt.registerTask('build:transitions', ['jsx:debug', 'browserify:transitions']);
73
grunt.registerTask('build:min', ['jsx:release', 'version-check', 'browserify:min']);
74
+ grunt.registerTask('build:addons-min', ['jsx:debug', 'browserify:addonsMin']);
75
grunt.registerTask('build:test', [
76
'jsx:jasmine',
77
'jsx:test',
@@ -89,9 +90,10 @@ module.exports = function(grunt) {
90
'version-check',
91
'browserify:basic',
92
'browserify:transformer',
92
- 'browserify:transitions',
93
+ 'browserify:addons',
94
'jsx:release',
95
'browserify:min',
96
+ 'browserify:addonsMin',
97
'copy:react_docs',
98
'compare_size'
99
]);
grunt/config/browserify.js
+17
-7
@@ -37,14 +37,16 @@ function minify(src) {
37
// TODO: move this out to another build step maybe.
38
function bannerify(src) {
39
var version = grunt.config.data.pkg.version;
40
- return LICENSE_TEMPLATE.replace('@PACKAGE@', this.data.standalone)
40
+ var packageName = this.data.packageName || this.data.standalone;
41
+ return LICENSE_TEMPLATE.replace('@PACKAGE@', packageName)
42
.replace('@VERSION@', version) +
43
'\n' + src;
44
}
45
46
function simpleBannerify(src) {
47
var version = grunt.config.data.pkg.version;
47
- return SIMPLE_TEMPLATE.replace('@PACKAGE@', this.data.standalone)
48
+ var packageName = this.data.packageName || this.data.standalone;
49
+ return SIMPLE_TEMPLATE.replace('@PACKAGE@', packageName)
50
.replace('@VERSION@', version) +
51
'\n' + src;
52
}
@@ -76,19 +78,27 @@ var transformer = {
78
after: [simpleBannerify]
79
};
80
79
-var transitions = {
81
+var addons = {
82
entries: [
81
- './build/modules/ReactTransitionGroup.js'
83
+ './build/modules/ReactWithAddons.js'
84
],
83
- outfile: './build/react-transitiongroup.js',
85
+ outfile: './build/react-with-addons.js',
86
debug: false,
85
- standalone: 'ReactTransitionGroup',
87
+ standalone: 'React',
88
+ packageName: 'React (with addons)',
89
after: [simpleBannerify]
90
};
91
92
+var addonsMin = grunt.util._.merge({}, addons, {
93
+ outfile: './build/react-with-addons.min.js',
94
+ debug: false,
95
+ after: [minify, bannerify]
96
+});
97
+
98
module.exports = {
99
basic: basic,
100
min: min,
101
transformer: transformer,
93
- transitions: transitions
102
+ addons: addons,
103
+ addonsMin: addonsMin
104
};
grunt/config/jsx/jsx.js
+1
-1
@@ -4,7 +4,7 @@ var grunt = require('grunt');
4
5
var rootIDs = [
6
"React",
7
- "ReactTransitionGroup"
7
+ "ReactWithAddons"
8
];
9
10
var getDebugConfig = function() {
src/ReactWithAddons.js
new
+41
@@ -0,0 +1,41 @@
1
+/**
2
+ * Copyright 2013 Facebook, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * @providesModule ReactWithAddons
17
+ */
18
+
19
+/**
20
+ * This module exists purely in the open source project, and is meant as a way
21
+ * to create a separate standalone build of React. This build has "addons", or
22
+ * functionality we've built and think might be useful but doesn't have a good
23
+ * place to live inside React core.
24
+ */
25
+
26
+"use strict";
27
+
28
+var LinkedStateMixin = require('LinkedStateMixin');
29
+var React = require('React');
30
+var ReactTransitionGroup = require('ReactTransitionGroup');
31
+
32
+var cx = require('cx');
33
+
34
+React.addons = {
35
+ classSet: cx,
36
+ LinkedStateMixin: LinkedStateMixin,
37
+ TransitionGroup: ReactTransitionGroup
38
+};
39
+
40
+module.exports = React;
41
+