Giter VIP home page Giter VIP logo

find-config-up's Introduction

find-config-up

Powered by Immowelt Build Status Dependency Status devDependency Status Renovate enabled semantic-release

Resolve your packages configuration from a .*rc or package.json file with a given property up the file-tree.

Install

$ yarn add find-config-up

API

Getting started

const findConfigUp = require('find-config-up');

(async function() {
  //
  // Tries to find a `.myfancyrc` up the tree and merges it with the defaults,
  // if no file was found it falls back to resolving a `package.json` up the tree
  // with a `my-fancy-package` property defined.
  //
  // If none of the above was successful, the defaults will be returned.
  //
  const config = await findConfigUp({
    rawConfigFileName: '.myfancyrc',
    packageJsonProperty: 'my-fancy-package',
    defaults: {}
  });

  console.log(config);
})()

Options

rawConfigFileName: string (Optional)

The file name of your preffered .rc file, e.g. .babelrc, which should be resolved up the file-system tree.

packageJsonProperty: string

The property name which should be resolved in the package.json files up the file-system tree.

defaults: Object

The defaults which will be recursively merged with the results from the file-system.

cwd: string (Optional)

A custom current working directory, falls back to process.cwd().

Contributing

See the CONTRIBUTING.md file at the root of the repository.

Licensing

See the LICENSE file at the root of the repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.