@vocab/cli 0.0.0-delete-unused-keys-20228144520
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 +198 -0
- package/bin.js +4 -0
- package/dist/declarations/src/index.d.ts +1 -0
- package/dist/vocab-cli.cjs.d.ts +1 -0
- package/dist/vocab-cli.cjs.dev.js +77 -0
- package/dist/vocab-cli.cjs.js +7 -0
- package/dist/vocab-cli.cjs.prod.js +77 -0
- package/dist/vocab-cli.esm.js +70 -0
- package/package.json +27 -0
- package/src/index.ts +73 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# @vocab/cli
|
|
2
|
+
|
|
3
|
+
## 0.0.0-delete-unused-keys-20228144520
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`fcd1482`](https://github.com/seek-oss/vocab/commit/fcd1482753e74274935f00ac0fc3afe1bf7f1989) Thanks [@askoufis](https://github.com/askoufis)! - Add an optional `deleteUnusedKeys` flag to the `push` function. If set to `true`, unused keys will be deleted from Phrase after translations are pushed.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`fcd1482`](https://github.com/seek-oss/vocab/commit/fcd1482753e74274935f00ac0fc3afe1bf7f1989)]:
|
|
12
|
+
- @vocab/phrase@0.0.0-delete-unused-keys-20228144520
|
|
13
|
+
|
|
14
|
+
## 1.1.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- [`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.
|
|
19
|
+
See [the docs] for more information and examples.
|
|
20
|
+
|
|
21
|
+
[the docs]: https://github.com/seek-oss/vocab#generated-languages
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [[`87333d7`](https://github.com/seek-oss/vocab/commit/87333d79c4a883b07d7d8f2c272b16e2243c49bd)]:
|
|
26
|
+
- @vocab/core@1.1.0
|
|
27
|
+
|
|
28
|
+
## 1.0.1
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- [`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
|
|
33
|
+
|
|
34
|
+
- Updated dependencies [[`3ec6dba`](https://github.com/seek-oss/vocab/commit/3ec6dbaad590299cc33e2d9d4a877576eb05853a)]:
|
|
35
|
+
- @vocab/core@1.0.2
|
|
36
|
+
|
|
37
|
+
## 1.0.0
|
|
38
|
+
|
|
39
|
+
### Major Changes
|
|
40
|
+
|
|
41
|
+
- [`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
|
|
42
|
+
|
|
43
|
+
Release Vocab as v1.0.0 to signify a stable API and support future [semver versioning](https://semver.org/) releases.
|
|
44
|
+
|
|
45
|
+
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.
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [[`0074382`](https://github.com/seek-oss/vocab/commit/007438273ef70f5d5ded45777933651ad8df36f6), [`3031054`](https://github.com/seek-oss/vocab/commit/303105440851db6126f0606e1607745b27dd981c)]:
|
|
50
|
+
- @vocab/core@1.0.0
|
|
51
|
+
- @vocab/phrase@1.0.0
|
|
52
|
+
|
|
53
|
+
## 0.0.16
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- Updated dependencies [[`5b1fdc0`](https://github.com/seek-oss/vocab/commit/5b1fdc019522b12e7ef94b2fec57b54a9310d41c)]:
|
|
58
|
+
- @vocab/core@0.0.11
|
|
59
|
+
- @vocab/phrase@0.0.11
|
|
60
|
+
|
|
61
|
+
## 0.0.15
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- Updated dependencies [[`7c96a14`](https://github.com/seek-oss/vocab/commit/7c96a142f602132d38c1df1a47a1f4657dc5c94c)]:
|
|
66
|
+
- @vocab/core@0.0.10
|
|
67
|
+
- @vocab/phrase@0.0.10
|
|
68
|
+
|
|
69
|
+
## 0.0.14
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- Updated dependencies [[`3034bd3`](https://github.com/seek-oss/vocab/commit/3034bd3de610a9d1f3bfbd8caefa27064dee2710), [`c110745`](https://github.com/seek-oss/vocab/commit/c110745b79df1a8ade6b1d8a49e798b04a7b95e1)]:
|
|
74
|
+
- @vocab/core@0.0.9
|
|
75
|
+
- @vocab/phrase@0.0.9
|
|
76
|
+
|
|
77
|
+
## 0.0.13
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- Updated dependencies [[`f2fca67`](https://github.com/seek-oss/vocab/commit/f2fca679c66ae65405a0aa24f0a0e472026aad0d)]:
|
|
82
|
+
- @vocab/core@0.0.8
|
|
83
|
+
- @vocab/phrase@0.0.8
|
|
84
|
+
|
|
85
|
+
## 0.0.12
|
|
86
|
+
|
|
87
|
+
### Patch Changes
|
|
88
|
+
|
|
89
|
+
- 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)]:
|
|
90
|
+
- @vocab/core@0.0.7
|
|
91
|
+
- @vocab/phrase@0.0.7
|
|
92
|
+
|
|
93
|
+
## 0.0.11
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- Updated dependencies [[`80a46c0`](https://github.com/seek-oss/vocab/commit/80a46c01a55408675f5822c3618519f80136c3ab), [`80a46c0`](https://github.com/seek-oss/vocab/commit/80a46c01a55408675f5822c3618519f80136c3ab)]:
|
|
98
|
+
- @vocab/core@0.0.6
|
|
99
|
+
- @vocab/phrase@0.0.6
|
|
100
|
+
|
|
101
|
+
## 0.0.10
|
|
102
|
+
|
|
103
|
+
### Patch Changes
|
|
104
|
+
|
|
105
|
+
- Updated dependencies [[`371ed16`](https://github.com/seek-oss/vocab/commit/371ed16a232a04dab13afa7e2b352dfb6724eea4), [`c222d68`](https://github.com/seek-oss/vocab/commit/c222d68a3c0c24723a338eccb959798881f6a118)]:
|
|
106
|
+
- @vocab/core@0.0.5
|
|
107
|
+
- @vocab/phrase@0.0.5
|
|
108
|
+
|
|
109
|
+
## 0.0.9
|
|
110
|
+
|
|
111
|
+
### Patch Changes
|
|
112
|
+
|
|
113
|
+
- [`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`.
|
|
114
|
+
|
|
115
|
+
The new `vocab compile` step replaces `vocab generate-types` in creating a fully functional **translations.ts** file.
|
|
116
|
+
|
|
117
|
+
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.
|
|
118
|
+
|
|
119
|
+
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.
|
|
120
|
+
|
|
121
|
+
See the [documentation](https://github.com/seek-oss/vocab) for further usage details.
|
|
122
|
+
|
|
123
|
+
- Updated dependencies [[`5f5c581`](https://github.com/seek-oss/vocab/commit/5f5c581a65bff28729ee19e1ec0bdea488a9d6c2), [`02f943c`](https://github.com/seek-oss/vocab/commit/02f943ca892913b41f9e4720a72400777cf14b3d)]:
|
|
124
|
+
- @vocab/core@0.0.4
|
|
125
|
+
- @vocab/phrase@0.0.4
|
|
126
|
+
|
|
127
|
+
## 0.0.8
|
|
128
|
+
|
|
129
|
+
### Patch Changes
|
|
130
|
+
|
|
131
|
+
- [`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
|
|
132
|
+
|
|
133
|
+
* [`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
|
|
134
|
+
|
|
135
|
+
* 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)]:
|
|
136
|
+
- @vocab/core@0.0.3
|
|
137
|
+
- @vocab/phrase@0.0.3
|
|
138
|
+
|
|
139
|
+
## 0.0.7
|
|
140
|
+
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- [`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
|
|
144
|
+
|
|
145
|
+
The translate key function (`t`) will now infer the return type as ReactNode only when the tag syntax is used.
|
|
146
|
+
|
|
147
|
+
- Updated dependencies [[`4710f34`](https://github.com/seek-oss/vocab/commit/4710f341f2827643e3eff69ef7e26d44ec6e8a2b)]:
|
|
148
|
+
- @vocab/core@0.0.2
|
|
149
|
+
- @vocab/phrase@0.0.2
|
|
150
|
+
|
|
151
|
+
## 0.0.6
|
|
152
|
+
|
|
153
|
+
### Patch Changes
|
|
154
|
+
|
|
155
|
+
- [`45c4fe2`](https://github.com/seek-oss/vocab/commit/45c4fe273c5157475cb03ca57db662956ad5cbc9) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Improved type definitions for `t` function
|
|
156
|
+
|
|
157
|
+
* [`33aeb0f`](https://github.com/seek-oss/vocab/commit/33aeb0f210687b8ce57417e963bba9db7c7cb4e3) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Respect prettier config for generated typescript declarations
|
|
158
|
+
|
|
159
|
+
* Updated dependencies [[`2c7779f`](https://github.com/seek-oss/vocab/commit/2c7779f5384793af6a178f5ab4d56b6a9f09bc02)]:
|
|
160
|
+
- @vocab/utils@0.0.6
|
|
161
|
+
|
|
162
|
+
## 0.0.5
|
|
163
|
+
|
|
164
|
+
### Patch Changes
|
|
165
|
+
|
|
166
|
+
- Updated dependencies [[`f7b6b5c`](https://github.com/seek-oss/vocab/commit/f7b6b5c1cdb3f72bb0a3d0c5c7a3da844b2a1c87)]:
|
|
167
|
+
- @vocab/utils@0.0.5
|
|
168
|
+
|
|
169
|
+
## 0.0.4
|
|
170
|
+
|
|
171
|
+
### Patch Changes
|
|
172
|
+
|
|
173
|
+
- [`4589bce`](https://github.com/seek-oss/vocab/commit/4589bce912b7a8fb869e1c3a65d0c4c417043faf) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Support language fallbacks through `extends` config
|
|
174
|
+
|
|
175
|
+
* [`bf36f86`](https://github.com/seek-oss/vocab/commit/bf36f86a74ced4f42271b2f8fb128e995bb8c849) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Use config location as CWD
|
|
176
|
+
|
|
177
|
+
- [`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
|
|
178
|
+
|
|
179
|
+
* [`870a74b`](https://github.com/seek-oss/vocab/commit/870a74b9a15ec2cb493c3de526c599b24fd5830d) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Support custom config file locations
|
|
180
|
+
|
|
181
|
+
* 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)]:
|
|
182
|
+
- @vocab/utils@0.0.4
|
|
183
|
+
|
|
184
|
+
## 0.0.3
|
|
185
|
+
|
|
186
|
+
### Patch Changes
|
|
187
|
+
|
|
188
|
+
- Updated dependencies [[`6f2c084`](https://github.com/seek-oss/vocab/commit/6f2c08419ce5773c589901fafa7bec7a1c94d2a5)]:
|
|
189
|
+
- @vocab/utils@0.0.3
|
|
190
|
+
|
|
191
|
+
## 0.0.2
|
|
192
|
+
|
|
193
|
+
### Patch Changes
|
|
194
|
+
|
|
195
|
+
- [`9f99ea7`](https://github.com/seek-oss/vocab/commit/9f99ea7c827ec4d7c21a485e17e3adbbd1c49319) Thanks [@jahredhope](https://github.com/jahredhope)! - Remove React as dependency and target node
|
|
196
|
+
|
|
197
|
+
- Updated dependencies [[`9f99ea7`](https://github.com/seek-oss/vocab/commit/9f99ea7c827ec4d7c21a485e17e3adbbd1c49319)]:
|
|
198
|
+
- @vocab/utils@0.0.2
|
package/bin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./declarations/src/index";
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var phrase = require('@vocab/phrase');
|
|
4
|
+
var core = require('@vocab/core');
|
|
5
|
+
var yargs = require('yargs');
|
|
6
|
+
var envCi = require('env-ci');
|
|
7
|
+
|
|
8
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
9
|
+
|
|
10
|
+
var yargs__default = /*#__PURE__*/_interopDefault(yargs);
|
|
11
|
+
var envCi__default = /*#__PURE__*/_interopDefault(envCi);
|
|
12
|
+
|
|
13
|
+
/* eslint-disable no-console */
|
|
14
|
+
const {
|
|
15
|
+
branch
|
|
16
|
+
} = envCi__default['default']();
|
|
17
|
+
const branchDefinition = {
|
|
18
|
+
type: 'string',
|
|
19
|
+
describe: 'The Phrase branch to target',
|
|
20
|
+
default: branch || 'local-development'
|
|
21
|
+
};
|
|
22
|
+
let config = null; // eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
23
|
+
|
|
24
|
+
yargs__default['default'](process.argv.slice(2)).scriptName('vocab').option('config', {
|
|
25
|
+
type: 'string',
|
|
26
|
+
describe: 'Path to config file'
|
|
27
|
+
}).middleware(async ({
|
|
28
|
+
config: configPath
|
|
29
|
+
}) => {
|
|
30
|
+
config = await core.resolveConfig(configPath);
|
|
31
|
+
console.log('Loaded config from', configPath || process.cwd());
|
|
32
|
+
}).command({
|
|
33
|
+
command: 'push',
|
|
34
|
+
builder: () => yargs__default['default'].options({
|
|
35
|
+
branch: branchDefinition,
|
|
36
|
+
deleteUnusedKeys: {
|
|
37
|
+
type: 'boolean',
|
|
38
|
+
describe: 'Whether or not to delete unused keys after pushing',
|
|
39
|
+
default: false
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
42
|
+
handler: async options => {
|
|
43
|
+
await phrase.push(options, config);
|
|
44
|
+
}
|
|
45
|
+
}).command({
|
|
46
|
+
command: 'pull',
|
|
47
|
+
builder: () => yargs__default['default'].options({
|
|
48
|
+
branch: branchDefinition
|
|
49
|
+
}),
|
|
50
|
+
handler: async options => {
|
|
51
|
+
await phrase.pull(options, config);
|
|
52
|
+
}
|
|
53
|
+
}).command({
|
|
54
|
+
command: 'compile',
|
|
55
|
+
builder: () => yargs__default['default'].options({
|
|
56
|
+
watch: {
|
|
57
|
+
type: 'boolean',
|
|
58
|
+
default: false
|
|
59
|
+
}
|
|
60
|
+
}),
|
|
61
|
+
handler: async ({
|
|
62
|
+
watch
|
|
63
|
+
}) => {
|
|
64
|
+
await core.compile({
|
|
65
|
+
watch
|
|
66
|
+
}, config);
|
|
67
|
+
}
|
|
68
|
+
}).command({
|
|
69
|
+
command: 'validate',
|
|
70
|
+
handler: async () => {
|
|
71
|
+
const valid = await core.validate(config);
|
|
72
|
+
|
|
73
|
+
if (!valid) {
|
|
74
|
+
throw new Error('Project invalid');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}).help().wrap(72).argv;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var phrase = require('@vocab/phrase');
|
|
4
|
+
var core = require('@vocab/core');
|
|
5
|
+
var yargs = require('yargs');
|
|
6
|
+
var envCi = require('env-ci');
|
|
7
|
+
|
|
8
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
9
|
+
|
|
10
|
+
var yargs__default = /*#__PURE__*/_interopDefault(yargs);
|
|
11
|
+
var envCi__default = /*#__PURE__*/_interopDefault(envCi);
|
|
12
|
+
|
|
13
|
+
/* eslint-disable no-console */
|
|
14
|
+
const {
|
|
15
|
+
branch
|
|
16
|
+
} = envCi__default['default']();
|
|
17
|
+
const branchDefinition = {
|
|
18
|
+
type: 'string',
|
|
19
|
+
describe: 'The Phrase branch to target',
|
|
20
|
+
default: branch || 'local-development'
|
|
21
|
+
};
|
|
22
|
+
let config = null; // eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
23
|
+
|
|
24
|
+
yargs__default['default'](process.argv.slice(2)).scriptName('vocab').option('config', {
|
|
25
|
+
type: 'string',
|
|
26
|
+
describe: 'Path to config file'
|
|
27
|
+
}).middleware(async ({
|
|
28
|
+
config: configPath
|
|
29
|
+
}) => {
|
|
30
|
+
config = await core.resolveConfig(configPath);
|
|
31
|
+
console.log('Loaded config from', configPath || process.cwd());
|
|
32
|
+
}).command({
|
|
33
|
+
command: 'push',
|
|
34
|
+
builder: () => yargs__default['default'].options({
|
|
35
|
+
branch: branchDefinition,
|
|
36
|
+
deleteUnusedKeys: {
|
|
37
|
+
type: 'boolean',
|
|
38
|
+
describe: 'Whether or not to delete unused keys after pushing',
|
|
39
|
+
default: false
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
42
|
+
handler: async options => {
|
|
43
|
+
await phrase.push(options, config);
|
|
44
|
+
}
|
|
45
|
+
}).command({
|
|
46
|
+
command: 'pull',
|
|
47
|
+
builder: () => yargs__default['default'].options({
|
|
48
|
+
branch: branchDefinition
|
|
49
|
+
}),
|
|
50
|
+
handler: async options => {
|
|
51
|
+
await phrase.pull(options, config);
|
|
52
|
+
}
|
|
53
|
+
}).command({
|
|
54
|
+
command: 'compile',
|
|
55
|
+
builder: () => yargs__default['default'].options({
|
|
56
|
+
watch: {
|
|
57
|
+
type: 'boolean',
|
|
58
|
+
default: false
|
|
59
|
+
}
|
|
60
|
+
}),
|
|
61
|
+
handler: async ({
|
|
62
|
+
watch
|
|
63
|
+
}) => {
|
|
64
|
+
await core.compile({
|
|
65
|
+
watch
|
|
66
|
+
}, config);
|
|
67
|
+
}
|
|
68
|
+
}).command({
|
|
69
|
+
command: 'validate',
|
|
70
|
+
handler: async () => {
|
|
71
|
+
const valid = await core.validate(config);
|
|
72
|
+
|
|
73
|
+
if (!valid) {
|
|
74
|
+
throw new Error('Project invalid');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}).help().wrap(72).argv;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { push, pull } from '@vocab/phrase';
|
|
2
|
+
import { resolveConfig, compile, validate } from '@vocab/core';
|
|
3
|
+
import yargs from 'yargs';
|
|
4
|
+
import envCi from 'env-ci';
|
|
5
|
+
|
|
6
|
+
/* eslint-disable no-console */
|
|
7
|
+
const {
|
|
8
|
+
branch
|
|
9
|
+
} = envCi();
|
|
10
|
+
const branchDefinition = {
|
|
11
|
+
type: 'string',
|
|
12
|
+
describe: 'The Phrase branch to target',
|
|
13
|
+
default: branch || 'local-development'
|
|
14
|
+
};
|
|
15
|
+
let config = null; // eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
16
|
+
|
|
17
|
+
yargs(process.argv.slice(2)).scriptName('vocab').option('config', {
|
|
18
|
+
type: 'string',
|
|
19
|
+
describe: 'Path to config file'
|
|
20
|
+
}).middleware(async ({
|
|
21
|
+
config: configPath
|
|
22
|
+
}) => {
|
|
23
|
+
config = await resolveConfig(configPath);
|
|
24
|
+
console.log('Loaded config from', configPath || process.cwd());
|
|
25
|
+
}).command({
|
|
26
|
+
command: 'push',
|
|
27
|
+
builder: () => yargs.options({
|
|
28
|
+
branch: branchDefinition,
|
|
29
|
+
deleteUnusedKeys: {
|
|
30
|
+
type: 'boolean',
|
|
31
|
+
describe: 'Whether or not to delete unused keys after pushing',
|
|
32
|
+
default: false
|
|
33
|
+
}
|
|
34
|
+
}),
|
|
35
|
+
handler: async options => {
|
|
36
|
+
await push(options, config);
|
|
37
|
+
}
|
|
38
|
+
}).command({
|
|
39
|
+
command: 'pull',
|
|
40
|
+
builder: () => yargs.options({
|
|
41
|
+
branch: branchDefinition
|
|
42
|
+
}),
|
|
43
|
+
handler: async options => {
|
|
44
|
+
await pull(options, config);
|
|
45
|
+
}
|
|
46
|
+
}).command({
|
|
47
|
+
command: 'compile',
|
|
48
|
+
builder: () => yargs.options({
|
|
49
|
+
watch: {
|
|
50
|
+
type: 'boolean',
|
|
51
|
+
default: false
|
|
52
|
+
}
|
|
53
|
+
}),
|
|
54
|
+
handler: async ({
|
|
55
|
+
watch
|
|
56
|
+
}) => {
|
|
57
|
+
await compile({
|
|
58
|
+
watch
|
|
59
|
+
}, config);
|
|
60
|
+
}
|
|
61
|
+
}).command({
|
|
62
|
+
command: 'validate',
|
|
63
|
+
handler: async () => {
|
|
64
|
+
const valid = await validate(config);
|
|
65
|
+
|
|
66
|
+
if (!valid) {
|
|
67
|
+
throw new Error('Project invalid');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}).help().wrap(72).argv;
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vocab/cli",
|
|
3
|
+
"version": "0.0.0-delete-unused-keys-20228144520",
|
|
4
|
+
"main": "dist/vocab-cli.cjs.js",
|
|
5
|
+
"module": "dist/vocab-cli.esm.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"vocab": "bin.js"
|
|
8
|
+
},
|
|
9
|
+
"author": "SEEK",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@types/env-ci": "^3.1.0",
|
|
13
|
+
"@vocab/core": "^1.1.0",
|
|
14
|
+
"@vocab/phrase": "^0.0.0-delete-unused-keys-20228144520",
|
|
15
|
+
"env-ci": "^5.0.2",
|
|
16
|
+
"fast-glob": "^3.2.4",
|
|
17
|
+
"form-data": "^3.0.0",
|
|
18
|
+
"node-fetch": "^2.6.1",
|
|
19
|
+
"prettier": "^2.1.2",
|
|
20
|
+
"yargs": "^16.1.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node-fetch": "^2.5.7",
|
|
24
|
+
"@types/prettier": "^2.1.5",
|
|
25
|
+
"@types/yargs": "^15.0.9"
|
|
26
|
+
}
|
|
27
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
deleteUnusedKeys: {
|
|
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;
|