@enplug/scripts
Advanced tools
@@ -129,3 +129,3 @@ const axios = require('axios'); | ||
console.log(`Check the ${chalk.default.yellow('dev.private.json')} file.`); | ||
return; | ||
return throwError(err); | ||
} | ||
@@ -202,13 +202,4 @@ } | ||
const crowdinError = error.response && error.response.data && error.response.data.error; | ||
if (crowdinError && crowdinError.code === CROWDIN_DIRECTORY_NOT_FOUND_ERROR_CODE) { | ||
console.error(`\n${chalk.red.bold('Directory does not exist')} ${chalk.yellow.bold(`[${crowdinPath}]`)}`); | ||
console.log('Create the directory in the Crowdin panel first.'); | ||
} else if (error.response.status === HTTP_UNAUTHORIZED_STATUS_CODE) { | ||
console.error(`\n${chalk.red.bold('Provided Crowdin credentials are incorrect')}`); | ||
console.log(`Check the ${chalk.default.yellow('dev.private.json')} file.`); | ||
} else { | ||
console.error('\nUnexpected error:'); | ||
console.error(error); | ||
} | ||
console.error('\nUnexpected error:'); | ||
console.error(error); | ||
} | ||
@@ -215,0 +206,0 @@ })).toPromise(); |
@@ -69,4 +69,5 @@ const chalk = require('chalk'); | ||
if(appDirectoryId === undefined) { | ||
console.log(`ERROR could not find app ${chalk.yellow.bold(`[${appName}]`)} directory`) | ||
return throwError(error); | ||
console.error(`\n${chalk.red.bold('Directory does not exist')} ${chalk.yellow.bold(`[${appName}]`)}`); | ||
console.log('Create the directory in the Crowdin panel first.'); | ||
return; | ||
} | ||
@@ -91,5 +92,14 @@ if(crowdinPathSections[0] === 'apps' && appDirectoryId) { | ||
} | ||
} else { | ||
// TODO Update dashboard transtlations file | ||
} else if(crowdinPathSections[0] === 'dashboard' && appDirectoryId) { | ||
if(crowdinPathSections[1] === 'en.json') { | ||
const fileId = await getFileIdIfExists(credentials, appDirectoryId, crowdinPathSections[1]); // en.json file id to update | ||
if(fileId) { | ||
const storageId = await uploadFileToCrowdinStorage(credentials, config.localPath); | ||
if(fileId && storageId) { | ||
const response = await updateCrowdinFile(credentials, crowdinPath, storageId.data.data.id, fileId); | ||
} | ||
} else { | ||
console.error(`Could not upload ${chalk.yellow.bold(`[${rowdinPathSections[1]}]`)}. Only en.json supported.`); | ||
} | ||
} // TODO else for data-connector, regions-map and uploader | ||
} | ||
@@ -96,0 +106,0 @@ // await uploadFileToCrowdin(credentials, config.crowdinPath, config.localPath); |
{ | ||
"name": "@enplug/scripts", | ||
"version": "1.11.4-dev50", | ||
"version": "1.11.4-dev51", | ||
"description": "Enplug scripts", | ||
@@ -5,0 +5,0 @@ "scripts": { |
101408
0.24%2487
0.12%