@talend/i18n-scripts
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "@talend/i18n-scripts", | ||
"version": "0.1.0", | ||
"description": "Download i18n locales for current version of package", | ||
"description": "Set of scripts to ease i18n workflow", | ||
"version": "0.1.1", | ||
"license": "Apache-2.0", | ||
"main": "index.js", | ||
"bin": { | ||
"download-locales": "./download-locales/index.js" | ||
"talend-i18n": "./index.js" | ||
}, | ||
"author": "Talend Frontend <frontend@talend.com>", | ||
"homepage": "https://github.com/Talend/ui/tree/master/packages/i18n-scripts#readme", | ||
"homepage": "https://github.com/Talend/i18n-product/scripts#readme", | ||
"bugs": { | ||
"url": "https://github.com/Talend/ui/issues" | ||
"url": "https://github.com/Talend/i18n-product/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/Talend/ui.git" | ||
"url": "https://github.com/Talend/i18n-product.git" | ||
}, | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"download": "^7.0.0" | ||
"adm-zip": "0.4.11", | ||
"chalk": "^2.4.1", | ||
"cross-spawn": "^6.0.4", | ||
"form-data": "^2.3.3", | ||
"lodash.template": "^4.4.0", | ||
"lodash.templatesettings": "^4.1.0", | ||
"merge-dirs": "^0.2.1", | ||
"mkdirp": "^0.5.1", | ||
"node-fetch": "^2.2.0", | ||
"rimraf": "^2.6.2", | ||
"shelljs": "^0.8.2", | ||
"xml2json": "^0.11.2" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
229
README.md
@@ -1,14 +0,227 @@ | ||
# @talend/i18n-scripts | ||
Collection of i18n-related scripts | ||
# Talend i18n scripts | ||
# download-locales | ||
Download-locales will download locales from zip files attached to the Github releases for the current release. This way, if we put the script in `postinstall`, we don't have to wait for locales before publishing ui packages, but we can update them after. Apps that install ui packages using this script will get up-to-date locales when they do yarn install. | ||
<img src="./process.png"> | ||
Name of zip should be "[package.json name (minus `@talend/`)]-loales.zip" | ||
The i18n process has multiple steps | ||
Add this script in package.json: | ||
1- Extract and upload | ||
2- Translation within the cloud system | ||
3- Download and versionning to github | ||
4- Download translated files to the bundle | ||
The @talend/i18n-scripts module targets steps 1 - 2 - 3. | ||
# Installation | ||
```shell | ||
yarn global install @talend/i18n-scripts | ||
``` | ||
or | ||
```shell | ||
npm install -g @talend/i18n-scripts | ||
``` | ||
Now the cli `talend-i18n` is available. | ||
# Actions | ||
There are 4 actions you can perform | ||
```shell | ||
talend-i18n extract | ||
talend-i18n upload | ||
talend-i18n download | ||
talend-i18n deploy | ||
``` | ||
# Configuration | ||
The scripts are based on a `talend-i18n.json` configuration file at project root. | ||
## Extract | ||
This step will extract the i18n files from the project and create a zip. | ||
All the files will be wrapped in a folder with your app extracted version. | ||
The version (major.minor) is taken from files at project root. | ||
* lerna.json | ||
* pom.xml | ||
* package.json | ||
There are 4 methods of extraction | ||
- npm : run an npm script | ||
- yarn : same as npm but with yarn | ||
- files : get the files from a list of path | ||
- expression : get the files matching an expression, starting with a provided folder | ||
*Npm/Yarn* | ||
```json | ||
"scripts": { | ||
"postinstall": "download-locales" | ||
{ | ||
"extract": { | ||
"method": "npm", | ||
"script": "extract-i18n", | ||
"target": "./i18n", | ||
"transform": "flatten" | ||
} | ||
} | ||
``` | ||
| Configuration | Description | | ||
|---|---| | ||
| method | `npm` or `yarn` | | ||
| script | The npm script name | | ||
| target | The folder where the npm script will gather the translation files. This is used to create the zip file. | | ||
| transform | Optional. Transformation to apply to file hierarchy. For now only `flatten` is accepted, putting all file directly under the target language folder. | | ||
*Files* | ||
```json | ||
{ | ||
"extract": { | ||
"method": "files", | ||
"files": ["./src/i18n/translation.json", "./src/app/other.json"], | ||
"target": "./i18n" | ||
} | ||
} | ||
``` | ||
| Configuration | Description | | ||
|---|---| | ||
| method | `npm` or `yarn` | | ||
| files | The list of files to extract. | | ||
| target | The folder where the script will gather the translation files. This is used to create the zip file. Note that the files folder hierarchy is preserved. | | ||
*Expression* | ||
```json | ||
{ | ||
"extract": { | ||
"method": "expression", | ||
"rootPath": "./src", | ||
"expression": "message*.json", | ||
"target": "./i18n" | ||
} | ||
} | ||
``` | ||
| Configuration | Description | | ||
|---|---| | ||
| method | `expression` | | ||
| rootPath | The folder to start the search. | | ||
| expression | Expression describing the files name. You can use `*` as wildcard. `message*.json` means every files that start with `message` and end with `.json` (ex: message-errors.json, message.json, ...), whereas `message.json` matches only the `message.json` files. | | ||
| target | The folder where the script will gather the translation files. This is used to create the zip file. Note that the files folder hierarchy is preserved. | | ||
## Upload/Download | ||
You need to pass xtm information as environment variables | ||
```shell | ||
> XTM_API_URL=https://XXX \ | ||
XTM_CUSTOMER_ID=YYY \ | ||
XTM_TOKEN=ZZZ \ | ||
talend-i18n <upload|download> | ||
``` | ||
| Variable | Description | | ||
|---|---| | ||
| XTM_API_URL | The XTM api url | | ||
| XTM_CUSTOMER_ID | The XTM customer ID | | ||
| XTM_TOKEN | The XTM authentication token | | ||
### Upload | ||
This step will upload previously created i18n zip to XTM. | ||
```json | ||
{ | ||
"load": { | ||
"project": "UI" | ||
} | ||
} | ||
``` | ||
| Configuration | Description | | ||
|---|---| | ||
| project | The XTM project name. | | ||
### Download | ||
This step will download, unzip and transform files from XTM. | ||
```json | ||
{ | ||
"load": { | ||
"project": "UI" | ||
} | ||
} | ||
``` | ||
| Configuration | Description | | ||
|---|---| | ||
| project | The XTM project name. | | ||
It will download only the files corresponding to the current version of your project (version extracted). If no version is detected, all versions will be downloaded. | ||
### Deploy | ||
This step will push downloaded i18n files to github. Files will be generated to create a npm or maven module. For now, no module is deployed on npm/mvn repositories. | ||
You need to pass github credentials as environment variables. | ||
```shell | ||
> GITHUB_LOGIN=XXX \ | ||
GITHUB_TOKEN=YYY \ | ||
talend-i18n deploy | ||
``` | ||
| Variable | Description | | ||
|---|---| | ||
| GITHUB_LOGIN | Github username that will be used to push to the locales repo | | ||
| GITHUB_TOKEN | Github token | | ||
`talend-i18n.json` configuration | ||
```json | ||
{ | ||
"github": { | ||
"url": "https://github.com/Talend/locales.git" | ||
}, | ||
"module": { | ||
"type": "mvn", | ||
"private": true, | ||
"repository": { | ||
"id": "private-releases", | ||
"url": "https://mydomain.com/nexus/content/repositories/MyPrivateSourceRelease" | ||
} | ||
} | ||
} | ||
``` | ||
| Configuration | Type | Description | | ||
|---|---|---| | ||
| github.url | `string` | The https git url. | | ||
| module.type | `string` | The module type to deploy (`npm` | `mvn`). | | ||
| module.private | `boolean` | If the module should be private. | | ||
| module.repository | `object` | This will be set in pom.xml for `mvn` modules. It should reflect the repository this module should be released. | | ||
| module.repository.id | `string` | The repository id. | | ||
| module.repository.url | `string` | The repository url. | | ||
The i18n files will be pushed to a branch `{XTM_project}/{version}`. | ||
With this branch structure, the locales for your project can be downloaded from a defined url. | ||
``` | ||
https://github.com/{github_org}/{repo_name}/archive/{XTM_project}/{version}.zip | ||
``` | ||
In the example : | ||
``` | ||
https://github.com/Talend/locales/archive/UI/1.10.zip | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
119858
20
1054
228
12
1
22
5
+ Addedadm-zip@0.4.11
+ Addedchalk@^2.4.1
+ Addedcross-spawn@^6.0.4
+ Addedform-data@^2.3.3
+ Addedlodash.template@^4.4.0
+ Addedmerge-dirs@^0.2.1
+ Addedmkdirp@^0.5.1
+ Addednode-fetch@^2.2.0
+ Addedrimraf@^2.6.2
+ Addedshelljs@^0.8.2
+ Addedxml2json@^0.11.2
+ Addedadm-zip@0.4.11(transitive)
+ Addedansi-escapes@1.4.0(transitive)
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.13.2.1(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbindings@1.5.0(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedchalk@1.1.32.4.2(transitive)
+ Addedcli-cursor@1.0.2(transitive)
+ Addedcli-width@1.1.1(transitive)
+ Addedcode-point-at@1.1.0(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedcross-spawn@6.0.5(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedexit-hook@1.1.1(transitive)
+ Addedfigures@1.7.0(transitive)
+ Addedfile-uri-to-path@1.0.0(transitive)
+ Addedform-data@2.5.1(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhoek@4.3.15.0.46.1.3(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.3(transitive)
+ Addedinquirer@0.11.4(transitive)
+ Addedinterpret@1.4.0(transitive)
+ Addedis-core-module@2.15.1(transitive)
+ Addedis-fullwidth-code-point@1.0.0(transitive)
+ Addedisemail@3.2.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedjoi@13.7.0(transitive)
+ Addedlodash@3.10.1(transitive)
+ Addedlodash._reinterpolate@3.0.0(transitive)
+ Addedlodash.template@4.5.0(transitive)
+ Addedlodash.templatesettings@4.2.0(transitive)
+ Addedmerge-dirs@0.2.1(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedmute-stream@0.0.5(transitive)
+ Addednan@2.20.0(transitive)
+ Addednice-try@1.0.5(transitive)
+ Addednode-expat@2.4.1(transitive)
+ Addednode-fetch@2.7.0(transitive)
+ Addednode-fs@0.1.7(transitive)
+ Addednumber-is-nan@1.0.1(transitive)
+ Addedonetime@1.1.0(transitive)
+ Addedpath@0.12.7(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-key@2.0.1(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedprocess@0.11.10(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedreadline2@1.0.1(transitive)
+ Addedrechoir@0.6.2(transitive)
+ Addedresolve@1.22.8(transitive)
+ Addedrestore-cursor@1.0.1(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedrun-async@0.1.0(transitive)
+ Addedrx-lite@3.1.2(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedshebang-command@1.2.0(transitive)
+ Addedshebang-regex@1.0.0(transitive)
+ Addedshelljs@0.8.5(transitive)
+ Addedstring-width@1.0.2(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedsupports-color@2.0.05.5.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedtopo@3.0.3(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedutil@0.10.4(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
+ Addedwhich@1.3.1(transitive)
+ Addedxml2json@0.11.2(transitive)
- Removeddownload@^7.0.0
- Removed@sindresorhus/is@0.7.0(transitive)
- Removedarchive-type@4.0.0(transitive)
- Removedbase64-js@1.5.1(transitive)
- Removedbl@1.2.3(transitive)
- Removedbuffer@5.7.1(transitive)
- Removedbuffer-alloc@1.2.0(transitive)
- Removedbuffer-alloc-unsafe@1.1.0(transitive)
- Removedbuffer-crc32@0.2.13(transitive)
- Removedbuffer-fill@1.0.0(transitive)
- Removedcacheable-request@2.1.4(transitive)
- Removedcaw@2.0.1(transitive)
- Removedclone-response@1.0.2(transitive)
- Removedcommander@2.20.3(transitive)
- Removedconfig-chain@1.1.13(transitive)
- Removedcontent-disposition@0.5.4(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddecode-uri-component@0.2.2(transitive)
- Removeddecompress@4.2.1(transitive)
- Removeddecompress-response@3.3.0(transitive)
- Removeddecompress-tar@4.1.1(transitive)
- Removeddecompress-tarbz2@4.1.1(transitive)
- Removeddecompress-targz@4.1.1(transitive)
- Removeddecompress-unzip@4.0.1(transitive)
- Removeddownload@7.1.0(transitive)
- Removedduplexer3@0.1.5(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedext-list@2.2.2(transitive)
- Removedext-name@5.0.0(transitive)
- Removedfd-slicer@1.1.0(transitive)
- Removedfile-type@3.9.04.4.05.2.06.2.08.1.0(transitive)
- Removedfilename-reserved-regex@2.0.0(transitive)
- Removedfilenamify@2.1.0(transitive)
- Removedfrom2@2.3.0(transitive)
- Removedfs-constants@1.0.0(transitive)
- Removedget-proxy@2.1.0(transitive)
- Removedget-stream@2.3.13.0.0(transitive)
- Removedgot@8.3.2(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhas-symbol-support-x@1.4.2(transitive)
- Removedhas-to-string-tag-x@1.4.1(transitive)
- Removedhttp-cache-semantics@3.8.1(transitive)
- Removedieee754@1.2.1(transitive)
- Removedini@1.3.8(transitive)
- Removedinto-stream@3.1.0(transitive)
- Removedis-natural-number@4.0.1(transitive)
- Removedis-object@1.0.2(transitive)
- Removedis-plain-obj@1.1.0(transitive)
- Removedis-retry-allowed@1.2.0(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisarray@1.0.0(transitive)
- Removedisurl@1.0.0(transitive)
- Removedjson-buffer@3.0.0(transitive)
- Removedkeyv@3.0.0(transitive)
- Removedlowercase-keys@1.0.01.0.1(transitive)
- Removedmake-dir@1.3.0(transitive)
- Removedmime-db@1.53.0(transitive)
- Removedmimic-response@1.0.1(transitive)
- Removednormalize-url@2.0.1(transitive)
- Removednpm-conf@1.1.3(transitive)
- Removedp-cancelable@0.4.1(transitive)
- Removedp-event@2.3.1(transitive)
- Removedp-finally@1.0.0(transitive)
- Removedp-is-promise@1.1.0(transitive)
- Removedp-timeout@2.0.1(transitive)
- Removedpend@1.2.0(transitive)
- Removedpify@2.3.03.0.0(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedpinkie-promise@2.0.1(transitive)
- Removedprepend-http@2.0.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedproto-list@1.2.4(transitive)
- Removedquery-string@5.1.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedresponselike@1.0.2(transitive)
- Removedsafe-buffer@5.1.25.2.1(transitive)
- Removedseek-bzip@1.0.6(transitive)
- Removedsort-keys@1.1.22.0.0(transitive)
- Removedsort-keys-length@1.0.1(transitive)
- Removedstrict-uri-encode@1.1.0(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedstrip-dirs@2.1.0(transitive)
- Removedstrip-outer@1.0.1(transitive)
- Removedtar-stream@1.6.2(transitive)
- Removedtimed-out@4.0.1(transitive)
- Removedto-buffer@1.1.1(transitive)
- Removedtrim-repeated@1.0.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedunbzip2-stream@1.4.3(transitive)
- Removedurl-parse-lax@3.0.0(transitive)
- Removedurl-to-options@1.0.1(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedxtend@4.0.2(transitive)
- Removedyauzl@2.10.0(transitive)