intor-cli 0.0.16 → 0.0.18
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
CHANGED
|
@@ -6,59 +6,56 @@
|
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
7
7
|
[](LICENSE)
|
|
8
8
|
|
|
9
|
-
<table>
|
|
10
|
-
<tr>
|
|
11
|
-
<td align="center">
|
|
12
|
-
<img src="generate-demo.gif" />
|
|
13
|
-
</td>
|
|
14
|
-
<td align="center">
|
|
15
|
-
<img src="check-demo.gif" />
|
|
16
|
-
</td>
|
|
17
|
-
</tr>
|
|
18
|
-
</table>
|
|
19
9
|
</div>
|
|
20
10
|
|
|
21
11
|
## Overview
|
|
22
12
|
|
|
23
|
-
- **
|
|
24
|
-
- **
|
|
25
|
-
- **
|
|
13
|
+
- **discover** — config discovery
|
|
14
|
+
- **generate** — schema and type generation
|
|
15
|
+
- **check** — static usage analysis
|
|
16
|
+
- **validate** — locale completeness validation
|
|
17
|
+
|
|
18
|
+
<img src='demo.gif' />
|
|
26
19
|
|
|
27
20
|
## Commands
|
|
28
21
|
|
|
29
|
-
|
|
22
|
+
Running `intor-cli` without a command launches the interactive menu.
|
|
23
|
+
|
|
24
|
+
### Discover
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx intor-cli discover
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Discovers Intor configs in the current workspace.
|
|
31
|
+
|
|
32
|
+
### Generate
|
|
30
33
|
|
|
31
34
|
```bash
|
|
32
35
|
npx intor-cli generate
|
|
33
36
|
```
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
- Uses the default locale as the single source of truth
|
|
37
|
-
- Reports message override behavior during generation
|
|
38
|
+
Generates schemas and TypeScript types from the default locale.
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
### Check
|
|
40
41
|
|
|
41
42
|
```bash
|
|
42
43
|
npx intor-cli check
|
|
43
44
|
```
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
- Detects incorrect keys, replacements, and rich tag usage
|
|
47
|
-
- Reports diagnostics with precise source locations
|
|
46
|
+
Analyzes translator usage and reports diagnostics.
|
|
48
47
|
|
|
49
|
-
|
|
48
|
+
### Validate
|
|
50
49
|
|
|
51
50
|
```bash
|
|
52
51
|
npx intor-cli validate
|
|
53
52
|
```
|
|
54
53
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
Validates locale messages against generated schemas.
|
|
55
|
+
|
|
56
|
+
---
|
|
58
57
|
|
|
59
58
|
## Design Guarantees
|
|
60
59
|
|
|
61
|
-
-
|
|
60
|
+
- Schemas and types are inferred **only from the default locale**.
|
|
62
61
|
- All locales are expected to share the same message shape.
|
|
63
|
-
- Locale is treated strictly as a runtime dimension, not a structural one.
|
|
64
|
-
- Generated types are intentionally conservative and do not enforce locale completeness.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intor-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"description": "The Intor CLI",
|
|
5
5
|
"author": "Yiming Liao",
|
|
6
6
|
"homepage": "https://github.com/yiming-liao/intor-cli#readme",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@intor/reader-yaml": "^0.1.1",
|
|
47
47
|
"cac": "6.7.14",
|
|
48
48
|
"fast-glob": "3.3.3",
|
|
49
|
-
"intor": "2.3.
|
|
49
|
+
"intor": "^2.3.35",
|
|
50
50
|
"logry": "2.1.6",
|
|
51
51
|
"ora": "9.0.0",
|
|
52
52
|
"picocolors": "1.1.1",
|
|
@@ -2,7 +2,7 @@ import type { CliOption } from "./options";
|
|
|
2
2
|
import type { CAC } from "cac";
|
|
3
3
|
import { features } from "../../constants";
|
|
4
4
|
import { generate } from "../../features";
|
|
5
|
-
import {
|
|
5
|
+
import { VERSION } from "../version";
|
|
6
6
|
import { options } from "./options";
|
|
7
7
|
import { normalizeMessageFiles } from "./utils/normalize-message-files";
|
|
8
8
|
import { normalizeReaderOptions } from "./utils/normalize-reader-options";
|
|
@@ -44,7 +44,7 @@ export function registerGenerateCommand(cli: CAC) {
|
|
|
44
44
|
messageSource: result,
|
|
45
45
|
exts,
|
|
46
46
|
customReaders,
|
|
47
|
-
toolVersion:
|
|
47
|
+
toolVersion: VERSION,
|
|
48
48
|
});
|
|
49
49
|
} catch (error) {
|
|
50
50
|
console.error(error instanceof Error ? error.message : error);
|
package/src/cli/index.ts
CHANGED
package/src/cli/menu/run.ts
CHANGED
|
@@ -4,7 +4,7 @@ import pc from "picocolors";
|
|
|
4
4
|
import { features } from "../../constants";
|
|
5
5
|
import { check, discover, generate, validate } from "../../features";
|
|
6
6
|
import { bold, italic } from "../../render";
|
|
7
|
-
import {
|
|
7
|
+
import { VERSION } from "../version";
|
|
8
8
|
import { promptCheck } from "./prompts/prompt-check";
|
|
9
9
|
import { promptDiscover } from "./prompts/prompt-discover";
|
|
10
10
|
import { promptGenerate } from "./prompts/prompt-generate";
|
|
@@ -58,7 +58,7 @@ export async function run() {
|
|
|
58
58
|
}
|
|
59
59
|
case "generate": {
|
|
60
60
|
await runAction(promptGenerate, (options) =>
|
|
61
|
-
generate({ ...options, toolVersion:
|
|
61
|
+
generate({ ...options, toolVersion: VERSION }),
|
|
62
62
|
);
|
|
63
63
|
break;
|
|
64
64
|
}
|
package/src/cli/version.ts
CHANGED
|
@@ -50,6 +50,7 @@ export async function collectRuntimeMessages(
|
|
|
50
50
|
config: { ...config, loader: serverLoader },
|
|
51
51
|
locale,
|
|
52
52
|
readers,
|
|
53
|
+
fetch: globalThis.fetch,
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
}
|
|
@@ -62,6 +63,7 @@ export async function collectRuntimeMessages(
|
|
|
62
63
|
config: { ...config, loader: clientLoader },
|
|
63
64
|
locale,
|
|
64
65
|
readers,
|
|
66
|
+
fetch: globalThis.fetch,
|
|
65
67
|
});
|
|
66
68
|
}
|
|
67
69
|
}
|