@cocreate/cli
Advanced tools
Comparing version 1.45.2 to 1.45.3
{ | ||
"name": "@cocreate/cli", | ||
"version": "1.45.2", | ||
"version": "1.45.3", | ||
"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": [ |
@@ -31,16 +31,7 @@ const file = require('@cocreate/file') | ||
if (!filename.includes('CoCreate.config.js')) { | ||
const filePath = path.resolve(directory, filename); | ||
if (!filePath.includes('node_modules')) { | ||
const configPath = findClosestConfig(filePath); | ||
if (configPath) { | ||
const config = require(configPath); | ||
if (config) { | ||
await file(config, configPath, filePath) | ||
} else { | ||
console.log('Failed to read or parse CoCreate.config.js.'); | ||
} | ||
} else { | ||
console.log('No CoCreate.config file found in parent directories.'); | ||
} | ||
const { config, configPath, filePath } = await getConfig(directory, filename); | ||
if (config) { | ||
await file(config, configPath, filePath) | ||
} else { | ||
console.log('Failed to read or parse CoCreate.config.js.'); | ||
} | ||
@@ -51,16 +42,15 @@ } | ||
} else { | ||
let CoCreateConfig | ||
if (!args.length) { | ||
let configPath = path.resolve(process.cwd(), 'CoCreate.config.js'); | ||
if (!CoCreateConfig && fs.existsSync(configPath)) { | ||
CoCreateConfig = require(configPath); | ||
directory = process.cwd() | ||
const { config, configPath, filePath } = await getConfig(directory); | ||
if (config) { | ||
await file(config, configPath, filePath) | ||
} else { | ||
console.log('CoCreate.config.js could not be found.') | ||
process.exit() | ||
console.log('Failed to read or parse CoCreate.config.js.'); | ||
} | ||
await file(CoCreateConfig, configPath) | ||
} else { | ||
for (let arg of args) { | ||
let CoCreateConfig | ||
try { | ||
@@ -72,22 +62,29 @@ CoCreateConfig = JSON.parse(arg) | ||
if (!CoCreateConfig) { | ||
try { | ||
let configPath = path.resolve(process.cwd(), arg) | ||
if (fs.existsSync(configPath)) { | ||
CoCreateConfig = require(configPath); | ||
if (CoCreateConfig) | ||
await file(CoCreateConfig, configPath) | ||
const { config, configPath, filePath } = await getConfig(arg); | ||
if (config) { | ||
await file(config, configPath, filePath) | ||
} else { | ||
console.log('Failed to read or parse CoCreate.config.js.'); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} else { | ||
console.log(arg + ' could not be found.') | ||
process.exit() | ||
} | ||
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 }; | ||
} catch (error) { } | ||
} | ||
} else { | ||
console.log('No CoCreate.config file found in parent directories.'); | ||
} | ||
} | ||
} | ||
function findClosestConfig(filePath) { | ||
let currentDir = path.dirname(filePath); | ||
let currentDir = filePath; | ||
@@ -94,0 +91,0 @@ while (currentDir !== '/' && currentDir !== '.') { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
190207
33
2409