2015-07-18 09:20:38 +08:00
|
|
|
/**
|
2015-12-30 03:20:32 +08:00
|
|
|
* Copyright 2013-present, Facebook, Inc.
|
2015-07-18 09:20:38 +08:00
|
|
|
* 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');
|
|
|
|
|
|
2016-02-27 08:49:32 +08:00
|
|
|
var babelPluginModules = require('fbjs-scripts/babel-6/rewrite-modules');
|
2015-07-18 09:20:38 +08:00
|
|
|
|
|
|
|
|
var paths = {
|
|
|
|
|
react: {
|
|
|
|
|
src: [
|
|
|
|
|
'src/**/*.js',
|
|
|
|
|
'!src/**/__tests__/**/*.js',
|
|
|
|
|
'!src/**/__mocks__/**/*.js',
|
2015-12-17 10:08:26 +08:00
|
|
|
'!src/shared/vendor/**/*.js',
|
2015-07-18 09:20:38 +08:00
|
|
|
],
|
|
|
|
|
lib: 'build/modules',
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var babelOpts = {
|
2016-02-27 08:49:32 +08:00
|
|
|
plugins: [
|
|
|
|
|
[babelPluginModules, { map: require('fbjs/module-map') }],
|
2015-07-18 09:20:38 +08:00
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
|
2015-11-12 21:02:45 +08:00
|
|
|
gulp.task('react:clean', function() {
|
|
|
|
|
return del([paths.react.lib]);
|
2015-07-18 09:20:38 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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']);
|