[dotenv-webpack] Update types for v1.7.0

This commit is contained in:
Dave Cardwell
2019-01-18 16:06:40 -05:00
parent e5295d7b89
commit e8783def09
2 changed files with 28 additions and 8 deletions

View File

@@ -3,19 +3,27 @@ import DotenvWebpackPlugin = require('dotenv-webpack');
new DotenvWebpackPlugin(); // $ExpectType DotenvWebpackPlugin
const options: DotenvWebpackPlugin.Options = {
const optionsEmpty: DotenvWebpackPlugin.Options = {};
const optionsFull: DotenvWebpackPlugin.Options = {
path: './some.other.env',
safe: true,
systemvars: true,
silent: true
silent: true,
expand: true,
defaults: true
};
const optionsStrings: DotenvWebpackPlugin.Options = {
safe: './some.other.env.example',
defaults: './some.other.env.defaults'
};
const config: webpack.Configuration = {
plugins: [
new DotenvWebpackPlugin(),
new DotenvWebpackPlugin({
path: './some.other.env',
}),
new DotenvWebpackPlugin(options),
new DotenvWebpackPlugin(optionsEmpty),
new DotenvWebpackPlugin(optionsFull),
new DotenvWebpackPlugin(optionsStrings)
]
};

View File

@@ -1,6 +1,7 @@
// Type definitions for dotenv-webpack 1.5
// Type definitions for dotenv-webpack 1.7
// Project: https://github.com/mrsteele/dotenv-webpack
// Definitions by: Karol Majewski <https://github.com/karol-majewski>
// Dave Cardwell <https://github.com/davecardwell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.7
@@ -20,7 +21,7 @@ declare namespace DotenvWebpackPlugin {
/**
* If `false` ignore safe-mode, if `true` load `'./.env.example'`, if a `string` load that file as the sample. Default: `false`.
*/
safe?: boolean;
safe?: boolean | string;
/**
* Set to `true` if you would rather load all system variables as well (useful for CI purposes). Default: `false`.
@@ -31,6 +32,17 @@ declare namespace DotenvWebpackPlugin {
* If `true`, all warnings will be surpressed. Default: `false`.
*/
silent?: boolean;
/**
* Allows your variables to be "expanded" for reusability within your .env file. Default: `false`.
*/
expand?: boolean;
/**
* Adds support for dotenv-defaults. If set to `true`, uses `./.env.defaults`. If a `string`, uses that location for a defaults file.
* Read more at https://www.npmjs.com/package/dotenv-defaults. Default: `false`.
*/
defaults?: boolean | string;
}
}