locize-cli 7.14.3 → 7.14.4
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 +4 -0
- package/bin/locize +4 -1
- package/package.json +1 -1
- package/sync.js +10 -0
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.4](https://github.com/locize/locize-cli/compare/v7.14.3...v7.14.4) - 2023-05-09
|
|
9
|
+
|
|
10
|
+
- sync: introduce --auto-create-path option
|
|
11
|
+
|
|
8
12
|
## [7.14.3](https://github.com/locize/locize-cli/compare/v7.14.2...v7.14.3) - 2023-05-09
|
|
9
13
|
|
|
10
14
|
- optimize unflatten algorithm
|
package/bin/locize
CHANGED
|
@@ -356,6 +356,7 @@ program
|
|
|
356
356
|
.option('-i, --project-id <projectId>', 'The project-id that should be used')
|
|
357
357
|
.option('-v, --ver <version>', 'Found namespaces will be matched to this version (default: latest)')
|
|
358
358
|
.option('-p, --path <path>', `Specify the path that should be used (default: ${process.cwd()})`, process.cwd())
|
|
359
|
+
.option('-A, --auto-create-path <true|false>', 'This will automatically make sure the --path is created. (default: true)', 'true')
|
|
359
360
|
.option('-f, --format <json>', 'File format of namespaces (default: json; [flat, xliff2, xliff12, xlf2, xlf12, android, yaml, yaml-rails, yaml-nested, csv, xlsx, po, strings, resx, fluent, tmx, laravel, properties])', 'json')
|
|
360
361
|
.option('-s, --skip-empty <true|false>', 'Skips to download empty files (default: false)', 'false')
|
|
361
362
|
.option('-c, --clean <true|false>', 'Removes all local files by removing the whole folder (default: false)', 'false')
|
|
@@ -416,6 +417,7 @@ program
|
|
|
416
417
|
const compareModificationTime = options.compareModificationTime === 'true';
|
|
417
418
|
const pathMask = options.pathMask;
|
|
418
419
|
const unpublished = options.unpublished === 'true';
|
|
420
|
+
const autoCreatePath = options.autoCreatePath === 'true';
|
|
419
421
|
|
|
420
422
|
sync({
|
|
421
423
|
apiPath: url.parse(getPath).protocol + '//' + url.parse(getPath).host,
|
|
@@ -437,7 +439,8 @@ program
|
|
|
437
439
|
namespace: namespace,
|
|
438
440
|
dry: dry,
|
|
439
441
|
pathMask: pathMask,
|
|
440
|
-
unpublished: unpublished
|
|
442
|
+
unpublished: unpublished,
|
|
443
|
+
autoCreatePath: autoCreatePath
|
|
441
444
|
});
|
|
442
445
|
})
|
|
443
446
|
.on('--help', () => {
|
package/package.json
CHANGED
package/sync.js
CHANGED
|
@@ -545,6 +545,16 @@ const sync = (opt, cb) => {
|
|
|
545
545
|
opt.apiPath = opt.apiPath || 'https://api.locize.app';
|
|
546
546
|
|
|
547
547
|
if (!opt.dry && opt.clean) rimraf.sync(path.join(opt.path, '*'));
|
|
548
|
+
|
|
549
|
+
if (opt.autoCreatePath === false) {
|
|
550
|
+
var directoryExists = false;
|
|
551
|
+
try {
|
|
552
|
+
directoryExists = fs.statSync(opt.path).isDirectory();
|
|
553
|
+
} catch (e) {}
|
|
554
|
+
if (!directoryExists) {
|
|
555
|
+
return handleError(new Error(`${opt.path} does not exist!`), cb);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
548
558
|
if (!opt.dry) mkdirp.sync(opt.path);
|
|
549
559
|
|
|
550
560
|
if (opt.namespace && opt.namespace.indexOf(',') > 0) {
|