@chesterbrains/translify-cli 0.1.0 → 0.1.2
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 +26 -18
- package/dist/version.js +1 -1
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -29,14 +29,14 @@ Requires Node 20 or newer.
|
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
31
|
# run without installing
|
|
32
|
-
npx
|
|
32
|
+
npx translify --help
|
|
33
33
|
|
|
34
|
-
# or add it to a project
|
|
35
|
-
npm i -D
|
|
34
|
+
# or add it to a project
|
|
35
|
+
npm i -D translify
|
|
36
36
|
npx translify --help
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
`translify` is an alias of `@chesterbrains/translify-cli`: the same CLI, so `npm i -D @chesterbrains/translify-cli` and `npm i -D translify` both work.
|
|
40
40
|
|
|
41
41
|
## Create a secret key
|
|
42
42
|
|
|
@@ -59,14 +59,12 @@ locales/
|
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
61
|
export TRANSLIFY_SECRET_KEY=sk_...
|
|
62
|
-
npx
|
|
63
|
-
npx
|
|
64
|
-
npx
|
|
65
|
-
npx
|
|
62
|
+
npx translify init # detects your layout, writes translify.json
|
|
63
|
+
npx translify push --dry-run # show what would change, write nothing
|
|
64
|
+
npx translify push
|
|
65
|
+
npx translify pull
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
(If you installed it with `npm i -D`, `npx translify ...` is equivalent.)
|
|
69
|
-
|
|
70
68
|
`translify.json`:
|
|
71
69
|
|
|
72
70
|
```json
|
|
@@ -111,9 +109,9 @@ ARB files always use a fixed `namespace`. The `locales` map is only needed for l
|
|
|
111
109
|
Set the key first (`export TRANSLIFY_SECRET_KEY=sk_...` or `translify login`), then:
|
|
112
110
|
|
|
113
111
|
```bash
|
|
114
|
-
npx
|
|
115
|
-
npx
|
|
116
|
-
npx
|
|
112
|
+
npx translify init
|
|
113
|
+
npx translify push
|
|
114
|
+
npx translify pull
|
|
117
115
|
flutter gen-l10n
|
|
118
116
|
```
|
|
119
117
|
|
|
@@ -166,7 +164,7 @@ jobs:
|
|
|
166
164
|
- uses: actions/checkout@v4
|
|
167
165
|
- uses: actions/setup-node@v4
|
|
168
166
|
with: { node-version: 22 }
|
|
169
|
-
- run: npx
|
|
167
|
+
- run: npx translify push
|
|
170
168
|
env:
|
|
171
169
|
TRANSLIFY_SECRET_KEY: ${{ secrets.TRANSLIFY_SECRET_KEY }}
|
|
172
170
|
```
|
|
@@ -183,7 +181,7 @@ jobs:
|
|
|
183
181
|
- uses: actions/checkout@v4
|
|
184
182
|
- uses: actions/setup-node@v4
|
|
185
183
|
with: { node-version: 22 }
|
|
186
|
-
- run: npx
|
|
184
|
+
- run: npx translify status
|
|
187
185
|
env:
|
|
188
186
|
TRANSLIFY_SECRET_KEY: ${{ secrets.TRANSLIFY_SECRET_KEY }}
|
|
189
187
|
```
|
|
@@ -191,10 +189,10 @@ jobs:
|
|
|
191
189
|
Pull and publish on deploy:
|
|
192
190
|
|
|
193
191
|
```yaml
|
|
194
|
-
- run: npx
|
|
192
|
+
- run: npx translify pull
|
|
195
193
|
env:
|
|
196
194
|
TRANSLIFY_SECRET_KEY: ${{ secrets.TRANSLIFY_SECRET_KEY }}
|
|
197
|
-
- run: npx
|
|
195
|
+
- run: npx translify publish production
|
|
198
196
|
env:
|
|
199
197
|
TRANSLIFY_SECRET_KEY: ${{ secrets.TRANSLIFY_SECRET_KEY }}
|
|
200
198
|
```
|
|
@@ -230,7 +228,7 @@ The server's error `code` decides the exit code first; the HTTP status is only u
|
|
|
230
228
|
| `SCOPE_MISSING` | 2 | The key lacks the scope named in the message (`PULL`, `PUSH` or `PUBLISH`). Create a key that has it. |
|
|
231
229
|
| `QUOTA_EXCEEDED` | 3 | Your plan limit was reached (usually translation keys). Remove keys, or push a smaller set. |
|
|
232
230
|
| `PUSH_TOO_LARGE` | 4 | Split the push by namespace: `translify push --namespace <ns>`. |
|
|
233
|
-
| `CLI_TOO_OLD` | 4 | Upgrade: `npm i -g @chesterbrains/translify-cli@latest` (or use `npx
|
|
231
|
+
| `CLI_TOO_OLD` | 4 | Upgrade: `npm i -g @chesterbrains/translify-cli@latest` (or use `npx translify@latest`). |
|
|
234
232
|
| `ORPHANS_CHANGED` | 1 | The orphan list changed between the dry run and the real push (keys were added, removed or published). Nothing was written; run `translify push --prune` again to review the new list. |
|
|
235
233
|
| `TRANSACTION_CONFLICT` | 4 | Another write collided with yours. Retry. |
|
|
236
234
|
| `RATE_LIMITED` | 4 | The CLI already retried 3 times, honouring `Retry-After`. Wait a moment and retry. |
|
|
@@ -241,3 +239,13 @@ The server's error `code` decides the exit code first; the HTTP status is only u
|
|
|
241
239
|
| `@@locale` does not match | 1 | `@@locale` is optional, but if an `.arb` file has it, it must match the file's locale (case and `_`/`-` are ignored). Fix or remove it and push again. |
|
|
242
240
|
| `No translify.json here` | 1 | Run `translify init` in the repository root. |
|
|
243
241
|
| `status` reports drift | 1 | Run `translify pull` (or `push`) to bring the two sides back in line. |
|
|
242
|
+
|
|
243
|
+
## Releasing the `translify` alias
|
|
244
|
+
|
|
245
|
+
The unscoped `translify` package lives in `alias/`. Its `bin.js` just imports `@chesterbrains/translify-cli`, which it depends on at `>=0.1.0 <1.0.0`, so it follows every 0.x release of the CLI without a republish. It only needs republishing (with a bumped range) for a 1.x major:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
cd alias && npm publish --access public # then approve the staged release
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
The alias is not part of the CLI's npm tarball and is ignored by lint, typecheck and tests.
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chesterbrains/translify-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Push, pull and publish Translify translations from your repository",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/chesterbrains/translify-cli.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/chesterbrains/translify-cli#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/chesterbrains/translify-cli/issues"
|
|
13
|
+
},
|
|
6
14
|
"type": "module",
|
|
7
15
|
"bin": {
|
|
8
16
|
"translify": "dist/index.js"
|