@enplug/scripts 1.11.4-dev49 → 1.11.4-dev50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -108,26 +108,26 @@ function getCrowdinConfig() {
108
108
  }
109
109
 
110
110
  async function findCrowdinAppDirectoryId(credentials, crowdinPath, appName) {
111
- if(crowdinPath.startsWith('apps')){
112
- const url = `${CROWDIN_PROJECT_URL}/directories?filter=${appName}`;
113
- const AuthStr = 'Bearer '.concat(credentials.token);
114
- try {
111
+ try {
112
+ if(crowdinPath.startsWith('apps')){
113
+ const url = `${CROWDIN_PROJECT_URL}/directories?filter=${appName}`;
114
+ const AuthStr = 'Bearer '.concat(credentials.token);
115
115
  const resp = await axios.get(url, { headers: { Authorization: AuthStr } });
116
116
  const directory = resp.data.data.find(d => d.data.name === appName );
117
117
  return directory ? directory.data.id : undefined;
118
- } catch (err) {
119
- if (err.response.status === HTTP_UNAUTHORIZED_STATUS_CODE) {
120
- console.error(`\n${chalk.red.bold('Provided Crowdin token is invalid')}`);
121
- console.log(`Check the ${chalk.default.yellow('dev.private.json')} file.`);
122
- throw new Error('');
123
- }
124
- }
125
- } else if(crowdinPath.startsWith('dashboard')) {
126
- const url = `${CROWDIN_PROJECT_URL}/directories?filter=dashboard`;
127
- const AuthStr = 'Bearer '.concat(credentials.token);
128
- const resp = axios.get(url, { headers: { Authorization: AuthStr } });
129
- const directory = resp.data.data.find(d => d.data.name === 'dashboard' && d.data.title === 'Dashboard' && d.data.path === '/dashboard');
130
- return directory ? directory.data.id : undefined;
118
+ } else if(crowdinPath.startsWith('dashboard')) {
119
+ const url = `${CROWDIN_PROJECT_URL}/directories?filter=dashboard`;
120
+ const AuthStr = 'Bearer '.concat(credentials.token);
121
+ const resp = await axios.get(url, { headers: { Authorization: AuthStr } });
122
+ const directory = resp.data.data.find(d => d.data.name === 'dashboard' && d.data.title === 'Dashboard' && d.data.path === '/dashboard');
123
+ return directory ? directory.data.id : undefined;
124
+ }
125
+ } catch (err) {
126
+ if (err.response.status === HTTP_UNAUTHORIZED_STATUS_CODE) {
127
+ console.error(`\n${chalk.red.bold('Provided Crowdin token is invalid')}`);
128
+ console.log(`Check the ${chalk.default.yellow('dev.private.json')} file.`);
129
+ return;
130
+ }
131
131
  }
132
132
  }
133
133
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enplug/scripts",
3
- "version": "1.11.4-dev49",
3
+ "version": "1.11.4-dev50",
4
4
  "description": "Enplug scripts",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",