locize-cli 9.1.3 → 10.0.0

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,14 @@ 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
+ ## [10.0.0](https://github.com/locize/locize-cli/compare/v9.1.4...v10.0.0) - 2025-06-30
9
+
10
+ - replace old/unmaintained yaml dependency
11
+
12
+ ## [9.1.4](https://github.com/locize/locize-cli/compare/v9.1.3...v9.1.4) - 2025-06-30
13
+
14
+ - download: fix issue with reversed pathMask in combination with no languageFolderPrefix
15
+
8
16
  ## [9.1.3](https://github.com/locize/locize-cli/compare/v9.1.2...v9.1.3) - 2025-05-22
9
17
 
10
18
  - mentioning comma separated ns argument
@@ -1,4 +1,4 @@
1
- const jsyaml = require('js-yaml');
1
+ const yaml = require('yaml');
2
2
 
3
3
  const delimiter = {
4
4
  i18next: '_',
@@ -26,7 +26,7 @@ const getBaseKey = (delimiter) => (k) => {
26
26
  const uniq = (value, index, self) => self.indexOf(value) === index;
27
27
 
28
28
  const stringify = (o) => {
29
- let str = jsyaml.dump(o);
29
+ let str = yaml.stringify(o);
30
30
  const subKeys = Object.keys(o);
31
31
  subKeys.forEach((sk) => {
32
32
  if (isNaN(sk)) {
@@ -123,7 +123,7 @@ const parse = (s) => {
123
123
  s = s.replace(new RegExp(`^(?:${escapedMatch}: )+`, 'm'), `${sk}: `);
124
124
  }
125
125
  }
126
- return jsyaml.load(s);
126
+ return yaml.parse(s);
127
127
  };
128
128
 
129
129
  const prepareImport = (resources) => {
@@ -2,7 +2,7 @@ const flatten = require('flat');
2
2
  const i18next2po = require('gettext-converter/cjs/i18next2po');
3
3
  const csvjson = require('csvjson');
4
4
  const xlsx = require('xlsx');
5
- const jsyaml = require('js-yaml');
5
+ const yaml = require('yaml');
6
6
  const js2asr = require('android-string-resource/cjs/js2asr');
7
7
  const stringsFile = require('strings-file');
8
8
  const createxliff = require('xliff/cjs/createxliff');
@@ -146,7 +146,7 @@ const convertToDesiredFormat = (
146
146
  opt.format === 'yml'
147
147
  ) {
148
148
  if (isEmpty) return cb(null, '');
149
- cb(null, jsyaml.dump(flatten(data)));
149
+ cb(null, yaml.stringify(flatten(data)));
150
150
  return;
151
151
  }
152
152
  if (
@@ -154,7 +154,7 @@ const convertToDesiredFormat = (
154
154
  opt.format === 'yml-nested'
155
155
  ) {
156
156
  if (isEmpty) return cb(null, '');
157
- cb(null, jsyaml.dump(shouldUnflatten(data) ? unflatten(data) : data));
157
+ cb(null, yaml.stringify(shouldUnflatten(data) ? unflatten(data) : data));
158
158
  return;
159
159
  }
160
160
  if (
@@ -164,7 +164,7 @@ const convertToDesiredFormat = (
164
164
  if (isEmpty) return cb(null, '');
165
165
  var newData = {};
166
166
  newData[lng] = shouldUnflatten(data) ? unflatten(data) : data;
167
- cb(null, jsyaml.dump(removeUndefinedFromArrays(newData)));
167
+ cb(null, yaml.stringify(removeUndefinedFromArrays(newData)));
168
168
  return;
169
169
  }
170
170
  if (
@@ -175,7 +175,7 @@ const convertToDesiredFormat = (
175
175
  var newDataNs = {};
176
176
  newDataNs[lng] = {};
177
177
  newDataNs[lng][namespace] = shouldUnflatten(data) ? unflatten(data) : data;
178
- cb(null, jsyaml.dump(removeUndefinedFromArrays(newDataNs)));
178
+ cb(null, yaml.stringify(removeUndefinedFromArrays(newDataNs)));
179
179
  return;
180
180
  }
181
181
  if (opt.format === 'android') {
@@ -1,7 +1,7 @@
1
1
  const po2i18next = require('gettext-converter/cjs/po2i18next');
2
2
  const csvjson = require('csvjson');
3
3
  const xlsx = require('xlsx');
4
- const jsyaml = require('js-yaml');
4
+ const yaml = require('yaml');
5
5
  const asr2js = require('android-string-resource/cjs/asr2js');
6
6
  const stringsFile = require('strings-file');
7
7
  const xliff2js = require('xliff/cjs/xliff2js');
@@ -123,8 +123,8 @@ const convertToFlatFormat = (opt, data, lng, cb) => {
123
123
  opt.format === 'yml'
124
124
  ) {
125
125
  const d = data.toString();
126
- if (!d || d === '') return cb(null, {});
127
- cb(null, flatten(jsyaml.load(d)));
126
+ if (!d || d === '' || d === '\n') return cb(null, {});
127
+ cb(null, flatten(yaml.parse(d)));
128
128
  return;
129
129
  }
130
130
  if (
@@ -132,8 +132,8 @@ const convertToFlatFormat = (opt, data, lng, cb) => {
132
132
  opt.format === 'yml-nested'
133
133
  ) {
134
134
  const d = data.toString();
135
- if (!d || d === '') return cb(null, {});
136
- cb(null, flatten(jsyaml.load(d)));
135
+ if (!d || d === '' || d === '\n') return cb(null, {});
136
+ cb(null, flatten(yaml.parse(d)));
137
137
  return;
138
138
  }
139
139
  if (
@@ -142,7 +142,7 @@ const convertToFlatFormat = (opt, data, lng, cb) => {
142
142
  ) {
143
143
  const d = data.toString();
144
144
  if (!d || d.trim() === '') return cb(null, {});
145
- const jsObj = jsyaml.load(d);
145
+ const jsObj = yaml.parse(d);
146
146
  cb(
147
147
  null,
148
148
  flatten(
@@ -157,7 +157,7 @@ const convertToFlatFormat = (opt, data, lng, cb) => {
157
157
  ) {
158
158
  const dn = data.toString();
159
159
  if (!dn || dn.trim() === '') return cb(null, {});
160
- const jsObjn = jsyaml.load(dn);
160
+ const jsObjn = yaml.parse(dn);
161
161
  cb(
162
162
  null,
163
163
  flatten(
package/download.js CHANGED
@@ -157,7 +157,10 @@ function handleDownload(opt, url, err, res, downloads, cb) {
157
157
  return;
158
158
  }
159
159
 
160
- if (filledMask.indexOf(path.sep) > 0) filledMask = filledMask.replace(opt.languageFolderPrefix + language, '');
160
+ if (opt.languageFolderPrefix && filledMask.indexOf(path.sep) > 0) filledMask = filledMask.replace(opt.languageFolderPrefix + language, '');
161
+ // if (opt.pathMask.indexOf(`${opt.pathMaskInterpolationPrefix}language${opt.pathMaskInterpolationSuffix}`) > opt.pathMask.indexOf(`${opt.pathMaskInterpolationPrefix}namespace${opt.pathMaskInterpolationSuffix}`) && filledMask.lastIndexOf(path.sep) > 0) {
162
+ // mkdirp.sync(path.join(opt.path, filledMask.substring(0, filledMask.lastIndexOf(path.sep))));
163
+ // }
161
164
  const parentDir = path.dirname(path.join(opt.path, filledMask));
162
165
  mkdirp.sync(parentDir);
163
166
  fs.writeFile(path.join(opt.path, filledMask), fileContent, clb);
@@ -283,7 +286,10 @@ function handlePull(opt, toDownload, cb) {
283
286
  return;
284
287
  }
285
288
 
286
- if (filledMask.indexOf(path.sep) > 0) filledMask = filledMask.replace(opt.languageFolderPrefix + lng, '');
289
+ if (opt.languageFolderPrefix && filledMask.indexOf(path.sep) > 0) filledMask = filledMask.replace(opt.languageFolderPrefix + lng, '');
290
+ // if (opt.pathMask.indexOf(`${opt.pathMaskInterpolationPrefix}language${opt.pathMaskInterpolationSuffix}`) > opt.pathMask.indexOf(`${opt.pathMaskInterpolationPrefix}namespace${opt.pathMaskInterpolationSuffix}`) && filledMask.lastIndexOf(path.sep) > 0) {
291
+ // mkdirp.sync(path.join(opt.path, filledMask.substring(0, filledMask.lastIndexOf(path.sep))));
292
+ // }
287
293
  const parentDir = path.dirname(path.join(opt.path, filledMask));
288
294
  mkdirp.sync(parentDir);
289
295
  fs.writeFile(path.join(opt.path, filledMask), fileContent, clb);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "locize-cli",
3
- "version": "9.1.3",
3
+ "version": "10.0.0",
4
4
  "description": "locize cli to import locales",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -21,7 +21,6 @@
21
21
  "gettext-converter": "1.3.0",
22
22
  "https-proxy-agent": "7.0.6",
23
23
  "ini": "4.1.3",
24
- "js-yaml": "4.1.0",
25
24
  "laravelphp": "2.0.4",
26
25
  "locize-xcstrings": "2.0.0",
27
26
  "lodash.clonedeep": "4.5.0",
@@ -32,7 +31,8 @@
32
31
  "strings-file": "0.0.5",
33
32
  "tmexchange": "2.0.5",
34
33
  "xliff": "6.2.2",
35
- "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
34
+ "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
35
+ "yaml": "2.8.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@yao-pkg/pkg": "6.4.0",