mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
18ef8962f1
If you are using bin/jsx independently, you may need to pass --follow-requires to it if you rely on its dependency scanning. Dependency scanning is still a good idea, but it's difficult to make it work perfectly for everyone the first time they try bin/jsx. Closes #131.
44 lines
878 B
JavaScript
44 lines
878 B
JavaScript
'use strict';
|
|
|
|
var grunt = require("grunt");
|
|
var expand = grunt.file.expand;
|
|
var spawn = grunt.util.spawn;
|
|
|
|
module.exports = function() {
|
|
var done = this.async();
|
|
var config = this.data;
|
|
|
|
var args = [
|
|
"--cache-dir", ".module-cache",
|
|
"--relativize",
|
|
"--follow-requires",
|
|
config.sourceDir,
|
|
config.outputDir
|
|
];
|
|
|
|
var rootIDs = expand({
|
|
nonull: true, // Keep IDs that don't expand to anything.
|
|
cwd: "src"
|
|
}, config.rootIDs).map(function(id) {
|
|
return id.replace(/\.js$/i, "");
|
|
});
|
|
|
|
args.push.apply(args, rootIDs);
|
|
args.push("--config", config.configFile);
|
|
|
|
var child = spawn({
|
|
cmd: "bin/jsx",
|
|
args: args
|
|
}, function(error, result, code) {
|
|
if (error) {
|
|
grunt.log.error(error);
|
|
done(false);
|
|
} else {
|
|
done();
|
|
}
|
|
});
|
|
|
|
child.stdout.pipe(process.stdout);
|
|
child.stderr.pipe(process.stderr);
|
|
};
|