MCPcopy Create free account
hub / github.com/Y80/bmm / tryLoadParentGitRepoEnv

Function tryLoadParentGitRepoEnv

scripts/utils.mjs:89–102  ·  view source on GitHub ↗
(options = {})

Source from the content-addressed store, hash-verified

87
88// 当前应用如果作为 git submodule 存在,加载父级目录是的环境配置文件
89export function tryLoadParentGitRepoEnv(options = {}) {
90 if (!fs.existsSync(path.resolve('..', '.gitmodules'))) return
91 const envPaths = [path.resolve('..', '.env'), path.resolve('..', '.env.' + process.env.NODE_ENV)]
92 for (const envPath of envPaths) {
93 if (!fs.existsSync(envPath)) continue
94 dotenv.config({
95 path: envPath,
96 override: true,
97 })
98 }
99 if (!options.silentParentEnvHint) {
100 console.log(zx.chalk.cyan('💡 当前项目作为 git submodule,已加载主目录环境配置'))
101 }
102}
103
104
105export function checkEnvs() {

Callers 2

setupFunction · 0.90
loadEnvFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected