find-babel-config
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.2.0"></a> | ||
# [1.2.0](https://github.com/tleunen/find-babel-config/compare/v1.1.0...v1.2.0) (2019-03-04) | ||
### Features | ||
* Add support for babel.config.js ([#32](https://github.com/tleunen/find-babel-config/issues/32)) ([593aa1c](https://github.com/tleunen/find-babel-config/commit/593aa1c)) | ||
<a name="1.1.0"></a> | ||
@@ -7,0 +17,0 @@ # [1.1.0](https://github.com/tleunen/find-babel-config/compare/v1.0.1...v1.1.0) (2017-05-08) |
@@ -11,2 +11,3 @@ 'use strict'; | ||
var BABELRC_JS_FILENAME = '.babelrc.js'; | ||
var BABEL_CONFIG_JS_FILENAME = 'babel.config.js'; | ||
var PACKAGE_FILENAME = 'package.json'; | ||
@@ -19,2 +20,7 @@ | ||
var configModule = require(file); | ||
if (typeof configModule === 'function') { | ||
return configModule(); | ||
} | ||
// eslint-disable-next-line no-underscore-dangle | ||
@@ -76,2 +82,16 @@ return configModule && configModule.__esModule ? configModule.default : configModule; | ||
if (!exists) { | ||
var babelConfigJSrc = path.join(dir, BABEL_CONFIG_JS_FILENAME); | ||
return pathExists(babelConfigJSrc).then(function (ex) { | ||
if (ex) { | ||
var config = getBabelJsConfig(babelConfigJSrc); | ||
resolve({ | ||
file: babelConfigJSrc, | ||
config | ||
}); | ||
} | ||
}); | ||
} | ||
return exists; | ||
}).then(function (exists) { | ||
if (!exists) { | ||
var nextDir = path.dirname(dir); | ||
@@ -133,2 +153,11 @@ if (nextDir === dir) { | ||
var babelConfigJSrc = path.join(dir, BABEL_CONFIG_JS_FILENAME); | ||
if (pathExists.sync(babelConfigJSrc)) { | ||
var _config = getBabelJsConfig(babelConfigJSrc); | ||
return { | ||
file: babelConfigJSrc, | ||
config: _config | ||
}; | ||
} | ||
var packageFile = path.join(dir, PACKAGE_FILENAME); | ||
@@ -135,0 +164,0 @@ if (pathExists.sync(packageFile)) { |
{ | ||
"name": "find-babel-config", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"main": "lib/index.js", | ||
@@ -39,5 +39,5 @@ "description": "Find the closest babel config based on a directory", | ||
"pretest": "npm run lint", | ||
"test": "jest --coverage", | ||
"test:coverage": "jest --coverage", | ||
"test:watch": "jest --watch", | ||
"test:suite": "jest", | ||
"test": "jest", | ||
"compile": "babel src --out-dir lib", | ||
@@ -44,0 +44,0 @@ "prepublish": "npm run compile", |
13828
156
8