Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add typescript declaration #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions lib/dotenv-flow-webpack.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export = DotenvFlow;
declare class DotenvFlow extends DefinePlugin {
/**
* @param {object} [options] - initialization options
* @param {string} [options.node_env=process.env.NODE_ENV] - node environment (development/test/production/etc,.)
* @param {string} [options.default_node_env] - the default node environment
* @param {string} [options.path=process.cwd()] - path to `.env*` files directory
* @param {string} [options.pattern='.env[.node_env][.local]'] - naming
* @param {BufferEncoding|null} [options.encoding='utf8'] - encoding for reading the `.env*` files
* @param {boolean} [options.system_vars=false] - set to `true` to load all the predefined `process.env.*` variables
* @param {boolean} [options.debug=false] - turn on detailed logging to help debug why certain variables are not being set as you expect
* @param {boolean} [options.silent=false] - suppress all kinds of warnings including ".env*" files' loading errors
*/
constructor(options?: {
node_env?: string;
default_node_env?: string;
path?: string;
pattern?: string;
encoding?: BufferEncoding | null;
system_vars?: boolean;
debug?: boolean;
silent?: boolean;
});
}
import { DefinePlugin } from "webpack";
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"url": "https://github.com/kerimdzhanov/dotenv-flow-webpack/issues"
},
"main": "lib/dotenv-flow-webpack.js",
"types": "lib/dotenv-flow-webpack.d.ts",
"files": [],
"peerDependencies": {
"webpack": "^1 || ^2 || ^3 || ^4 || ^5"
Expand All @@ -38,13 +39,15 @@
"mocha": "^10.2.0",
"sinon": "^16.0.0",
"sinon-chai": "^3.7.0",
"typescript": "^5.5.4",
"webpack": "^5.88.2"
},
"engines": {
"node": ">= 12.0.0"
},
"scripts": {
"test": "mocha -r mocha.conf.js test/*.spec.js",
"generate-types": "tsc",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
},
"author": "Dan Kerimdzhanov",
Expand Down
8 changes: 8 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"include": ["./lib/**/*.js"],
"compilerOptions": {
"allowJs": true,
"declaration": true,
"emitDeclarationOnly": true
}
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2033,6 +2033,11 @@ [email protected], type-detect@^4.0.0, type-detect@^4.0.5, type-detect@^4.0.8:
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"
integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==

typescript@^5.5.4:
version "5.5.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.4.tgz#d9852d6c82bad2d2eda4fd74a5762a8f5909e9ba"
integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==

uglify-js@^3.1.4:
version "3.6.0"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.0.tgz#704681345c53a8b2079fb6cec294b05ead242ff5"
Expand Down