@talend/i18n-scripts
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -9,3 +9,3 @@ /* eslint-disable no-param-reassign */ | ||
const error = require('./error'); | ||
const { printRunning, printSuccess } = require('./log'); | ||
const { printInfo, printRunning, printSuccess } = require('./log'); | ||
@@ -53,9 +53,23 @@ function throwError(missingVar) { | ||
function getProjectsWithStatus(status) { | ||
return fetch(`${xtm.apiUrl}/projects?customerIds=${xtm.customerId}&status=${status}`, { | ||
headers: { Authorization: `XTM-Basic ${xtm.token}` }, | ||
}) | ||
function getProjectsWithStatus(status, page = 1) { | ||
const url = `${xtm.apiUrl}/projects?customerIds=${xtm.customerId}&status=${status}&pageSize=100&page=${page}`; | ||
printInfo(`fetch ${url}`); | ||
return fetch(url, { headers: { Authorization: `XTM-Basic ${xtm.token}` } }) | ||
.then(handleError) | ||
.then(res => res.json()) | ||
.then(projects => projects.find(({ name }) => name === projectName)) | ||
.then(projects => { | ||
// page is empty, the project hasn't been found with this status | ||
if (!projects.length) { | ||
return; | ||
} | ||
// page has elements, search the project by name | ||
const wantedProject = projects.find(({ name }) => name === projectName); | ||
if (wantedProject) { | ||
return wantedProject; | ||
} | ||
// project is not in this page, we try next page | ||
return getProjectsWithStatus(status, page + 1); | ||
}) | ||
.then(project => (data.project = project)); | ||
@@ -62,0 +76,0 @@ } |
{ | ||
"name": "@talend/i18n-scripts", | ||
"description": "Set of scripts to ease i18n workflow", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "main": "index.js", |
@@ -18,16 +18,2 @@ # Talend i18n scripts | ||
# Installation | ||
```shell | ||
yarn global install @talend/i18n-scripts | ||
``` | ||
or | ||
```shell | ||
npm install -g @talend/i18n-scripts | ||
``` | ||
Now the cli `talend-i18n` is available. | ||
# Actions | ||
@@ -38,6 +24,6 @@ | ||
```shell | ||
talend-i18n extract | ||
talend-i18n upload | ||
talend-i18n download | ||
talend-i18n deploy | ||
npx @talend/i18n-scripts extract | ||
npx @talend/i18n-scripts upload | ||
npx @talend/i18n-scripts download | ||
npx @talend/i18n-scripts deploy | ||
``` | ||
@@ -44,0 +30,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
125636
1225
214