-
Notifications
You must be signed in to change notification settings - Fork 45.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move vendor to fbjs package #4167
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// We run our own grunt task instead of using grunt-jest so that we can have | ||
// more control. Specifically we want to set NODE_ENV and make sure stdio is | ||
// inherited. We also run with --harmony directly so that we don't have to | ||
// respawn immediately. We should be able to reduce some of this complexity | ||
// when jest 0.5 is run on top of iojs. | ||
|
||
'use strict'; | ||
|
||
var grunt = require('grunt'); | ||
var path = require('path'); | ||
|
||
module.exports = function() { | ||
var done = this.async(); | ||
grunt.log.writeln('running jest (this may take a while)'); | ||
grunt.util.spawn({ | ||
cmd: 'node', | ||
args: ['--harmony', path.join('node_modules', 'jest-cli', 'bin', 'jest')], | ||
opts: {stdio: 'inherit', env: {NODE_ENV: 'test'}}, | ||
}, function(err, result, code) { | ||
if (err) { | ||
grunt.log.error('jest failed'); | ||
grunt.log.error(err); | ||
} else { | ||
grunt.log.ok('jest passed'); | ||
} | ||
grunt.log.writeln(result.stdout); | ||
|
||
done(code === 0); | ||
}); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* 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)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this cache somehow? Seems to take ~3s on my computer which feels weirdly fast. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so. My |
||
.pipe(flatten()) | ||
.pipe(gulp.dest(paths.react.lib)); | ||
}); | ||
|
||
gulp.task('default', ['react:modules']); |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be in a .babelrc file (which gulp-babel reads). You might be able to better share the configuration between this and jest that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Way ahead of you. There are reasons it's not and we'll work them out.