add transformers to bin/6to5 help output, add descriptions tn whitelist and blacklist arguments

This commit is contained in:
Sebastian McKenzie 2014-10-15 11:45:28 +11:00
parent 32e3948b34
commit 4017a02756
2 changed files with 17 additions and 7 deletions

View File

@ -146,13 +146,12 @@ to5.transformFile("filename.js", options, function (err, result) {
// Default: "unknown"
filename: "filename",
// List of transformers to EXCLUDE
// This is a camelised version of the name found in `features`
// eg. "Arrow functions" is "arrowFunctions"
// List of transformers to EXCLUDE.
// Run `6to5 --help` to see a full list of transformers.
blacklist: [],
// List of transformers to ONLY use.
// See `blacklist` for naming scheme.
// Run `6to5 --help` to see a full list of transformers.
whitelist: [],
// If truthy, adds a `map` property to returned output.

View File

@ -2,8 +2,9 @@
var commander = require("commander");
var sourceMap = require("source-map");
var mkdirp = require("mkdirp");
var transform = require("../../lib/6to5/transform");
var chokidar = require("chokidar");
var mkdirp = require("mkdirp");
var path = require("path");
var fs = require("fs");
var _ = require("lodash");
@ -17,11 +18,21 @@ var list = function (val) {
return val ? val.split(",") : [];
};
commander.option("-w, --whitelist [whitelist]", "Whitelist", list);
commander.option("-b, --blacklist [blacklist]", "Blacklist", list);
commander.option("-w, --whitelist [whitelist]", "Whitelist of transformers to ONLY use", list);
commander.option("-b, --blacklist [blacklist]", "Blacklist of transformers to NOT use", list);
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");
commander.on("--help", function(){
console.log(" Transformers:");
console.log();
_.each(_.keys(transform.transformers).sort(), function (key) {
if (key[0] === "_") return;
console.log(" - " + key);
});
console.log();
});
var pkg = require("../../package.json");
commander.version(pkg.version);
commander.usage("[options] <files ...>");