0.1.0 • Published 2 years ago

@luxass/find-config v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

find-config

Install

npm install @luxass/find-config

Usage

import type { Loader } from "@luxass/find-config";
import { resolveConfig, resolveConfigSync } from "@luxass/find-config";

const cookieLoader: Loader = {
  filter: /\.cookie$/,
  load: async (path) => {
    return {
      name: "cookie from async loader",
    }
  },
  loadSync: (path) => {
    return {
      name: "cookie from sync loader",
    }
  }
}

await resolveConfig({
  files: [
    "package.json",
    "cookie.json",
    "cookie.js",
    "cookie.ts",
    "cookie.cookie",
  ],
  loaders: [
    cookieLoader
  ],
  cwd: process.cwd(),
  name: "cookie", // used as the packageKey for package.json
}) // { name: "cookie from async loader" }

resolveConfigSync({
  files: [
    "package.json",
    "cookie.json",
    "cookie.js",
    "cookie.ts",
    "cookie.cookie",
  ],
  loaders: [
    cookieLoader
  ],
  cwd: process.cwd(),
  name: "cookie", // used as the packageKey for package.json
}) // { name: "cookie from sync loader" }
0.1.0

2 years ago