mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
This reworks a few things in building and distributing React. The biggest change is using fbjs to share dependencies with other libraries. We're also using Gulp for some build steps.
57 lines
1.3 KiB
JavaScript
57 lines
1.3 KiB
JavaScript
/**
|
|
* Copyright 2013-2015, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* 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.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
var gulp = require('gulp');
|
|
var babel = require('gulp-babel');
|
|
var flatten = require('gulp-flatten');
|
|
var del = require('del');
|
|
|
|
var babelPluginDEV = require('fbjs/scripts/babel/dev-expression');
|
|
var babelPluginRequires = require('fbjs/scripts/babel/rewrite-requires');
|
|
|
|
var paths = {
|
|
react: {
|
|
src: [
|
|
'src/**/*.js',
|
|
'!src/**/__tests__/**/*.js',
|
|
'!src/**/__mocks__/**/*.js',
|
|
],
|
|
lib: 'build/modules',
|
|
},
|
|
};
|
|
|
|
var babelOpts = {
|
|
nonStandard: true,
|
|
blacklist: [
|
|
'spec.functionName',
|
|
],
|
|
optional: [
|
|
'es7.trailingFunctionCommas',
|
|
],
|
|
plugins: [babelPluginDEV, babelPluginRequires],
|
|
ignore: ['third_party'],
|
|
_moduleMap: require('fbjs/module-map'),
|
|
};
|
|
|
|
gulp.task('react:clean', function(cb) {
|
|
del([paths.react.lib], cb);
|
|
});
|
|
|
|
gulp.task('react:modules', function() {
|
|
return gulp
|
|
.src(paths.react.src)
|
|
.pipe(babel(babelOpts))
|
|
.pipe(flatten())
|
|
.pipe(gulp.dest(paths.react.lib));
|
|
});
|
|
|
|
gulp.task('default', ['react:modules']);
|