intor-cli 0.0.7 → 0.0.8
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intor-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "📟 CLI tool for intor",
|
|
5
5
|
"author": "Yiming Liao",
|
|
6
6
|
"homepage": "https://github.com/yiming-liao/intor-cli#readme",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@intor/reader-yaml": "0.1.0",
|
|
44
44
|
"cac": "6.7.14",
|
|
45
45
|
"fast-glob": "3.3.3",
|
|
46
|
-
"intor": "2.3.
|
|
46
|
+
"intor": "2.3.19",
|
|
47
47
|
"logry": "2.1.6",
|
|
48
48
|
"ora": "9.0.0",
|
|
49
49
|
"picocolors": "1.1.1",
|
|
@@ -3,7 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
import fg from "fast-glob";
|
|
4
4
|
import { type IntorResolvedConfig } from "intor";
|
|
5
5
|
import { createLogger } from "../scan-logger";
|
|
6
|
-
import {
|
|
6
|
+
import { isIntorResolvedConfig } from "./is-intor-resolved-config";
|
|
7
7
|
import { loadModule } from "./load-module";
|
|
8
8
|
|
|
9
9
|
const DEFAULT_PATTERNS = ["**/*.{ts,js}"];
|
|
@@ -64,7 +64,7 @@ export async function discoverConfigs(debug?: boolean): Promise<ConfigEntry[]> {
|
|
|
64
64
|
|
|
65
65
|
for (const module of Object.values(moduleExports)) {
|
|
66
66
|
const config = module as IntorResolvedConfig;
|
|
67
|
-
if (!
|
|
67
|
+
if (!isIntorResolvedConfig(config)) continue;
|
|
68
68
|
|
|
69
69
|
matched = true;
|
|
70
70
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IntorResolvedConfig } from "intor";
|
|
2
|
+
|
|
3
|
+
export function isIntorResolvedConfig(
|
|
4
|
+
value: unknown,
|
|
5
|
+
): value is IntorResolvedConfig {
|
|
6
|
+
if (!value || typeof value !== "object") return false;
|
|
7
|
+
|
|
8
|
+
const config = value as IntorResolvedConfig;
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
typeof config.id === "string" &&
|
|
12
|
+
typeof config.defaultLocale === "string" &&
|
|
13
|
+
Array.isArray(config.supportedLocales)
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { INTOR_CONFIG_SYMBOL, type IntorResolvedConfig } from "intor";
|
|
2
|
-
|
|
3
|
-
export function isIntorConfig(value: unknown): value is IntorResolvedConfig {
|
|
4
|
-
if (
|
|
5
|
-
!value ||
|
|
6
|
-
typeof value !== "object" ||
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
-
(value as any)[INTOR_CONFIG_SYMBOL] !== true
|
|
9
|
-
) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const config = value as IntorResolvedConfig;
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
typeof config.id === "string" &&
|
|
17
|
-
typeof config.defaultLocale === "string" &&
|
|
18
|
-
Array.isArray(config.supportedLocales)
|
|
19
|
-
);
|
|
20
|
-
}
|