From f24b5164d4c9118ffe135024f006a2ef02f20640 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sun, 3 May 2015 22:43:20 +0100 Subject: [PATCH] add extensions option to babel cli --- packages/babel-cli/bin/babel/dir.js | 2 +- packages/babel-cli/bin/babel/index.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/babel-cli/bin/babel/dir.js b/packages/babel-cli/bin/babel/dir.js index 6e0e0cd65d..c78a190939 100644 --- a/packages/babel-cli/bin/babel/dir.js +++ b/packages/babel-cli/bin/babel/dir.js @@ -30,7 +30,7 @@ module.exports = function (commander, filenames, opts) { var handleFile = function (src, filename) { if (util.shouldIgnore(src)) return; - if (util.canCompile(filename)) { + if (util.canCompile(filename, commander.extensions)) { write(src, filename); } else if (commander.copyFiles) { outputFileSync(path.join(commander.outDir, filename), fs.readFileSync(src)); diff --git a/packages/babel-cli/bin/babel/index.js b/packages/babel-cli/bin/babel/index.js index 60eb60b59b..eb3622d8f4 100755 --- a/packages/babel-cli/bin/babel/index.js +++ b/packages/babel-cli/bin/babel/index.js @@ -37,6 +37,7 @@ each(options, function (option, key) { commander.option(arg, desc.join(" ")); }) +commander.option("-x, --extensions [extensions]", "List of extensions to compile when a directory has been input [.es6,.js,.es,.jsx]"); commander.option("-w, --watch", "Recompile files on changes"); commander.option("-o, --out-file [out]", "Compile all input files into a single file"); commander.option("-d, --out-dir [out]", "Compile an input directory of modules into an output directory");