@kununu/phraseapp-cli 3.1.0-beta.2 → 3.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 +29 -30
- package/index.js +6 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -1,59 +1,58 @@
|
|
|
1
1
|
# phraseapp-cli
|
|
2
|
-
>
|
|
2
|
+
>
|
|
3
|
+
> phraseapp-cli for <https://phraseapp.com/>
|
|
3
4
|
|
|
4
5
|
## Installation
|
|
5
6
|
|
|
7
|
+
### Add `@kununu/phraseapp-cli` to your project
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @kununu/phraseapp-cli --save
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Add `update-translations` to your project
|
|
14
|
+
|
|
6
15
|
Add to ```package.json```
|
|
16
|
+
|
|
7
17
|
```json
|
|
8
|
-
"
|
|
9
|
-
```
|
|
10
|
-
```sh
|
|
11
|
-
$ npm i
|
|
12
|
-
```
|
|
13
|
-
```sh
|
|
14
|
-
$ npm link
|
|
18
|
+
"update-translations": "node ./node_modules/@kununu/phraseapp-cli/index.js",
|
|
15
19
|
```
|
|
20
|
+
|
|
21
|
+
### Add env vars
|
|
22
|
+
|
|
23
|
+
Make sure PHRASEAPP_PROJECT_ID and PHRASEAPP_ACCESS_TOKEN are properly configured.
|
|
24
|
+
|
|
16
25
|
## Configuration file
|
|
17
26
|
|
|
18
|
-
You have to
|
|
27
|
+
You have to add the ```.phraseapp.json``` file
|
|
19
28
|
|
|
20
29
|
**For example**:
|
|
30
|
+
|
|
21
31
|
```json
|
|
22
32
|
{
|
|
23
|
-
"access_token": "YOUR_ACCESS_TOKEN",
|
|
24
33
|
"project_id": "YOUR_PROJECT_ID",
|
|
25
34
|
"path": "YOUR_TRANSLATIONS_PATH",
|
|
26
|
-
"locales":[
|
|
35
|
+
"locales": [
|
|
27
36
|
{
|
|
28
|
-
"locale_id": "
|
|
29
|
-
"tags":[
|
|
37
|
+
"locale_id": "de_DE",
|
|
38
|
+
"tags": [
|
|
30
39
|
"TAG1",
|
|
31
40
|
"TAG2",
|
|
32
41
|
"TAG3"
|
|
33
42
|
]
|
|
34
43
|
},
|
|
35
44
|
{
|
|
36
|
-
"locale_id": "
|
|
37
|
-
|
|
45
|
+
"locale_id": "de_AT",
|
|
46
|
+
"tags": [
|
|
47
|
+
(...)
|
|
48
|
+
],
|
|
49
|
+
"fallback_locale_id": "de_DE"
|
|
50
|
+
},
|
|
51
|
+
(...)
|
|
38
52
|
]
|
|
39
53
|
}
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
## Config parameters
|
|
43
|
-
- locale_id (**required**) - for example **pl_PL**
|
|
44
|
-
- tags (*optional array*) - project tag
|
|
45
|
-
## Usage
|
|
46
|
-
|
|
47
|
-
```js
|
|
48
|
-
phraseapp-cli
|
|
49
54
|
```
|
|
50
55
|
|
|
51
|
-
|
|
52
56
|
## License
|
|
53
57
|
|
|
54
58
|
Apache-2.0 © [kununu](https://kununu.com)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
[npm-image]: https://badge.fury.io/js/kununu.svg
|
|
58
|
-
[npm-url]: https://npmjs.org/package/kununu
|
|
59
|
-
[phraseapp-config]: https://phraseapp.com/docs/developers/cli/configuration/
|
package/index.js
CHANGED
|
@@ -36,11 +36,16 @@ function loadConfig() {
|
|
|
36
36
|
try {
|
|
37
37
|
const phrase = JSON.parse(fs.readFileSync(configPath));
|
|
38
38
|
|
|
39
|
-
// override
|
|
39
|
+
// override access token with env var, if available
|
|
40
40
|
if (process.env.PHRASEAPP_ACCESS_TOKEN) {
|
|
41
41
|
phrase.access_token = process.env.PHRASEAPP_ACCESS_TOKEN;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
// override project id with env var, if available
|
|
45
|
+
if (process.env.PHRASEAPP_PROJECT_ID) {
|
|
46
|
+
phrase.project_id = process.env.PHRASEAPP_PROJECT_ID;
|
|
47
|
+
}
|
|
48
|
+
|
|
44
49
|
if (!phrase.locales) {
|
|
45
50
|
errors.push(
|
|
46
51
|
'Error: please provide locales in config file ( for example: locales: "pl_PL" ).',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kununu/phraseapp-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "kununu",
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"dotenv": "16.4.5"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@babel/eslint-plugin": "7.23.5",
|
|
17
16
|
"@kununu/eslint-config": "5.0.1"
|
|
18
17
|
}
|
|
19
18
|
}
|