babel-compile
Advanced tools
Comparing version 1.0.2 to 2.0.0
@@ -17,19 +17,11 @@ #!/usr/bin/env node | ||
var config = {}; | ||
function addConfig(cfg) { | ||
var module; | ||
var config = { | ||
presets: [], | ||
babelrc: false, | ||
}; | ||
try { | ||
module = require(cfg); | ||
} catch (err) { | ||
try { | ||
module = require(path.join(process.cwd(), cfg)); | ||
} catch (err2) { | ||
console.error('Configuration file or module cannot be resolved: ' + cfg); | ||
process.exit(1); | ||
} | ||
} | ||
console.log('Loading configuration from: ' + cfg); | ||
_.merge(config, module); | ||
function addConfig(preset) { | ||
preset = 'babel-preset-' + preset; | ||
console.log('Adding preset: ' + preset); | ||
config.presets.push(preset); | ||
} | ||
@@ -39,5 +31,4 @@ | ||
.version(pkgjson.version) | ||
.option('-c, --config-module [modulename]', | ||
'node module which exports a bable configuration object.' + | ||
' This value is require()\'d and used verbatim.', addConfig, []) | ||
.option('-p, --preset [modulename]', | ||
'Specifies which babel-preset to use', addConfig, []) | ||
.parse(process.argv); | ||
@@ -44,0 +35,0 @@ |
{ | ||
"name": "babel-compile", | ||
"version": "1.0.2", | ||
"version": "2.0.0", | ||
"description": "A script to compile .js and .jsx to es6 with Babel using babel-core, that actually works!", | ||
"main": "lib/compile.js", | ||
"scripts": { | ||
"test": "node ./lib/cli.js sample-in:sample-out" | ||
"installTestPreset": "test ! -d ./node_modules/babel-preset-es2015 && npm install babel-preset-es2015 || true", | ||
"test": "npm run installTestPreset && node ./lib/cli.js -p es2015 sample-in:sample-out" | ||
}, | ||
@@ -24,9 +25,9 @@ "bin": { | ||
"dependencies": { | ||
"babel-core": "^6.7.0", | ||
"commander": "^2.8.1", | ||
"fs-walk": "0.0.1", | ||
"lodash": "^3.10.1", | ||
"lodash": "^4.11.1", | ||
"mkdirp": "^0.5.1", | ||
"rimraf": "^2.4.3", | ||
"babel-core": "^6.0.0" | ||
"rimraf": "^2.4.3" | ||
} | ||
} |
@@ -16,6 +16,6 @@ # babel-compile | ||
## Getting started | ||
First, you're going to want to install this package and the taskcluster global configs | ||
First, you're going to want to install this package | ||
``` | ||
npm install babel-compile --save-dev | ||
npm install taskcluster-configs --save-dev | ||
npm install babel-preset-es2015 --save-dev | ||
``` | ||
@@ -32,3 +32,3 @@ Next, you're going to want to add it to your `package.json` file's scripts | ||
"scripts": { | ||
"compile": "babel-compile -c taskcluster-lib-rules/babel src:lib test:.test", | ||
"compile": "babel-compile -p es2015 src:lib test:.test", | ||
"pretest": "npm run compile", | ||
@@ -35,0 +35,0 @@ "prepublish": "npm run compile" |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
2
9303
14
141
- Removedlodash@3.10.1(transitive)
Updatedbabel-core@^6.7.0
Updatedlodash@^4.11.1