find-babel-config
Find the closest babel config based on a directory
Last updated 7 months ago by tleunen .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install find-babel-config 
SYNC missed versions from official npm registry.

find-babel-config

npm Build Status Coverage Status

Helper function to retrieve the closest Babel configuration from a specific directory.

Installation

npm install --save find-babel-config

Usage

Async

// directory can be an absolute or relative path
// If it's a relative path, it is relative to the current working directory (process.cwd())
const directory = 'src';
findBabelConfig(directory).then(({ file, config }) => {
    if (file) {
        // file is the file in which the config is found
        console.log(file);
        // config is a JS plain object with the babel config
        console.log(config);
    }
});

Sync

// directory can be an absolute or relative path
// If it's a relative path, it is relative to the current working directory (process.cwd())
const directory = 'src';
const { file, config } = findBabelConfig.sync(directory);
// if c === null, the config wasn't found
if (file) {
    // file is the file in which the config is found
    console.log(file);
    // config is a JS plain object with the babel config
    console.log(config);
}

A second parameter can be given to findBabelConfig, it specifies the depth of search. By default, this value is Infinity but you can set the value you want: findBabelConfig('src', 10).

License

MIT, see LICENSE.md for details.

Current Tags

  • 2.1.2                                ...           latest (2 months ago)
  • 1.2.2                                ...           previous (7 months ago)

12 Versions

  • 2.1.2                                ...           2 months ago
  • 1.2.2                                ...           7 months ago
  • 2.1.1                                ...           7 months ago
  • 2.1.0                                ...           7 months ago
  • 1.2.1                                ...           7 months ago
  • 2.0.0                                ...           2 years ago
  • 1.2.0                                ...           6 years ago
  • 1.1.0                                ...           8 years ago
  • 1.0.1                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
  • 0.1.1                                ...           8 years ago
  • 0.1.0                                ...           8 years ago
Maintainers (1)
Downloads
Total 7
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (8)

© 2010 - cnpmjs.org x YWFE | Home | YWFE