locize-cli
Advanced tools
Comparing version 7.14.8 to 7.14.9
@@ -8,2 +8,6 @@ # locize-cli change log | ||
## [7.14.9](https://github.com/locize/locize-cli/compare/v7.14.8...v7.14.9) - 2023-10-06 | ||
- update some deps and add additional logs for json parse error | ||
## [7.14.8](https://github.com/locize/locize-cli/compare/v7.14.7...v7.14.8) - 2023-08-01 | ||
@@ -10,0 +14,0 @@ |
@@ -26,3 +26,12 @@ const po2i18next = require('gettext-converter/cjs/po2i18next'); | ||
if (opt.format === 'json' || opt.format === 'flat') { | ||
cb(null, flatten(JSON.parse(data.toString()))); | ||
const dataString = data.toString().trim(); | ||
if (dataString[0] !== '{' && dataString[0] !== '[') { | ||
return cb(new Error(`Not a valid json file: Content starts with "${dataString[0]}" but should start with "{"`)); | ||
} | ||
try { | ||
const jsonParsed = JSON.parse(dataString); | ||
cb(null, flatten(jsonParsed)); | ||
} catch (err) { | ||
return cb(err); | ||
} | ||
return; | ||
@@ -29,0 +38,0 @@ } |
{ | ||
"name": "locize-cli", | ||
"version": "7.14.8", | ||
"version": "7.14.9", | ||
"description": "locize cli to import locales", | ||
@@ -28,3 +28,3 @@ "main": "index.js", | ||
"mkdirp": "2.1.6", | ||
"node-fetch": "2.6.8", | ||
"node-fetch": "2.7.0", | ||
"resx": "2.0.4", | ||
@@ -38,3 +38,3 @@ "rimraf": "3.0.2", | ||
"devDependencies": { | ||
"eslint": "8.45.0", | ||
"eslint": "8.50.0", | ||
"gh-release": "7.0.2", | ||
@@ -41,0 +41,0 @@ "pkg": "5.8.1" |
@@ -199,2 +199,5 @@ [![npm](https://img.shields.io/npm/v/locize-cli.svg)](https://npmjs.org/package/locize-cli) | ||
## Copy version | ||
*It uses this [API endpoint](https://docs.locize.com/integration/api#copy-version) and it's the same behavior like [overwriting](https://github.com/more/versioning#a-overwrite-with-data-from) via the UI.* | ||
### Step 1: execute | ||
@@ -201,0 +204,0 @@ |
@@ -31,5 +31,5 @@ const fs = require('fs'); | ||
method: 'get', | ||
headers: opt.apiKey ? { | ||
'Authorization': opt.apiKey | ||
} : undefined | ||
// headers: opt.apiKey ? { | ||
// 'Authorization': opt.apiKey | ||
// } : undefined | ||
}, (err, res, obj) => { | ||
@@ -36,0 +36,0 @@ if (err) return cb(err); |
177671
3062
338
+ Addednode-fetch@2.7.0(transitive)
- Removednode-fetch@2.6.8(transitive)
Updatednode-fetch@2.7.0