UNPKG

877 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var dotenv = require("dotenv");
4var libs_1 = require("../libs");
5var parentModuleDir = function () {
6 var parts = __dirname.split('/');
7 return parts
8 .reverse()
9 .splice(parts.indexOf('node_modules') + 1, parts.length)
10 .reverse()
11 .join('/');
12};
13var toPath = function (options) {
14 if (options === void 0) { options = {}; }
15 return options.path || libs_1.fsPath.join(parentModuleDir(), './.env');
16};
17function exists(options) {
18 if (options === void 0) { options = {}; }
19 return libs_1.fs.existsSync(toPath(options));
20}
21exports.exists = exists;
22function read(options) {
23 if (options === void 0) { options = {}; }
24 return exists(options) ? dotenv.config({ path: toPath(options) }) : {};
25}
26exports.read = read;
27read();
28//# sourceMappingURL=env.js.map
\No newline at end of file