load-code
TypeScript icon, indicating that this package has built-in type declarations

2.1.1 • Public • Published

introduce

读取文件配置

install

npm i load-code

use

读取文件优先级test.config.ts->test.config.js->test.config.cjs->test.config.js->test.config.mjs->test.config.json->package.json的test字段

import { loadConfig } from 'load-code'

// 传配置名,基于配置名,读取配置
const configData = await loadConfig('test')
function loadConfig<T = any>(cli: string, cwd?: string): Promise<{
  path?: string // 配置文件路径
  data?: T // 配置数据
}>

Readme

Keywords

none

Package Sidebar

Install

npm i load-code

Weekly Downloads

10

Version

2.1.1

License

MIT

Unpacked Size

75.8 kB

Total Files

35

Last publish

Collaborators

  • abmao