1.0.9 • Published 5 months ago

@meslzy/config v1.0.9

Weekly downloads
-
License
mit
Repository
github
Last release
5 months ago

Config

Version Downloads Github Sponsors

Astonishing config loader for ts, js files, and package.json or tsconfig.json


Installation

npm install @meslzy/config

Usage

  • Load Config (.ts, .js)
import { loadConfig } from "@meslzy/config";

// load meslzy.ts.config.ts or meslzy.js.config.js

await loadConfig("meslzy", {
  cwd: process.cwd(),
  traversal: "down", // up | down | both
  depth: Infinity, // depth of traversal
  extension: ["ts", "js"],
  suffix: "config", // to add suffix to filename meslzy -> meslzy.config
  external: [], // dependencies to exclude from bundling
  noExternal: [], // dependencies to include in bundling
  modform: (mod) => mod.default, // to get default export
  transform: (config) => config, // to transform returned result from modform
});
  • Load Package.json
import { loadPackageJson } from "@meslzy/config";

await loadPackageJson({
  cwd: process.cwd(),
  traversal: "down", // up | down | both
  depth: Infinity, // depth of traversal
  transform: (packageJson) => packageJson, // to transform returned result from package.json
});
  • Load Tsconfig.json
import { loadTsConfigJson } from "@meslzy/config";

await loadTsConfigJson({
  cwd: process.cwd(),
  traversal: "down", // up | down | both
  depth: Infinity, // depth of traversal
  transform: (tsconfigJson) => tsconfigJson, // to transform returned result from tsconfig.json
});

End

Created with 💗 by Meslzy.

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago