locize-cli 10.0.2 → 10.0.3

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
+ ## [10.0.3](https://github.com/locize/locize-cli/compare/v10.0.2...v10.0.3) - 2025-07-09
9
+
10
+ - introduce `--ignore-if-version-exists` option for `copy-version`
11
+
8
12
  ## [10.0.2](https://github.com/locize/locize-cli/compare/v10.0.1...v10.0.2) - 2025-07-02
9
13
 
10
14
  - respect opt.namespace when parsing local namespaces
package/bin/locize CHANGED
@@ -552,6 +552,7 @@ program
552
552
  .option('-k, --api-key <apiKey>', 'The api-key that should be used')
553
553
  .option('-v, --ver <version>', 'The target version to be used to copy to (default: latest)')
554
554
  .option('-i, --project-id <projectId>', 'The project-id that should be used')
555
+ .option('-iv, --ignore-if-version-exists <true|false>', 'The project-id that should be used (default: false)', 'false')
555
556
  .option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
556
557
  .action((fromVersion, options) => {
557
558
  try {
@@ -576,12 +577,15 @@ program
576
577
 
577
578
  const getPath = options.getPath || config.getPath || getPathUrl;
578
579
 
580
+ const ignoreIfVersionExists = options.ignoreIfVersionExists === 'true';
581
+
579
582
  copyVersion({
580
583
  apiKey: apiKey,
581
584
  projectId: projectId,
582
585
  apiPath: url.parse(getPath).protocol + '//' + url.parse(getPath).host,
583
586
  fromVersion: fromVersion,
584
- toVersion: version
587
+ toVersion: version,
588
+ ignoreIfVersionExists: ignoreIfVersionExists
585
589
  });
586
590
  })
587
591
  .on('--help', () => {
package/copyVersion.js CHANGED
@@ -3,7 +3,12 @@ const request = require('./request');
3
3
  const getJob = require('./getJob');
4
4
 
5
5
  const copyVersion = (opt, cb) => {
6
- request(opt.apiPath + '/copy/' + opt.projectId + '/version/' + opt.fromVersion + '/' + opt.toVersion, {
6
+ const queryParams = new URLSearchParams();
7
+ if (opt.ignoreIfVersionExists) {
8
+ queryParams.append('ignoreIfVersionExists', 'true');
9
+ }
10
+ const queryString = queryParams.size > 0 ? '?' + queryParams.toString() : '';
11
+ request(opt.apiPath + '/copy/' + opt.projectId + '/version/' + opt.fromVersion + '/' + opt.toVersion + queryString, {
7
12
  method: 'post',
8
13
  headers: {
9
14
  'Authorization': opt.apiKey
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "locize-cli",
3
- "version": "10.0.2",
3
+ "version": "10.0.3",
4
4
  "description": "locize cli to import locales",
5
5
  "main": "index.js",
6
6
  "bin": {