life
Version:
Life.js is the first fullstack framework to build agentic web applications. It is minimal, extensible, and typesafe. Well, everything you love.
49 lines (46 loc) • 1.93 kB
JavaScript
; function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }
var _chunk6PEHRAEPjs = require('../chunk-6PEHRAEP.js');
// cli/utils/load-env-vars.ts
var _fs = require('fs');
var _path = require('path');
var _dotenv = require('dotenv');
var ENV_NAMES = ["development", "production", "test", "staging", "preview", "ci"];
var ENV_FILE_PATTERNS = [
/^\.env$/,
// .env
/^\.env\.local$/,
// .env.local
new RegExp(`^\\.env\\.(${ENV_NAMES.join("|")})$`),
// .env.development, .env.production, etc.
new RegExp(`^\\.env\\.(${ENV_NAMES.join("|")})\\.local$`)
// .env.development.local, etc.
];
function loadEnvVars(projectDirectory = process.cwd()) {
const dirs = [
_path.dirname.call(void 0, _path.dirname.call(void 0, projectDirectory)),
// grandparent
_path.dirname.call(void 0, projectDirectory),
// parent
projectDirectory
// current
];
const envFiles = [];
for (const dir of dirs) {
if (!_fs.existsSync.call(void 0, dir)) continue;
try {
const files = _fs.readdirSync.call(void 0, dir).filter((file) => ENV_FILE_PATTERNS.some((pattern) => pattern.test(file))).sort().map((file) => _path.join.call(void 0, dir, file));
envFiles.push(...files);
} catch (e) {
}
}
if (envFiles.length > 0) _dotenv.config.call(void 0, { path: envFiles, override: true, quiet: true });
}
_chunk6PEHRAEPjs.__name.call(void 0, loadEnvVars, "loadEnvVars");
// cli/index.ts
loadEnvVars(process.cwd());
Promise.resolve().then(() => _interopRequireWildcard(require("../run-JE7JHB7E.js"))).catch((error) => {
console.error("Failed to start CLI:", error);
process.exit(1);
});
//# sourceMappingURL=index.js.map