@transifex/cli 5.1.1 → 5.2.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/README.md CHANGED
@@ -103,7 +103,7 @@ detect and push source content to Transifex
103
103
  ```
104
104
  USAGE
105
105
  $ txjs-cli push [PATTERN] [--dry-run] [--fake] [-v] [--purge] [--no-wait] [--token <value>] [--secret <value>] [--append-tags <value>] [--with-tags-only <value>] [--without-tags-only <value>]
106
- [--cds-host <value>] [--parser auto|i18next|txnativejson] [--key-generator source|hash]
106
+ [--cds-host <value>] [--do-not-keep-translations] [--override-tags] [--parser auto|i18next|txnativejson] [--key-generator source|hash]
107
107
 
108
108
  ARGUMENTS
109
109
  PATTERN [default: **/*.{js,jsx,ts,tsx,html,vue,pug,ejs}] file pattern to scan for strings
@@ -112,11 +112,13 @@ FLAGS
112
112
  -v, --verbose verbose output
113
113
  --append-tags=<value> append tags to strings
114
114
  --cds-host=<value> CDS host URL
115
+ --do-not-keep-translations remove translations when source strings change
115
116
  --dry-run dry run, do not apply changes in Transifex
116
117
  --fake do not push content to remote server
117
118
  --key-generator=<option> [default: source] use hashed or source based keys
118
119
  <options: source|hash>
119
120
  --no-wait disable polling for upload results
121
+ --override-tags override tags when pushing content
120
122
  --parser=<option> [default: auto] file parser to use
121
123
  <options: auto|i18next|txnativejson>
122
124
  --purge purge content on Transifex
@@ -1 +1 @@
1
- {"version":"5.1.1","commands":{"invalidate":{"id":"invalidate","description":"Invalidate and refresh CDS cache\nContent for delivery is cached in CDS and refreshed automatically every hour.\nThis command triggers a refresh of cached content on the fly.\n\nBy default, invalidation does not remove existing cached content,\nbut starts the process of updating with latest translations from Transifex.\n\nPassing the --purge option, cached content will be forced to be deleted,\nhowever use that with caution, as it may introduce downtime of\ntranslation delivery to the apps until fresh content is cached in the CDS.\n\nTo invalidate translations some environment variables must be set:\nTRANSIFEX_TOKEN=<Transifex Native Project Token>\nTRANSIFEX_SECRET=<Transifex Native Project Secret>\n(optional) TRANSIFEX_CDS_HOST=<CDS HOST>\n\nor passed as --token=<TOKEN> --secret=<SECRET> parameters\n\nDefault CDS Host is https://cds.svc.transifex.net\n\nExamples:\ntxjs-cli invalidate\ntxjs-cli invalidate --purge\ntxjs-cli invalidate --token=mytoken --secret=mysecret\nTRANSIFEX_TOKEN=mytoken TRANSIFEX_SECRET=mysecret txjs-cli invalidate\n","pluginName":"@transifex/cli","pluginType":"core","aliases":[],"flags":{"purge":{"name":"purge","type":"boolean","description":"force delete CDS cached content","allowNo":false},"token":{"name":"token","type":"option","description":"native project public token","default":""},"secret":{"name":"secret","type":"option","description":"native project secret","default":""},"cds-host":{"name":"cds-host","type":"option","description":"CDS host URL","default":""}},"args":[]},"pull":{"id":"pull","description":"Pull content from Transifex for offline caching\nGet content as JSON files, to be used by mobile Javascript SDKs for\noffline support or warming up the cache with initial translations.\n\nBy default, JSON files are printed in the console,\nunless the \"-f foldername\" parameter is provided. In that case\nthe JSON files will be downloaded to that folder with the <locale>.json format.\n\nTo pull content some environment variables must be set:\nTRANSIFEX_TOKEN=<Transifex Native Project Token>\nTRANSIFEX_SECRET=<Transifex Native Project Secret>\n(optional) TRANSIFEX_CDS_HOST=<CDS HOST>\n\nor passed as --token=<TOKEN> --secret=<SECRET> parameters\n\nDefault CDS Host is https://cds.svc.transifex.net\n\nExamples:\ntxjs-cli pull\ntxjs-cli pull --pretty\ntxjs-cli pull -f languages/\ntxjs-cli pull --locale=fr -f .\ntxjs-cli pull --filter-tags=\"foo,bar\"\ntxjs-cli pull --filter-status=\"reviewed\"\ntxjs-cli pull --token=mytoken --secret=mysecret\nTRANSIFEX_TOKEN=mytoken TRANSIFEX_SECRET=mysecret txjs-cli pull\n","pluginName":"@transifex/cli","pluginType":"core","aliases":[],"flags":{"token":{"name":"token","type":"option","description":"native project public token","default":""},"secret":{"name":"secret","type":"option","description":"native project secret","default":""},"folder":{"name":"folder","type":"option","char":"f","description":"output as files to folder","default":""},"locale":{"name":"locale","type":"option","char":"l","description":"pull specific language locale code","default":""},"pretty":{"name":"pretty","type":"boolean","description":"beautify JSON output","allowNo":false},"filter-tags":{"name":"filter-tags","type":"option","description":"filter over specific tags","default":""},"filter-status":{"name":"filter-status","type":"option","description":"filter over translation status","options":["reviewed","proofread","finalized"],"default":""},"cds-host":{"name":"cds-host","type":"option","description":"CDS host URL","default":""}},"args":[]},"push":{"id":"push","description":"Detect and push source content to Transifex\nParse .js, .ts, .jsx, .tsx and .html files and detect phrases marked for\ntranslation by Transifex Native toolkit for Javascript and\nupload them to Transifex for translation.\n\nTo push content some environment variables must be set:\nTRANSIFEX_TOKEN=<Transifex Native Project Token>\nTRANSIFEX_SECRET=<Transifex Native Project Secret>\n(optional) TRANSIFEX_CDS_HOST=<CDS HOST>\n\nor passed as --token=<TOKEN> --secret=<SECRET> parameters\n\nDefault CDS Host is https://cds.svc.transifex.net\n\nExamples:\ntxjs-cli push -v\ntxjs-cli push src/\ntxjs-cli push /home/repo/src\ntxjs-cli push \"*.js\"\ntxjs-cli push --dry-run\ntxjs-cli push --fake -v\ntxjs-cli push --no-wait\ntxjs-cli push --key-generator=hash\ntxjs-cli push --append-tags=\"master,release:2.5\"\ntxjs-cli push --with-tags-only=\"home,error\"\ntxjs-cli push --without-tags-only=\"custom\"\ntxjs-cli push --token=mytoken --secret=mysecret\ntxjs-cli push en.json --parser=i18next\ntxjs-cli push en.json --parser=txnativejson\nTRANSIFEX_TOKEN=mytoken TRANSIFEX_SECRET=mysecret txjs-cli push\n","pluginName":"@transifex/cli","pluginType":"core","aliases":[],"flags":{"dry-run":{"name":"dry-run","type":"boolean","description":"dry run, do not apply changes in Transifex","allowNo":false},"fake":{"name":"fake","type":"boolean","description":"do not push content to remote server","allowNo":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"verbose output","allowNo":false},"purge":{"name":"purge","type":"boolean","description":"purge content on Transifex","allowNo":false},"no-wait":{"name":"no-wait","type":"boolean","description":"disable polling for upload results","allowNo":false},"token":{"name":"token","type":"option","description":"native project public token","default":""},"secret":{"name":"secret","type":"option","description":"native project secret","default":""},"append-tags":{"name":"append-tags","type":"option","description":"append tags to strings","default":""},"with-tags-only":{"name":"with-tags-only","type":"option","description":"push strings with specific tags","default":""},"without-tags-only":{"name":"without-tags-only","type":"option","description":"push strings without specific tags","default":""},"cds-host":{"name":"cds-host","type":"option","description":"CDS host URL","default":""},"parser":{"name":"parser","type":"option","description":"file parser to use","options":["auto","i18next","txnativejson"],"default":"auto"},"key-generator":{"name":"key-generator","type":"option","description":"use hashed or source based keys","options":["source","hash"],"default":"source"}},"args":[{"name":"pattern","description":"file pattern to scan for strings","required":false,"default":"**/*.{js,jsx,ts,tsx,html,vue,pug,ejs}"}]}}}
1
+ {"version":"5.2.0","commands":{"invalidate":{"id":"invalidate","description":"Invalidate and refresh CDS cache\nContent for delivery is cached in CDS and refreshed automatically every hour.\nThis command triggers a refresh of cached content on the fly.\n\nBy default, invalidation does not remove existing cached content,\nbut starts the process of updating with latest translations from Transifex.\n\nPassing the --purge option, cached content will be forced to be deleted,\nhowever use that with caution, as it may introduce downtime of\ntranslation delivery to the apps until fresh content is cached in the CDS.\n\nTo invalidate translations some environment variables must be set:\nTRANSIFEX_TOKEN=<Transifex Native Project Token>\nTRANSIFEX_SECRET=<Transifex Native Project Secret>\n(optional) TRANSIFEX_CDS_HOST=<CDS HOST>\n\nor passed as --token=<TOKEN> --secret=<SECRET> parameters\n\nDefault CDS Host is https://cds.svc.transifex.net\n\nExamples:\ntxjs-cli invalidate\ntxjs-cli invalidate --purge\ntxjs-cli invalidate --token=mytoken --secret=mysecret\nTRANSIFEX_TOKEN=mytoken TRANSIFEX_SECRET=mysecret txjs-cli invalidate\n","pluginName":"@transifex/cli","pluginType":"core","aliases":[],"flags":{"purge":{"name":"purge","type":"boolean","description":"force delete CDS cached content","allowNo":false},"token":{"name":"token","type":"option","description":"native project public token","default":""},"secret":{"name":"secret","type":"option","description":"native project secret","default":""},"cds-host":{"name":"cds-host","type":"option","description":"CDS host URL","default":""}},"args":[]},"pull":{"id":"pull","description":"Pull content from Transifex for offline caching\nGet content as JSON files, to be used by mobile Javascript SDKs for\noffline support or warming up the cache with initial translations.\n\nBy default, JSON files are printed in the console,\nunless the \"-f foldername\" parameter is provided. In that case\nthe JSON files will be downloaded to that folder with the <locale>.json format.\n\nTo pull content some environment variables must be set:\nTRANSIFEX_TOKEN=<Transifex Native Project Token>\nTRANSIFEX_SECRET=<Transifex Native Project Secret>\n(optional) TRANSIFEX_CDS_HOST=<CDS HOST>\n\nor passed as --token=<TOKEN> --secret=<SECRET> parameters\n\nDefault CDS Host is https://cds.svc.transifex.net\n\nExamples:\ntxjs-cli pull\ntxjs-cli pull --pretty\ntxjs-cli pull -f languages/\ntxjs-cli pull --locale=fr -f .\ntxjs-cli pull --filter-tags=\"foo,bar\"\ntxjs-cli pull --filter-status=\"reviewed\"\ntxjs-cli pull --token=mytoken --secret=mysecret\nTRANSIFEX_TOKEN=mytoken TRANSIFEX_SECRET=mysecret txjs-cli pull\n","pluginName":"@transifex/cli","pluginType":"core","aliases":[],"flags":{"token":{"name":"token","type":"option","description":"native project public token","default":""},"secret":{"name":"secret","type":"option","description":"native project secret","default":""},"folder":{"name":"folder","type":"option","char":"f","description":"output as files to folder","default":""},"locale":{"name":"locale","type":"option","char":"l","description":"pull specific language locale code","default":""},"pretty":{"name":"pretty","type":"boolean","description":"beautify JSON output","allowNo":false},"filter-tags":{"name":"filter-tags","type":"option","description":"filter over specific tags","default":""},"filter-status":{"name":"filter-status","type":"option","description":"filter over translation status","options":["reviewed","proofread","finalized"],"default":""},"cds-host":{"name":"cds-host","type":"option","description":"CDS host URL","default":""}},"args":[]},"push":{"id":"push","description":"Detect and push source content to Transifex\nParse .js, .ts, .jsx, .tsx and .html files and detect phrases marked for\ntranslation by Transifex Native toolkit for Javascript and\nupload them to Transifex for translation.\n\nTo push content some environment variables must be set:\nTRANSIFEX_TOKEN=<Transifex Native Project Token>\nTRANSIFEX_SECRET=<Transifex Native Project Secret>\n(optional) TRANSIFEX_CDS_HOST=<CDS HOST>\n\nor passed as --token=<TOKEN> --secret=<SECRET> parameters\n\nDefault CDS Host is https://cds.svc.transifex.net\n\nExamples:\ntxjs-cli push -v\ntxjs-cli push src/\ntxjs-cli push /home/repo/src\ntxjs-cli push \"*.js\"\ntxjs-cli push --dry-run\ntxjs-cli push --fake -v\ntxjs-cli push --no-wait\ntxjs-cli push --key-generator=hash\ntxjs-cli push --append-tags=\"master,release:2.5\"\ntxjs-cli push --with-tags-only=\"home,error\"\ntxjs-cli push --without-tags-only=\"custom\"\ntxjs-cli push --token=mytoken --secret=mysecret\ntxjs-cli push en.json --parser=i18next\ntxjs-cli push en.json --parser=txnativejson\nTRANSIFEX_TOKEN=mytoken TRANSIFEX_SECRET=mysecret txjs-cli push\n","pluginName":"@transifex/cli","pluginType":"core","aliases":[],"flags":{"dry-run":{"name":"dry-run","type":"boolean","description":"dry run, do not apply changes in Transifex","allowNo":false},"fake":{"name":"fake","type":"boolean","description":"do not push content to remote server","allowNo":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"verbose output","allowNo":false},"purge":{"name":"purge","type":"boolean","description":"purge content on Transifex","allowNo":false},"no-wait":{"name":"no-wait","type":"boolean","description":"disable polling for upload results","allowNo":false},"token":{"name":"token","type":"option","description":"native project public token","default":""},"secret":{"name":"secret","type":"option","description":"native project secret","default":""},"append-tags":{"name":"append-tags","type":"option","description":"append tags to strings","default":""},"with-tags-only":{"name":"with-tags-only","type":"option","description":"push strings with specific tags","default":""},"without-tags-only":{"name":"without-tags-only","type":"option","description":"push strings without specific tags","default":""},"cds-host":{"name":"cds-host","type":"option","description":"CDS host URL","default":""},"do-not-keep-translations":{"name":"do-not-keep-translations","type":"boolean","description":"remove translations when source strings change","allowNo":false},"override-tags":{"name":"override-tags","type":"boolean","description":"override tags when pushing content","allowNo":false},"parser":{"name":"parser","type":"option","description":"file parser to use","options":["auto","i18next","txnativejson"],"default":"auto"},"key-generator":{"name":"key-generator","type":"option","description":"use hashed or source based keys","options":["source","hash"],"default":"source"}},"args":[{"name":"pattern","description":"file pattern to scan for strings","required":false,"default":"**/*.{js,jsx,ts,tsx,html,vue,pug,ejs}"}]}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@transifex/cli",
3
3
  "description": "i18n CLI tool for Transifex Native",
4
- "version": "5.1.1",
4
+ "version": "5.2.0",
5
5
  "author": "Transifex",
6
6
  "keywords": [
7
7
  "transifex",
@@ -28,7 +28,7 @@
28
28
  "@babel/traverse": "^7.20.1",
29
29
  "@colors/colors": "^1.5.0",
30
30
  "@oclif/core": "^1.20.4",
31
- "@transifex/native": "^5.1.1",
31
+ "@transifex/native": "^5.2.0",
32
32
  "@vue/compiler-sfc": "^3.2.45",
33
33
  "angular-html-parser": "^1.8.0",
34
34
  "axios": "^1.1.3",
package/src/api/upload.js CHANGED
@@ -19,6 +19,8 @@ async function uploadPhrases(payload, params) {
19
19
  meta: {
20
20
  purge: !!params.purge,
21
21
  dry_run: !!params.dry_run,
22
+ keep_translations: !params.do_not_keep_translations,
23
+ override_tags: !!params.override_tags,
22
24
  },
23
25
  }, {
24
26
  headers: {
@@ -168,6 +168,8 @@ class PushCommand extends Command {
168
168
  token: projectToken,
169
169
  secret: projectSecret,
170
170
  purge: flags.purge,
171
+ do_not_keep_translations: flags['do-not-keep-translations'],
172
+ override_tags: flags['override-tags'],
171
173
  dry_run: flags['dry-run'],
172
174
  });
173
175
 
@@ -318,6 +320,14 @@ PushCommand.flags = {
318
320
  description: 'CDS host URL',
319
321
  default: '',
320
322
  }),
323
+ 'do-not-keep-translations': Flags.boolean({
324
+ description: 'remove translations when source strings change',
325
+ default: false,
326
+ }),
327
+ 'override-tags': Flags.boolean({
328
+ description: 'override tags when pushing content',
329
+ default: false,
330
+ }),
321
331
  parser: Flags.string({
322
332
  description: 'file parser to use',
323
333
  default: 'auto',