@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
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
|