mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Create definitions for dotenv-webpack (#24828)
This commit is contained in:
committed by
Mohamed Hegazy
parent
0a20ea4ad9
commit
6bd12e9136
21
types/dotenv-webpack/dotenv-webpack-tests.ts
Normal file
21
types/dotenv-webpack/dotenv-webpack-tests.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as webpack from 'webpack';
|
||||
import DotenvWebpackPlugin = require('dotenv-webpack');
|
||||
|
||||
new DotenvWebpackPlugin(); // $ExpectType DotenvWebpackPlugin
|
||||
|
||||
const options: DotenvWebpackPlugin.Options = {
|
||||
path: './some.other.env',
|
||||
safe: true,
|
||||
systemvars: true,
|
||||
silent: true
|
||||
};
|
||||
|
||||
const config: webpack.Configuration = {
|
||||
plugins: [
|
||||
new DotenvWebpackPlugin(),
|
||||
new DotenvWebpackPlugin({
|
||||
path: './some.other.env',
|
||||
}),
|
||||
new DotenvWebpackPlugin(options),
|
||||
]
|
||||
};
|
||||
37
types/dotenv-webpack/index.d.ts
vendored
Normal file
37
types/dotenv-webpack/index.d.ts
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
// Type definitions for dotenv-webpack 1.5
|
||||
// Project: https://github.com/mrsteele/dotenv-webpack
|
||||
// Definitions by: Karol Majewski <https://github.com/karol-majewski>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.7
|
||||
|
||||
import * as webpack from 'webpack';
|
||||
|
||||
declare class DotenvWebpackPlugin extends webpack.Plugin {
|
||||
constructor(options?: DotenvWebpackPlugin.Options);
|
||||
}
|
||||
|
||||
declare namespace DotenvWebpackPlugin {
|
||||
interface Options {
|
||||
/**
|
||||
* The path to your environment variables. Default: `'./.env'`.
|
||||
*/
|
||||
path?: string;
|
||||
|
||||
/**
|
||||
* If `false` ignore safe-mode, if `true` load `'./.env.example'`, if a `string` load that file as the sample. Default: `false`.
|
||||
*/
|
||||
safe?: boolean;
|
||||
|
||||
/**
|
||||
* Set to `true` if you would rather load all system variables as well (useful for CI purposes). Default: `false`.
|
||||
*/
|
||||
systemvars?: boolean;
|
||||
|
||||
/**
|
||||
* If `true`, all warnings will be surpressed. Default: `false`.
|
||||
*/
|
||||
silent?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = DotenvWebpackPlugin;
|
||||
23
types/dotenv-webpack/tsconfig.json
Normal file
23
types/dotenv-webpack/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"dotenv-webpack-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/dotenv-webpack/tslint.json
Normal file
1
types/dotenv-webpack/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user