@vocab/cli 1.2.0 → 1.3.1
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/LICENSE +21 -0
- package/README.md +66 -5
- package/dist/declarations/src/index.d.ts +1 -1
- package/dist/vocab-cli.cjs.dev.js +7 -7
- package/dist/vocab-cli.cjs.prod.js +7 -7
- package/dist/vocab-cli.esm.js +2 -2
- package/package.json +10 -5
- package/CHANGELOG.md +0 -204
- package/src/index.ts +0 -73
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
### MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 SEEK
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -422,20 +422,81 @@ Or to re-run the compiler when files change use:
|
|
|
422
422
|
$ vocab compile --watch
|
|
423
423
|
```
|
|
424
424
|
|
|
425
|
-
## External
|
|
425
|
+
## External Translation Tooling
|
|
426
426
|
|
|
427
427
|
Vocab can be used to synchronize your translations with translations from a remote translation platform.
|
|
428
428
|
|
|
429
|
-
| Platform
|
|
430
|
-
|
|
|
431
|
-
| [Phrase]
|
|
429
|
+
| Platform | Environment Variables |
|
|
430
|
+
| -------- | ----------------------------------- |
|
|
431
|
+
| [Phrase] | PHRASE_PROJECT_ID, PHRASE_API_TOKEN |
|
|
432
432
|
|
|
433
433
|
```bash
|
|
434
434
|
$ vocab push --branch my-branch
|
|
435
|
-
$ vocab push --branch my-branch --delete-unused-keys
|
|
436
435
|
$ vocab pull --branch my-branch
|
|
437
436
|
```
|
|
438
437
|
|
|
438
|
+
### [Phrase] Platform Features
|
|
439
|
+
|
|
440
|
+
#### Delete Unused keys
|
|
441
|
+
|
|
442
|
+
When uploading translations, Phrase identifies keys that exist in the Phrase project, but were not
|
|
443
|
+
referenced in the upload. These keys can be deleted from Phrase by providing the
|
|
444
|
+
`---delete-unused-keys` flag to `vocab push`. E.g.
|
|
445
|
+
|
|
446
|
+
```sh
|
|
447
|
+
$ vocab push --branch my-branch --delete-unused-keys
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
[phrase]: https://developers.phrase.com/api/
|
|
451
|
+
|
|
452
|
+
#### [Tags]
|
|
453
|
+
|
|
454
|
+
`vocab push` supports uploading [tags] to Phrase.
|
|
455
|
+
|
|
456
|
+
Tags can be added to an individual key via the `tags` property:
|
|
457
|
+
|
|
458
|
+
```jsonc
|
|
459
|
+
// translations.json
|
|
460
|
+
{
|
|
461
|
+
"Hello": {
|
|
462
|
+
"message": "Hello",
|
|
463
|
+
"tags": ["greeting", "home_page"]
|
|
464
|
+
},
|
|
465
|
+
"Goodbye": {
|
|
466
|
+
"message": "Goodbye",
|
|
467
|
+
"tags": ["home_page"]
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
Tags can also be added under a top-level `_meta` field. This will result in the tags applying to all
|
|
473
|
+
keys specified in the file:
|
|
474
|
+
|
|
475
|
+
```jsonc
|
|
476
|
+
// translations.json
|
|
477
|
+
{
|
|
478
|
+
"_meta": {
|
|
479
|
+
"tags": ["home_page"]
|
|
480
|
+
},
|
|
481
|
+
"Hello": {
|
|
482
|
+
"message": "Hello",
|
|
483
|
+
"tags": ["greeting"]
|
|
484
|
+
},
|
|
485
|
+
"Goodbye": {
|
|
486
|
+
"message": "Goodbye"
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
In the above example, both the `Hello` and `Goodbye` keys would have the `home_page` tag attached to
|
|
492
|
+
them, but only the `Hello` key would have the `usage_greeting` tag attached to it.
|
|
493
|
+
|
|
494
|
+
**NOTE**: Only tags specified on keys in your [`devLanguage`][configuration] will be uploaded.
|
|
495
|
+
Tags on keys in other languages will be ignored.
|
|
496
|
+
|
|
497
|
+
[tags]: https://support.phrase.com/hc/en-us/articles/5822598372252-Tags-Strings-
|
|
498
|
+
[configuration]: #Configuration
|
|
499
|
+
|
|
439
500
|
## Troubleshooting
|
|
440
501
|
|
|
441
502
|
### Problem: Passed locale is being ignored or using en-US instead
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -13,15 +13,16 @@ var envCi__default = /*#__PURE__*/_interopDefault(envCi);
|
|
|
13
13
|
/* eslint-disable no-console */
|
|
14
14
|
const {
|
|
15
15
|
branch
|
|
16
|
-
} = envCi__default[
|
|
16
|
+
} = envCi__default["default"]();
|
|
17
17
|
const branchDefinition = {
|
|
18
18
|
type: 'string',
|
|
19
19
|
describe: 'The Phrase branch to target',
|
|
20
20
|
default: branch || 'local-development'
|
|
21
21
|
};
|
|
22
|
-
let config = null;
|
|
22
|
+
let config = null;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
25
|
+
yargs__default["default"](process.argv.slice(2)).scriptName('vocab').option('config', {
|
|
25
26
|
type: 'string',
|
|
26
27
|
describe: 'Path to config file'
|
|
27
28
|
}).middleware(async ({
|
|
@@ -31,7 +32,7 @@ yargs__default['default'](process.argv.slice(2)).scriptName('vocab').option('con
|
|
|
31
32
|
console.log('Loaded config from', configPath || process.cwd());
|
|
32
33
|
}).command({
|
|
33
34
|
command: 'push',
|
|
34
|
-
builder: () => yargs__default[
|
|
35
|
+
builder: () => yargs__default["default"].options({
|
|
35
36
|
branch: branchDefinition,
|
|
36
37
|
'delete-unused-keys': {
|
|
37
38
|
type: 'boolean',
|
|
@@ -44,7 +45,7 @@ yargs__default['default'](process.argv.slice(2)).scriptName('vocab').option('con
|
|
|
44
45
|
}
|
|
45
46
|
}).command({
|
|
46
47
|
command: 'pull',
|
|
47
|
-
builder: () => yargs__default[
|
|
48
|
+
builder: () => yargs__default["default"].options({
|
|
48
49
|
branch: branchDefinition
|
|
49
50
|
}),
|
|
50
51
|
handler: async options => {
|
|
@@ -52,7 +53,7 @@ yargs__default['default'](process.argv.slice(2)).scriptName('vocab').option('con
|
|
|
52
53
|
}
|
|
53
54
|
}).command({
|
|
54
55
|
command: 'compile',
|
|
55
|
-
builder: () => yargs__default[
|
|
56
|
+
builder: () => yargs__default["default"].options({
|
|
56
57
|
watch: {
|
|
57
58
|
type: 'boolean',
|
|
58
59
|
default: false
|
|
@@ -69,7 +70,6 @@ yargs__default['default'](process.argv.slice(2)).scriptName('vocab').option('con
|
|
|
69
70
|
command: 'validate',
|
|
70
71
|
handler: async () => {
|
|
71
72
|
const valid = await core.validate(config);
|
|
72
|
-
|
|
73
73
|
if (!valid) {
|
|
74
74
|
throw new Error('Project invalid');
|
|
75
75
|
}
|
|
@@ -13,15 +13,16 @@ var envCi__default = /*#__PURE__*/_interopDefault(envCi);
|
|
|
13
13
|
/* eslint-disable no-console */
|
|
14
14
|
const {
|
|
15
15
|
branch
|
|
16
|
-
} = envCi__default[
|
|
16
|
+
} = envCi__default["default"]();
|
|
17
17
|
const branchDefinition = {
|
|
18
18
|
type: 'string',
|
|
19
19
|
describe: 'The Phrase branch to target',
|
|
20
20
|
default: branch || 'local-development'
|
|
21
21
|
};
|
|
22
|
-
let config = null;
|
|
22
|
+
let config = null;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
25
|
+
yargs__default["default"](process.argv.slice(2)).scriptName('vocab').option('config', {
|
|
25
26
|
type: 'string',
|
|
26
27
|
describe: 'Path to config file'
|
|
27
28
|
}).middleware(async ({
|
|
@@ -31,7 +32,7 @@ yargs__default['default'](process.argv.slice(2)).scriptName('vocab').option('con
|
|
|
31
32
|
console.log('Loaded config from', configPath || process.cwd());
|
|
32
33
|
}).command({
|
|
33
34
|
command: 'push',
|
|
34
|
-
builder: () => yargs__default[
|
|
35
|
+
builder: () => yargs__default["default"].options({
|
|
35
36
|
branch: branchDefinition,
|
|
36
37
|
'delete-unused-keys': {
|
|
37
38
|
type: 'boolean',
|
|
@@ -44,7 +45,7 @@ yargs__default['default'](process.argv.slice(2)).scriptName('vocab').option('con
|
|
|
44
45
|
}
|
|
45
46
|
}).command({
|
|
46
47
|
command: 'pull',
|
|
47
|
-
builder: () => yargs__default[
|
|
48
|
+
builder: () => yargs__default["default"].options({
|
|
48
49
|
branch: branchDefinition
|
|
49
50
|
}),
|
|
50
51
|
handler: async options => {
|
|
@@ -52,7 +53,7 @@ yargs__default['default'](process.argv.slice(2)).scriptName('vocab').option('con
|
|
|
52
53
|
}
|
|
53
54
|
}).command({
|
|
54
55
|
command: 'compile',
|
|
55
|
-
builder: () => yargs__default[
|
|
56
|
+
builder: () => yargs__default["default"].options({
|
|
56
57
|
watch: {
|
|
57
58
|
type: 'boolean',
|
|
58
59
|
default: false
|
|
@@ -69,7 +70,6 @@ yargs__default['default'](process.argv.slice(2)).scriptName('vocab').option('con
|
|
|
69
70
|
command: 'validate',
|
|
70
71
|
handler: async () => {
|
|
71
72
|
const valid = await core.validate(config);
|
|
72
|
-
|
|
73
73
|
if (!valid) {
|
|
74
74
|
throw new Error('Project invalid');
|
|
75
75
|
}
|
package/dist/vocab-cli.esm.js
CHANGED
|
@@ -12,8 +12,9 @@ const branchDefinition = {
|
|
|
12
12
|
describe: 'The Phrase branch to target',
|
|
13
13
|
default: branch || 'local-development'
|
|
14
14
|
};
|
|
15
|
-
let config = null;
|
|
15
|
+
let config = null;
|
|
16
16
|
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
17
18
|
yargs(process.argv.slice(2)).scriptName('vocab').option('config', {
|
|
18
19
|
type: 'string',
|
|
19
20
|
describe: 'Path to config file'
|
|
@@ -62,7 +63,6 @@ yargs(process.argv.slice(2)).scriptName('vocab').option('config', {
|
|
|
62
63
|
command: 'validate',
|
|
63
64
|
handler: async () => {
|
|
64
65
|
const valid = await validate(config);
|
|
65
|
-
|
|
66
66
|
if (!valid) {
|
|
67
67
|
throw new Error('Project invalid');
|
|
68
68
|
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vocab/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"main": "dist/vocab-cli.cjs.js",
|
|
5
5
|
"module": "dist/vocab-cli.esm.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"vocab": "bin.js"
|
|
8
8
|
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"bin.js"
|
|
12
|
+
],
|
|
9
13
|
"author": "SEEK",
|
|
10
14
|
"license": "MIT",
|
|
11
15
|
"dependencies": {
|
|
12
16
|
"@types/env-ci": "^3.1.0",
|
|
13
|
-
"@vocab/core": "^1.
|
|
14
|
-
"@vocab/phrase": "^1.
|
|
17
|
+
"@vocab/core": "^1.2.4",
|
|
18
|
+
"@vocab/phrase": "^1.2.2",
|
|
15
19
|
"env-ci": "^5.0.2",
|
|
16
20
|
"fast-glob": "^3.2.4",
|
|
17
21
|
"form-data": "^3.0.0",
|
|
@@ -22,6 +26,7 @@
|
|
|
22
26
|
"devDependencies": {
|
|
23
27
|
"@types/node-fetch": "^2.5.7",
|
|
24
28
|
"@types/prettier": "^2.1.5",
|
|
25
|
-
"@types/yargs": "^15.0.9"
|
|
29
|
+
"@types/yargs": "^15.0.9",
|
|
30
|
+
"@vocab/types": "^1.1.2"
|
|
26
31
|
}
|
|
27
|
-
}
|
|
32
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
# @vocab/cli
|
|
2
|
-
|
|
3
|
-
## 1.2.0
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- [`66ed22c`](https://github.com/seek-oss/vocab/commit/66ed22cac6f89018d5fd69fd6f6408e090e1a382) [#93](https://github.com/seek-oss/vocab/pull/93) Thanks [@askoufis](https://github.com/askoufis)! - Add an optional `delete-unused-keys` flag to the `push` command. If set to `true`, unused keys will be deleted from Phrase after translations are pushed.
|
|
8
|
-
|
|
9
|
-
**EXAMPLE USAGE**:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
vocab push --delete-unused-keys
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Patch Changes
|
|
16
|
-
|
|
17
|
-
- Updated dependencies [[`66ed22c`](https://github.com/seek-oss/vocab/commit/66ed22cac6f89018d5fd69fd6f6408e090e1a382), [`159d559`](https://github.com/seek-oss/vocab/commit/159d559c87c66c3e91c707fb45a1f67ebec07b4d)]:
|
|
18
|
-
- @vocab/phrase@1.1.0
|
|
19
|
-
|
|
20
|
-
## 1.1.0
|
|
21
|
-
|
|
22
|
-
### Minor Changes
|
|
23
|
-
|
|
24
|
-
- [`87333d7`](https://github.com/seek-oss/vocab/commit/87333d79c4a883b07d7d8f2c272b16e2243c49bd) [#80](https://github.com/seek-oss/vocab/pull/80) Thanks [@askoufis](https://github.com/askoufis)! - Enable the creation of generated languages via the `generatedLanguages` config.
|
|
25
|
-
See [the docs] for more information and examples.
|
|
26
|
-
|
|
27
|
-
[the docs]: https://github.com/seek-oss/vocab#generated-languages
|
|
28
|
-
|
|
29
|
-
### Patch Changes
|
|
30
|
-
|
|
31
|
-
- Updated dependencies [[`87333d7`](https://github.com/seek-oss/vocab/commit/87333d79c4a883b07d7d8f2c272b16e2243c49bd)]:
|
|
32
|
-
- @vocab/core@1.1.0
|
|
33
|
-
|
|
34
|
-
## 1.0.1
|
|
35
|
-
|
|
36
|
-
### Patch Changes
|
|
37
|
-
|
|
38
|
-
- [`3ec6dba`](https://github.com/seek-oss/vocab/commit/3ec6dbaad590299cc33e2d9d4a877576eb05853a) [#63](https://github.com/seek-oss/vocab/pull/63) Thanks [@jahredhope](https://github.com/jahredhope)! - Migrate to new @formatjs/icu-messageformat-parser as intl-messageformat-parser has been deprecated
|
|
39
|
-
|
|
40
|
-
- Updated dependencies [[`3ec6dba`](https://github.com/seek-oss/vocab/commit/3ec6dbaad590299cc33e2d9d4a877576eb05853a)]:
|
|
41
|
-
- @vocab/core@1.0.2
|
|
42
|
-
|
|
43
|
-
## 1.0.0
|
|
44
|
-
|
|
45
|
-
### Major Changes
|
|
46
|
-
|
|
47
|
-
- [`3031054`](https://github.com/seek-oss/vocab/commit/303105440851db6126f0606e1607745b27dd981c) [#51](https://github.com/seek-oss/vocab/pull/51) Thanks [@jahredhope](https://github.com/jahredhope)! - Release v1.0.0
|
|
48
|
-
|
|
49
|
-
Release Vocab as v1.0.0 to signify a stable API and support future [semver versioning](https://semver.org/) releases.
|
|
50
|
-
|
|
51
|
-
Vocab has seen a lot of iteration and changes since it was first published on 20 November 2020. We are now confident with the API and believe Vocab is ready for common use.
|
|
52
|
-
|
|
53
|
-
### Patch Changes
|
|
54
|
-
|
|
55
|
-
- Updated dependencies [[`0074382`](https://github.com/seek-oss/vocab/commit/007438273ef70f5d5ded45777933651ad8df36f6), [`3031054`](https://github.com/seek-oss/vocab/commit/303105440851db6126f0606e1607745b27dd981c)]:
|
|
56
|
-
- @vocab/core@1.0.0
|
|
57
|
-
- @vocab/phrase@1.0.0
|
|
58
|
-
|
|
59
|
-
## 0.0.16
|
|
60
|
-
|
|
61
|
-
### Patch Changes
|
|
62
|
-
|
|
63
|
-
- Updated dependencies [[`5b1fdc0`](https://github.com/seek-oss/vocab/commit/5b1fdc019522b12e7ef94b2fec57b54a9310d41c)]:
|
|
64
|
-
- @vocab/core@0.0.11
|
|
65
|
-
- @vocab/phrase@0.0.11
|
|
66
|
-
|
|
67
|
-
## 0.0.15
|
|
68
|
-
|
|
69
|
-
### Patch Changes
|
|
70
|
-
|
|
71
|
-
- Updated dependencies [[`7c96a14`](https://github.com/seek-oss/vocab/commit/7c96a142f602132d38c1df1a47a1f4657dc5c94c)]:
|
|
72
|
-
- @vocab/core@0.0.10
|
|
73
|
-
- @vocab/phrase@0.0.10
|
|
74
|
-
|
|
75
|
-
## 0.0.14
|
|
76
|
-
|
|
77
|
-
### Patch Changes
|
|
78
|
-
|
|
79
|
-
- Updated dependencies [[`3034bd3`](https://github.com/seek-oss/vocab/commit/3034bd3de610a9d1f3bfbd8caefa27064dee2710), [`c110745`](https://github.com/seek-oss/vocab/commit/c110745b79df1a8ade6b1d8a49e798b04a7b95e1)]:
|
|
80
|
-
- @vocab/core@0.0.9
|
|
81
|
-
- @vocab/phrase@0.0.9
|
|
82
|
-
|
|
83
|
-
## 0.0.13
|
|
84
|
-
|
|
85
|
-
### Patch Changes
|
|
86
|
-
|
|
87
|
-
- Updated dependencies [[`f2fca67`](https://github.com/seek-oss/vocab/commit/f2fca679c66ae65405a0aa24f0a0e472026aad0d)]:
|
|
88
|
-
- @vocab/core@0.0.8
|
|
89
|
-
- @vocab/phrase@0.0.8
|
|
90
|
-
|
|
91
|
-
## 0.0.12
|
|
92
|
-
|
|
93
|
-
### Patch Changes
|
|
94
|
-
|
|
95
|
-
- Updated dependencies [[`283bcad`](https://github.com/seek-oss/vocab/commit/283bcada06e622ab14ed891743ed3f55cf09e245), [`ad0d240`](https://github.com/seek-oss/vocab/commit/ad0d2404545ded8e11621eae8f29467ff3352366), [`f3992ef`](https://github.com/seek-oss/vocab/commit/f3992efbf08939ebf853fac650a49cc46dc51dfb), [`f3992ef`](https://github.com/seek-oss/vocab/commit/f3992efbf08939ebf853fac650a49cc46dc51dfb)]:
|
|
96
|
-
- @vocab/core@0.0.7
|
|
97
|
-
- @vocab/phrase@0.0.7
|
|
98
|
-
|
|
99
|
-
## 0.0.11
|
|
100
|
-
|
|
101
|
-
### Patch Changes
|
|
102
|
-
|
|
103
|
-
- Updated dependencies [[`80a46c0`](https://github.com/seek-oss/vocab/commit/80a46c01a55408675f5822c3618519f80136c3ab), [`80a46c0`](https://github.com/seek-oss/vocab/commit/80a46c01a55408675f5822c3618519f80136c3ab)]:
|
|
104
|
-
- @vocab/core@0.0.6
|
|
105
|
-
- @vocab/phrase@0.0.6
|
|
106
|
-
|
|
107
|
-
## 0.0.10
|
|
108
|
-
|
|
109
|
-
### Patch Changes
|
|
110
|
-
|
|
111
|
-
- Updated dependencies [[`371ed16`](https://github.com/seek-oss/vocab/commit/371ed16a232a04dab13afa7e2b352dfb6724eea4), [`c222d68`](https://github.com/seek-oss/vocab/commit/c222d68a3c0c24723a338eccb959798881f6a118)]:
|
|
112
|
-
- @vocab/core@0.0.5
|
|
113
|
-
- @vocab/phrase@0.0.5
|
|
114
|
-
|
|
115
|
-
## 0.0.9
|
|
116
|
-
|
|
117
|
-
### Patch Changes
|
|
118
|
-
|
|
119
|
-
- [`5f5c581`](https://github.com/seek-oss/vocab/commit/5f5c581a65bff28729ee19e1ec0bdea488a9d6c2) [#19](https://github.com/seek-oss/vocab/pull/19) Thanks [@jahredhope](https://github.com/jahredhope)! - Compile useable TypeScript importable files with `vocab compile`.
|
|
120
|
-
|
|
121
|
-
The new `vocab compile` step replaces `vocab generate-types` in creating a fully functional **translations.ts** file.
|
|
122
|
-
|
|
123
|
-
This allows vocab to be used **without the Webpack Plugin**, however use of the plugin is still heavily advised to ensure optimal loading of translation content on the web.
|
|
124
|
-
|
|
125
|
-
Support for unit testing is now better than ever! The newly created **translations.ts** means your unit test code will see the same code as available while rendering.
|
|
126
|
-
|
|
127
|
-
See the [documentation](https://github.com/seek-oss/vocab) for further usage details.
|
|
128
|
-
|
|
129
|
-
- Updated dependencies [[`5f5c581`](https://github.com/seek-oss/vocab/commit/5f5c581a65bff28729ee19e1ec0bdea488a9d6c2), [`02f943c`](https://github.com/seek-oss/vocab/commit/02f943ca892913b41f9e4720a72400777cf14b3d)]:
|
|
130
|
-
- @vocab/core@0.0.4
|
|
131
|
-
- @vocab/phrase@0.0.4
|
|
132
|
-
|
|
133
|
-
## 0.0.8
|
|
134
|
-
|
|
135
|
-
### Patch Changes
|
|
136
|
-
|
|
137
|
-
- [`ed6cf40`](https://github.com/seek-oss/vocab/commit/ed6cf408973f2e9c4d07a71fcb52f40294ebaf65) [#13](https://github.com/seek-oss/vocab/pull/13) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Add validation script for identifying missing keys
|
|
138
|
-
|
|
139
|
-
* [`b5a5a05`](https://github.com/seek-oss/vocab/commit/b5a5a05a5bb87b48e6e9160af75f555728143ea2) [#15](https://github.com/seek-oss/vocab/pull/15) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Added watch mode to generate-types
|
|
140
|
-
|
|
141
|
-
* Updated dependencies [[`08de30d`](https://github.com/seek-oss/vocab/commit/08de30d338c2a5ebdcf14da7c736dddf22e7ca9e), [`ed6cf40`](https://github.com/seek-oss/vocab/commit/ed6cf408973f2e9c4d07a71fcb52f40294ebaf65), [`26b52f4`](https://github.com/seek-oss/vocab/commit/26b52f4878ded440841e08c858bdc9e685500c2a), [`b5a5a05`](https://github.com/seek-oss/vocab/commit/b5a5a05a5bb87b48e6e9160af75f555728143ea2)]:
|
|
142
|
-
- @vocab/core@0.0.3
|
|
143
|
-
- @vocab/phrase@0.0.3
|
|
144
|
-
|
|
145
|
-
## 0.0.7
|
|
146
|
-
|
|
147
|
-
### Patch Changes
|
|
148
|
-
|
|
149
|
-
- [`4710f34`](https://github.com/seek-oss/vocab/commit/4710f341f2827643e3eff69ef7e26d44ec6e8a2b) [#8](https://github.com/seek-oss/vocab/pull/8) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Infer `t` return type more intelligently
|
|
150
|
-
|
|
151
|
-
The translate key function (`t`) will now infer the return type as ReactNode only when the tag syntax is used.
|
|
152
|
-
|
|
153
|
-
- Updated dependencies [[`4710f34`](https://github.com/seek-oss/vocab/commit/4710f341f2827643e3eff69ef7e26d44ec6e8a2b)]:
|
|
154
|
-
- @vocab/core@0.0.2
|
|
155
|
-
- @vocab/phrase@0.0.2
|
|
156
|
-
|
|
157
|
-
## 0.0.6
|
|
158
|
-
|
|
159
|
-
### Patch Changes
|
|
160
|
-
|
|
161
|
-
- [`45c4fe2`](https://github.com/seek-oss/vocab/commit/45c4fe273c5157475cb03ca57db662956ad5cbc9) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Improved type definitions for `t` function
|
|
162
|
-
|
|
163
|
-
* [`33aeb0f`](https://github.com/seek-oss/vocab/commit/33aeb0f210687b8ce57417e963bba9db7c7cb4e3) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Respect prettier config for generated typescript declarations
|
|
164
|
-
|
|
165
|
-
* Updated dependencies [[`2c7779f`](https://github.com/seek-oss/vocab/commit/2c7779f5384793af6a178f5ab4d56b6a9f09bc02)]:
|
|
166
|
-
- @vocab/utils@0.0.6
|
|
167
|
-
|
|
168
|
-
## 0.0.5
|
|
169
|
-
|
|
170
|
-
### Patch Changes
|
|
171
|
-
|
|
172
|
-
- Updated dependencies [[`f7b6b5c`](https://github.com/seek-oss/vocab/commit/f7b6b5c1cdb3f72bb0a3d0c5c7a3da844b2a1c87)]:
|
|
173
|
-
- @vocab/utils@0.0.5
|
|
174
|
-
|
|
175
|
-
## 0.0.4
|
|
176
|
-
|
|
177
|
-
### Patch Changes
|
|
178
|
-
|
|
179
|
-
- [`4589bce`](https://github.com/seek-oss/vocab/commit/4589bce912b7a8fb869e1c3a65d0c4c417043faf) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Support language fallbacks through `extends` config
|
|
180
|
-
|
|
181
|
-
* [`bf36f86`](https://github.com/seek-oss/vocab/commit/bf36f86a74ced4f42271b2f8fb128e995bb8c849) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Use config location as CWD
|
|
182
|
-
|
|
183
|
-
- [`f41c8f6`](https://github.com/seek-oss/vocab/commit/f41c8f67d78994bc071aca6eb20ef63421be2e96) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Access TranslationFile type from @vocab/cli instead of @vocab/types
|
|
184
|
-
|
|
185
|
-
* [`870a74b`](https://github.com/seek-oss/vocab/commit/870a74b9a15ec2cb493c3de526c599b24fd5830d) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Support custom config file locations
|
|
186
|
-
|
|
187
|
-
* Updated dependencies [[`4589bce`](https://github.com/seek-oss/vocab/commit/4589bce912b7a8fb869e1c3a65d0c4c417043faf), [`215eeba`](https://github.com/seek-oss/vocab/commit/215eeba619260b349a39d99a79fc69503dba5ccf), [`bf36f86`](https://github.com/seek-oss/vocab/commit/bf36f86a74ced4f42271b2f8fb128e995bb8c849), [`870a74b`](https://github.com/seek-oss/vocab/commit/870a74b9a15ec2cb493c3de526c599b24fd5830d)]:
|
|
188
|
-
- @vocab/utils@0.0.4
|
|
189
|
-
|
|
190
|
-
## 0.0.3
|
|
191
|
-
|
|
192
|
-
### Patch Changes
|
|
193
|
-
|
|
194
|
-
- Updated dependencies [[`6f2c084`](https://github.com/seek-oss/vocab/commit/6f2c08419ce5773c589901fafa7bec7a1c94d2a5)]:
|
|
195
|
-
- @vocab/utils@0.0.3
|
|
196
|
-
|
|
197
|
-
## 0.0.2
|
|
198
|
-
|
|
199
|
-
### Patch Changes
|
|
200
|
-
|
|
201
|
-
- [`9f99ea7`](https://github.com/seek-oss/vocab/commit/9f99ea7c827ec4d7c21a485e17e3adbbd1c49319) Thanks [@jahredhope](https://github.com/jahredhope)! - Remove React as dependency and target node
|
|
202
|
-
|
|
203
|
-
- Updated dependencies [[`9f99ea7`](https://github.com/seek-oss/vocab/commit/9f99ea7c827ec4d7c21a485e17e3adbbd1c49319)]:
|
|
204
|
-
- @vocab/utils@0.0.2
|
package/src/index.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
import type { UserConfig } from '@vocab/types';
|
|
3
|
-
import { pull, push } from '@vocab/phrase';
|
|
4
|
-
import { resolveConfig, compile, validate } from '@vocab/core';
|
|
5
|
-
import yargs from 'yargs';
|
|
6
|
-
|
|
7
|
-
import envCi from 'env-ci';
|
|
8
|
-
|
|
9
|
-
const { branch } = envCi();
|
|
10
|
-
|
|
11
|
-
const branchDefinition = {
|
|
12
|
-
type: 'string',
|
|
13
|
-
describe: 'The Phrase branch to target',
|
|
14
|
-
default: branch || 'local-development',
|
|
15
|
-
} as const;
|
|
16
|
-
|
|
17
|
-
let config: UserConfig | null = null;
|
|
18
|
-
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
20
|
-
yargs(process.argv.slice(2))
|
|
21
|
-
.scriptName('vocab')
|
|
22
|
-
.option('config', {
|
|
23
|
-
type: 'string',
|
|
24
|
-
describe: 'Path to config file',
|
|
25
|
-
})
|
|
26
|
-
.middleware(async ({ config: configPath }) => {
|
|
27
|
-
config = await resolveConfig(configPath);
|
|
28
|
-
console.log('Loaded config from', configPath || process.cwd());
|
|
29
|
-
})
|
|
30
|
-
.command({
|
|
31
|
-
command: 'push',
|
|
32
|
-
builder: () =>
|
|
33
|
-
yargs.options({
|
|
34
|
-
branch: branchDefinition,
|
|
35
|
-
'delete-unused-keys': {
|
|
36
|
-
type: 'boolean',
|
|
37
|
-
describe: 'Whether or not to delete unused keys after pushing',
|
|
38
|
-
default: false,
|
|
39
|
-
},
|
|
40
|
-
}),
|
|
41
|
-
handler: async (options) => {
|
|
42
|
-
await push(options, config!);
|
|
43
|
-
},
|
|
44
|
-
})
|
|
45
|
-
.command({
|
|
46
|
-
command: 'pull',
|
|
47
|
-
builder: () => yargs.options({ branch: branchDefinition }),
|
|
48
|
-
handler: async (options) => {
|
|
49
|
-
await pull(options, config!);
|
|
50
|
-
},
|
|
51
|
-
})
|
|
52
|
-
.command({
|
|
53
|
-
command: 'compile',
|
|
54
|
-
builder: () =>
|
|
55
|
-
yargs.options({
|
|
56
|
-
watch: { type: 'boolean', default: false },
|
|
57
|
-
}),
|
|
58
|
-
handler: async ({ watch }) => {
|
|
59
|
-
await compile({ watch }, config!);
|
|
60
|
-
},
|
|
61
|
-
})
|
|
62
|
-
.command({
|
|
63
|
-
command: 'validate',
|
|
64
|
-
handler: async () => {
|
|
65
|
-
const valid = await validate(config!);
|
|
66
|
-
|
|
67
|
-
if (!valid) {
|
|
68
|
-
throw new Error('Project invalid');
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
})
|
|
72
|
-
.help()
|
|
73
|
-
.wrap(72).argv;
|