locize-cli 7.14.8 → 7.14.9

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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
5
5
  Project versioning adheres to [Semantic Versioning](http://semver.org/).
6
6
  Change log format is based on [Keep a Changelog](http://keepachangelog.com/).
7
7
 
8
+ ## [7.14.9](https://github.com/locize/locize-cli/compare/v7.14.8...v7.14.9) - 2023-10-06
9
+
10
+ - update some deps and add additional logs for json parse error
11
+
8
12
  ## [7.14.8](https://github.com/locize/locize-cli/compare/v7.14.7...v7.14.8) - 2023-08-01
9
13
 
10
14
  - sync: log path if passing custom path argument
package/README.md CHANGED
@@ -196,6 +196,9 @@ Navigate to your locize project and check the results => [www.locize.app](https:
196
196
 
197
197
 
198
198
  ## Copy version
199
+
200
+ *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.*
201
+
199
202
  ### Step 1: execute
200
203
 
201
204
  Add your api-key (of target version) and your project-id and let's go...
@@ -23,7 +23,16 @@ const convertToFlatFormat = (opt, data, lng, cb) => {
23
23
  }
24
24
  try {
25
25
  if (opt.format === 'json' || opt.format === 'flat') {
26
- cb(null, flatten(JSON.parse(data.toString())));
26
+ const dataString = data.toString().trim();
27
+ if (dataString[0] !== '{' && dataString[0] !== '[') {
28
+ return cb(new Error(`Not a valid json file: Content starts with "${dataString[0]}" but should start with "{"`));
29
+ }
30
+ try {
31
+ const jsonParsed = JSON.parse(dataString);
32
+ cb(null, flatten(jsonParsed));
33
+ } catch (err) {
34
+ return cb(err);
35
+ }
27
36
  return;
28
37
  }
29
38
  if (opt.format === 'po' || opt.format === 'gettext') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "locize-cli",
3
- "version": "7.14.8",
3
+ "version": "7.14.9",
4
4
  "description": "locize cli to import locales",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -25,7 +25,7 @@
25
25
  "laravelphp": "2.0.3",
26
26
  "lodash.clonedeep": "4.5.0",
27
27
  "mkdirp": "2.1.6",
28
- "node-fetch": "2.6.8",
28
+ "node-fetch": "2.7.0",
29
29
  "resx": "2.0.4",
30
30
  "rimraf": "3.0.2",
31
31
  "strings-file": "0.0.5",
@@ -34,7 +34,7 @@
34
34
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.19.3/xlsx-0.19.3.tgz"
35
35
  },
36
36
  "devDependencies": {
37
- "eslint": "8.45.0",
37
+ "eslint": "8.50.0",
38
38
  "gh-release": "7.0.2",
39
39
  "pkg": "5.8.1"
40
40
  },
package/sync.js CHANGED
@@ -28,9 +28,9 @@ const getDownloads = (opt, cb) => {
28
28
  if (!opt.unpublished) {
29
29
  request(opt.apiPath + '/download/' + opt.projectId + '/' + opt.version, {
30
30
  method: 'get',
31
- headers: opt.apiKey ? {
32
- 'Authorization': opt.apiKey
33
- } : undefined
31
+ // headers: opt.apiKey ? {
32
+ // 'Authorization': opt.apiKey
33
+ // } : undefined
34
34
  }, (err, res, obj) => {
35
35
  if (err) return cb(err);
36
36
  if (res.status >= 300) {