Skip to content

Commit

Permalink
fix: getConfig and node_moules/ exclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Apr 1, 2024
1 parent 6b936f9 commit 468b15f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/commands/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = async function upload(directory, args) {
if (config) {
await file(config, configPath, filePath)
} else {
console.log('Failed to read or parse CoCreate.config.js.');
console.log(`Failed to read or parse CoCreate.config.js for file: ${filename}`);
}
}
});
Expand Down Expand Up @@ -69,17 +69,18 @@ module.exports = async function upload(directory, args) {
}

async function getConfig(directory, filename = '') {
let config, configPath
const filePath = path.resolve(directory, filename);
if (!filePath.includes('node_modules')) {
const configPath = findClosestConfig(filePath)
if (!filePath.includes('node_modules/')) {
configPath = findClosestConfig(filePath)
if (configPath) {
return { config: require(configPath), configPath, filePath };

config = require(configPath)
} else {
console.log('No CoCreate.config file found in parent directories.');
}
}

return { config, configPath, filePath };
}

function findClosestConfig(filePath) {
Expand Down

0 comments on commit 468b15f

Please sign in to comment.