@cocreate/cli
Advanced tools
Comparing version 1.47.0 to 1.47.1
{ | ||
"name": "@cocreate/cli", | ||
"version": "1.47.0", | ||
"version": "1.47.1", | ||
"description": "Polyrepo management bash CLI tool. Run all git commands and yarn commands on multiple repositories. Also includes a few custom macros for cloning, installing, etc.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -40,2 +40,34 @@ #!/usr/bin/env node | ||
// TODO: handle getting closest config | ||
async function getConfig(directory, filename = '') { | ||
const filePath = path.resolve(directory, filename); | ||
if (!filePath.includes('node_modules')) { | ||
const configPath = findClosestConfig(filePath) | ||
if (configPath) { | ||
return { config: require(configPath), configPath, filePath }; | ||
} else { | ||
console.log('No CoCreate.config file found in parent directories.'); | ||
} | ||
} | ||
} | ||
function findClosestConfig(filePath) { | ||
let currentDir = filePath; | ||
while (currentDir !== '/' && currentDir !== '.') { | ||
let configFile = path.join(currentDir, 'CoCreate.config.js'); | ||
if (fs.existsSync(configFile)) { | ||
return configFile; | ||
} | ||
currentDir = path.dirname(currentDir); | ||
} | ||
return null; | ||
} | ||
const currentRepoPath = path.resolve(process.cwd(), "CoCreate.config.js"); | ||
@@ -42,0 +74,0 @@ let packageJsonPath = path.resolve(process.cwd(), 'package.json'); |
Sorry, the diff of this file is too big to display
184938
42
2209
33