diff --git a/lib/commands/upload_cmds/sources.js b/lib/commands/upload_cmds/sources.js index 06438b9..9083bbc 100644 --- a/lib/commands/upload_cmds/sources.js +++ b/lib/commands/upload_cmds/sources.js @@ -50,13 +50,15 @@ module.exports = { for (const file of argv.files) { process.stdout.write(`- ${file.source}...`); const fileDir = path.dirname(file.source); - createdDirs = await checkDirExists( - API, - createdDirs, - fileDir, - branch, - info, - ); + if (fileDir !== '.') { + createdDirs = await checkDirExists( + API, + createdDirs, + fileDir, + branch, + info, + ); + } await uploadFile(API, file, branch, info); console.log(chalk.green('OK')); diff --git a/lib/utils/getCrowdinBranch.js b/lib/utils/getCrowdinBranch.js index 12176e4..2e390fe 100644 --- a/lib/utils/getCrowdinBranch.js +++ b/lib/utils/getCrowdinBranch.js @@ -4,15 +4,12 @@ const getBasePath = require('./getBasePath'); module.exports = async function getCrowdinBranch(argv) { const { baseBranches, branch } = argv; - const projectBranch = await gitBranch(path.dirname(getBasePath(argv))); - return new Promise((resolve) => { - const targetBranch = branch || projectBranch; + const targetBranch = branch || await gitBranch(path.dirname(getBasePath(argv))); - if (!targetBranch || baseBranches.includes(targetBranch)) { - resolve(undefined); - } else { - resolve(targetBranch.replace(/\//g, '_')); - } - }); + if (targetBranch && !baseBranches.includes(targetBranch)) { + return targetBranch.replace(/\//g, '_'); + } else { + return undefined; + } };