mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-04 19:42:46 +08:00
Add typings for dotenv-safe
This commit is contained in:
7
types/dotenv-safe/dotenv-safe-tests.ts
Normal file
7
types/dotenv-safe/dotenv-safe-tests.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import env = require("dotenv-safe")
|
||||
|
||||
env.load({
|
||||
allowEmptyValues: true,
|
||||
path: "/foo/bar/baz.env",
|
||||
sample: "/foo/bar/qux.env"
|
||||
})
|
||||
40
types/dotenv-safe/index.d.ts
vendored
Normal file
40
types/dotenv-safe/index.d.ts
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
// Type definitions for dotenv-safe 4.0
|
||||
// Project: https://github.com/rolodato/dotenv-safe
|
||||
// Definitions by: Stan Goldmann <https://github.com/krenor>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import env = require("dotenv")
|
||||
|
||||
export interface MissingEnvVarsError extends Error {
|
||||
/**
|
||||
* Path to example environment file.
|
||||
*/
|
||||
sample: string
|
||||
|
||||
/**
|
||||
* Variables which existing in the sample file, but not in the loaded file.
|
||||
*/
|
||||
missing: string[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads environment variables file into 'process.env'.
|
||||
*
|
||||
* @param {object} options
|
||||
* @param {string} [options.sample=".env.example"] Path to example environment file.
|
||||
* @param {string} [options.path=".env"] Path to environment file.
|
||||
* @param {string} [options.encoding="utf8"] Encoding of your file containing environment variables.
|
||||
* @param {boolean} [options.allowEmptyValues=false] Enabling this option will not throw an error after loading.
|
||||
*
|
||||
* @throws MissingEnvVarsError
|
||||
*
|
||||
* @return env.DotenvResult
|
||||
*/
|
||||
export function load(options?: {
|
||||
path?: string,
|
||||
sample?: string,
|
||||
silent?: boolean,
|
||||
encoding?: string,
|
||||
allowEmptyValues?: boolean,
|
||||
}): env.DotenvResult
|
||||
23
types/dotenv-safe/tsconfig.json
Normal file
23
types/dotenv-safe/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es5"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"noImplicitReturns": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"dotenv-safe-tests.ts"
|
||||
]
|
||||
}
|
||||
13
types/dotenv-safe/tslint.json
Normal file
13
types/dotenv-safe/tslint.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"member-access": true,
|
||||
"semicolon": false,
|
||||
"one-line": {
|
||||
"options": [
|
||||
"check-open-brace",
|
||||
"check-whitespace"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user