forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
57 lines (49 loc) · 1.31 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
* Copyright 2013-present, 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 babelPluginModules = require('fbjs-scripts/babel/rewrite-modules');
var paths = {
react: {
src: [
'src/**/*.js',
'!src/**/__tests__/**/*.js',
'!src/**/__mocks__/**/*.js',
'!src/shared/vendor/**/*.js',
],
lib: 'build/modules',
},
};
var babelOpts = {
nonStandard: true,
blacklist: [
'spec.functionName',
],
optional: [
'es7.trailingFunctionCommas',
],
plugins: [babelPluginDEV, babelPluginModules],
ignore: ['third_party'],
_moduleMap: require('fbjs/module-map'),
};
gulp.task('react:clean', function() {
return del([paths.react.lib]);
});
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']);