本文整理汇总了TypeScript中read-config-file.orNullIfFileNotExist函数的典型用法代码示例。如果您正苦于以下问题:TypeScript orNullIfFileNotExist函数的具体用法?TypeScript orNullIfFileNotExist怎么用?TypeScript orNullIfFileNotExist使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了orNullIfFileNotExist函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: loadEnv
async function loadEnv(envFile: string) {
const data = await orNullIfFileNotExist(readFile(envFile, "utf8"))
if (data == null) {
return null
}
const parsed = parseEnv(data)
for (const key of Object.keys(parsed)) {
if (!process.env.hasOwnProperty(key)) {
process.env[key] = parsed[key]
}
}
require("dotenv-expand")(parsed)
return parsed
}
示例2: Lazy
const packageMetadata = new Lazy(() => orNullIfFileNotExist(readJson(path.join(projectDir, "package.json"))))
示例3: getElectronVersion
export async function getElectronVersion(projectDir: string, config?: Configuration, projectMetadata: MetadataValue = new Lazy(() => orNullIfFileNotExist(readJson(path.join(projectDir, "package.json"))))): Promise<string> {
示例4: Lazy
packageMetadata: Lazy<{ [key: string]: any } | null> = new Lazy(() => orNullIfFileNotExist(readJson(path.join(projectDir, "package.json"))))): Promise<Configuration> {
示例5: getConfig
export async function getConfig(projectDir: string, configPath: string | null, configFromOptions: Configuration | null | undefined, packageMetadata: Lazy<{ [key: string]: any } | null> = new Lazy(() => orNullIfFileNotExist(readJson(path.join(projectDir, "package.json"))))): Promise<Configuration> {