Hard code version instead of doing constant replacement
This isn't really ideal, but it makes it so that people managing to build with @providesModule still get a consistent experience (since this is what gets packed client-side with react-page-middleware anyway).
Paul O’Shannessy committed
Sep 11, 2013 at 09:51 UTC
5ab68d9a0ddbb6c6c96895b75207d6ad57dc55b4
2 files changed
+17
-3
Gruntfile.js
+16
-2
@@ -52,13 +52,26 @@ module.exports = function(grunt) {
52
53
grunt.registerMultiTask('npm', npmTask);
54
55
- grunt.registerTask('build:basic', ['jsx:debug', 'browserify:basic']);
55
+ // Check that the version we're exporting is the same one we expect in the
56
+ // package. This is not an ideal way to do this, but makes sure that we keep
57
+ // them in sync.
58
+ grunt.registerTask('version-check', function() {
59
+ var version = require('./build/modules/React').version;
60
+ var expectedVersion = grunt.config.data.pkg.version;
61
+ if (version !== expectedVersion) {
62
+ grunt.log.error('Versions do not match. Expected %s, saw %s', expectedVersion, version);
63
+ return false;
64
+ }
65
+ });
66
+
67
+ grunt.registerTask('build:basic', ['jsx:debug', 'version-check', 'browserify:basic']);
68
grunt.registerTask('build:transformer', ['jsx:debug', 'browserify:transformer']);
69
grunt.registerTask('build:transitions', ['jsx:debug', 'browserify:transitions']);
58
- grunt.registerTask('build:min', ['jsx:release', 'browserify:min']);
70
+ grunt.registerTask('build:min', ['jsx:release', 'version-check', 'browserify:min']);
71
grunt.registerTask('build:test', [
72
'jsx:jasmine',
73
'jsx:test',
74
+ 'version-check',
75
'populist:jasmine',
76
'populist:test'
77
]);
@@ -70,6 +83,7 @@ module.exports = function(grunt) {
83
// in order so we can take advantage of that and only run jsx:debug once.
84
grunt.registerTask('build', [
85
'jsx:debug',
86
+ 'version-check',
87
'browserify:basic',
88
'browserify:transformer',
89
'browserify:transitions',
src/core/React.js
+1
-1
@@ -52,6 +52,6 @@ var React = {
52
53
// Version exists only in the open-source version of React, not in Facebook's
54
// internal version.
55
-React.version = __VERSION__;
55
+React.version = '0.5.0-alpha';
56
57
module.exports = React;