Files
react/grunt/tasks/jsx.js
T
Ben Newman 18ef8962f1 Bump Commoner version to disable dependency scanning by default.
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.
2013-07-01 16:50:35 -04:00

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);
};