Comparing version 0.1.1 to 0.1.2
@@ -23,2 +23,3 @@ #!/usr/bin/env node | ||
_token = ''; | ||
_branch = ''; | ||
_projectIds = []; | ||
@@ -47,2 +48,3 @@ _lanMap = {}; | ||
this._tags = config.tags?.map(v => v.trim())?.filter(v => v); | ||
this._branch = config.branch || ''; | ||
} | ||
@@ -110,3 +112,3 @@ init = async () => { | ||
_queryList = async (pid) => { | ||
const lanList = JSON.parse((await this.request(`https://api.phrase.com/v2/projects/${pid}/locales?per_page=100`)) || ''); | ||
const lanList = JSON.parse((await this.request(`https://api.phrase.com/v2/projects/${pid}/locales?per_page=100&branch=${this._branch}`)) || ''); | ||
let updateLan = []; | ||
@@ -134,3 +136,3 @@ let otherLan = []; // 不论翻译又没有变,每次都需要比较一次中文集合中key有无变化,有变化的话就需要全部重新加载 | ||
}); | ||
let allList = await Promise.all((updateLan).map(lan => this.request(`https://api.phrase.com/v2/projects/${pid}/locales/${lan.id}/download?tags=${this._tags}&file_format=csv&format_options[export_tags]=true&format_options[export_max_characters_allowed]=true`))); | ||
let allList = await Promise.all((updateLan).map(lan => this.request(`https://api.phrase.com/v2/projects/${pid}/locales/${lan.id}/download?tags=${this._tags}&branch=${this._branch}&file_format=csv&format_options[export_tags]=true&format_options[export_max_characters_allowed]=true`))); | ||
let keyStr = this._keyStr[pid]; | ||
@@ -151,3 +153,3 @@ for (let i = 0; i < allList.length; i += 1) { | ||
this._keyStr[pid] = keyStr; | ||
allList = await Promise.all((otherLan).map(lan => this.request(`https://api.phrase.com/v2/projects/${pid}/locales/${lan.id}/download?tags=${this._tags}&file_format=csv&format_options[export_tags]=true&format_options[export_max_characters_allowed]=true`))); | ||
allList = await Promise.all((otherLan).map(lan => this.request(`https://api.phrase.com/v2/projects/${pid}/locales/${lan.id}/download?tags=${this._tags}&branch=${this._branch}&file_format=csv&format_options[export_tags]=true&format_options[export_max_characters_allowed]=true`))); | ||
for (let i = 0; i < allList.length; i += 1) { | ||
@@ -154,0 +156,0 @@ this._hasData = true; |
@@ -62,2 +62,3 @@ #!/usr/bin/env node | ||
this._token = ''; | ||
this._branch = ''; | ||
this._projectIds = []; | ||
@@ -169,3 +170,3 @@ this._lanMap = {}; | ||
_b = (_a = JSON).parse; | ||
return [4 /*yield*/, this.request("https://api.phrase.com/v2/projects/".concat(pid, "/locales?per_page=100"))]; | ||
return [4 /*yield*/, this.request("https://api.phrase.com/v2/projects/".concat(pid, "/locales?per_page=100&branch=").concat(this._branch))]; | ||
case 1: | ||
@@ -197,3 +198,3 @@ lanList = _b.apply(_a, [(_c.sent()) || '']); | ||
return [4 /*yield*/, Promise.all((updateLan).map(function (lan) { | ||
return _this.request("https://api.phrase.com/v2/projects/".concat(pid, "/locales/").concat(lan.id, "/download?tags=").concat(_this._tags, "&file_format=csv&format_options[export_tags]=true&format_options[export_max_characters_allowed]=true")); | ||
return _this.request("https://api.phrase.com/v2/projects/".concat(pid, "/locales/").concat(lan.id, "/download?tags=").concat(_this._tags, "&branch=").concat(_this._branch, "&file_format=csv&format_options[export_tags]=true&format_options[export_max_characters_allowed]=true")); | ||
}))]; | ||
@@ -227,3 +228,3 @@ case 2: | ||
return [4 /*yield*/, Promise.all((otherLan).map(function (lan) { | ||
return _this.request("https://api.phrase.com/v2/projects/".concat(pid, "/locales/").concat(lan.id, "/download?tags=").concat(_this._tags, "&file_format=csv&format_options[export_tags]=true&format_options[export_max_characters_allowed]=true")); | ||
return _this.request("https://api.phrase.com/v2/projects/".concat(pid, "/locales/").concat(lan.id, "/download?tags=").concat(_this._tags, "&branch=").concat(_this._branch, "&file_format=csv&format_options[export_tags]=true&format_options[export_max_characters_allowed]=true")); | ||
}))]; | ||
@@ -307,2 +308,3 @@ case 7: | ||
this._tags = (_b = (_a = config.tags) === null || _a === void 0 ? void 0 : _a.map(function (v) { return v.trim(); })) === null || _b === void 0 ? void 0 : _b.filter(function (v) { return v; }); | ||
this._branch = config.branch || ''; | ||
} | ||
@@ -309,0 +311,0 @@ return Cli; |
{ | ||
"name": "tant-intl", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "数数科技依托于phrase平台的多语言组件", | ||
@@ -5,0 +5,0 @@ "main": "es/index.js", |
37246
733