@arch-cadre/cli 0.0.11 → 1.0.3
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/dist/index.cjs +0 -276
- package/dist/index.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -28,285 +28,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
//#endregion
|
|
29
29
|
let cac = require("cac");
|
|
30
30
|
cac = __toESM(cac);
|
|
31
|
-
let chalk = require("chalk");
|
|
32
|
-
chalk = __toESM(chalk);
|
|
33
|
-
let ora = require("ora");
|
|
34
|
-
ora = __toESM(ora);
|
|
35
|
-
let node_fs_promises = require("node:fs/promises");
|
|
36
|
-
node_fs_promises = __toESM(node_fs_promises);
|
|
37
|
-
let node_path = require("node:path");
|
|
38
|
-
node_path = __toESM(node_path);
|
|
39
|
-
let node_fs = require("node:fs");
|
|
40
|
-
let fs_promises = require("fs/promises");
|
|
41
|
-
fs_promises = __toESM(fs_promises);
|
|
42
|
-
let path = require("path");
|
|
43
|
-
path = __toESM(path);
|
|
44
|
-
let glob = require("glob");
|
|
45
31
|
|
|
46
|
-
//#region src/commands/i18n.ts
|
|
47
|
-
async function extractKeys(paths) {
|
|
48
|
-
const keys = {};
|
|
49
|
-
const files = await (0, glob.glob)(paths.map((p) => `${p}/**/*.{ts,tsx,js,jsx}`), {
|
|
50
|
-
cwd: process.cwd(),
|
|
51
|
-
ignore: [
|
|
52
|
-
"**/node_modules/**",
|
|
53
|
-
"**/dist/**",
|
|
54
|
-
"**/.git/**"
|
|
55
|
-
]
|
|
56
|
-
});
|
|
57
|
-
for (const file of files) await extractFromFile(file, keys);
|
|
58
|
-
return keys;
|
|
59
|
-
}
|
|
60
|
-
async function extractFromFile(filePath, keys) {
|
|
61
|
-
try {
|
|
62
|
-
const content = await fs_promises.default.readFile(filePath, "utf-8");
|
|
63
|
-
const regex = /t\(['"`]([^'"`]+)['"`]\)/g;
|
|
64
|
-
let match;
|
|
65
|
-
while ((match = regex.exec(content)) !== null) {
|
|
66
|
-
const key = match[1];
|
|
67
|
-
const namespace = key.split(".")[0] || "common";
|
|
68
|
-
if (!keys[namespace]) keys[namespace] = [];
|
|
69
|
-
if (!keys[namespace].find((k) => k.key === key)) keys[namespace].push({
|
|
70
|
-
namespace,
|
|
71
|
-
key,
|
|
72
|
-
file: filePath
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
} catch (error) {
|
|
76
|
-
console.warn(`Warning: Could not process ${filePath}: ${error}`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async function validateLocale(locale) {
|
|
80
|
-
const issues = [];
|
|
81
|
-
try {
|
|
82
|
-
const localeDir = path.default.join(process.cwd(), "locales", locale);
|
|
83
|
-
const jsonFiles = (await fs_promises.default.readdir(localeDir)).filter((file) => file.endsWith(".json"));
|
|
84
|
-
for (const file of jsonFiles) try {
|
|
85
|
-
const filePath = path.default.join(localeDir, file);
|
|
86
|
-
const content = await fs_promises.default.readFile(filePath, "utf-8");
|
|
87
|
-
JSON.parse(content);
|
|
88
|
-
} catch {
|
|
89
|
-
issues.push({
|
|
90
|
-
type: "invalid",
|
|
91
|
-
key: file,
|
|
92
|
-
namespace: file.replace(".json", ""),
|
|
93
|
-
message: `Invalid JSON in ${file}`
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
if (locale !== "en") {
|
|
97
|
-
const enDir = path.default.join(process.cwd(), "locales", "en");
|
|
98
|
-
try {
|
|
99
|
-
const enJsonFiles = (await fs_promises.default.readdir(enDir)).filter((file) => file.endsWith(".json"));
|
|
100
|
-
for (const enFile of enJsonFiles) {
|
|
101
|
-
const namespace = enFile.replace(".json", "");
|
|
102
|
-
const localeFile = path.default.join(localeDir, enFile);
|
|
103
|
-
if (!await fs_promises.default.access(localeFile).then(() => true).catch(() => false)) issues.push({
|
|
104
|
-
type: "missing",
|
|
105
|
-
key: enFile,
|
|
106
|
-
namespace,
|
|
107
|
-
message: `Missing ${enFile} for locale ${locale}`
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
} catch {}
|
|
111
|
-
}
|
|
112
|
-
} catch (error) {
|
|
113
|
-
issues.push({
|
|
114
|
-
type: "invalid",
|
|
115
|
-
key: locale,
|
|
116
|
-
namespace: "general",
|
|
117
|
-
message: `Could not read locale directory: ${error}`
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
return {
|
|
121
|
-
locale,
|
|
122
|
-
issues,
|
|
123
|
-
hasErrors: issues.some((issue) => issue.type === "invalid" || issue.type === "missing")
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function createI18nCommands(cli$1) {
|
|
127
|
-
cli$1.command("i18n-extract [paths...]", "Extract translation keys from source files").option("-o, --output <path>", "Output file path", "locales/extracted-keys.json").option("-v, --verbose", "Verbose output").action(async (paths, options) => {
|
|
128
|
-
const spinner = (0, ora.default)("Extracting translation keys...").start();
|
|
129
|
-
try {
|
|
130
|
-
const extractedKeys = await extractKeys(Array.isArray(paths) && paths.length > 0 ? paths : [
|
|
131
|
-
"src",
|
|
132
|
-
"apps",
|
|
133
|
-
"packages"
|
|
134
|
-
]);
|
|
135
|
-
const outputPath = path.default.join(process.cwd(), options.output);
|
|
136
|
-
await fs_promises.default.mkdir(path.default.dirname(outputPath), { recursive: true });
|
|
137
|
-
await fs_promises.default.writeFile(outputPath, JSON.stringify(extractedKeys, null, 2));
|
|
138
|
-
spinner.succeed(`Extracted ${Object.keys(extractedKeys).length} namespaces to ${options.output}`);
|
|
139
|
-
if (options.verbose) for (const [namespace, keys] of Object.entries(extractedKeys)) {
|
|
140
|
-
console.log(chalk.default.blue(`\n${namespace}: ${keys.length} keys`));
|
|
141
|
-
keys.forEach((k) => console.log(` - ${k.key}`));
|
|
142
|
-
}
|
|
143
|
-
} catch (error) {
|
|
144
|
-
spinner.fail("Failed to extract keys");
|
|
145
|
-
console.error(error);
|
|
146
|
-
process.exit(1);
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
cli$1.command("i18n-generate <locale>", "Generate translation template for locale").option("-f, --force", "Overwrite existing files").action(async (locale, options) => {
|
|
150
|
-
const spinner = (0, ora.default)(`Generating template for ${locale}...`).start();
|
|
151
|
-
try {
|
|
152
|
-
const localeDir = path.default.join(process.cwd(), "locales", locale);
|
|
153
|
-
await fs_promises.default.mkdir(localeDir, { recursive: true });
|
|
154
|
-
const enDir = path.default.join(process.cwd(), "locales", "en");
|
|
155
|
-
let template = {};
|
|
156
|
-
try {
|
|
157
|
-
const jsonFiles = (await fs_promises.default.readdir(enDir)).filter((file) => file.endsWith(".json"));
|
|
158
|
-
for (const file of jsonFiles) {
|
|
159
|
-
const enPath = path.default.join(enDir, file);
|
|
160
|
-
const content = await fs_promises.default.readFile(enPath, "utf-8");
|
|
161
|
-
template = createEmptyTemplate(JSON.parse(content));
|
|
162
|
-
}
|
|
163
|
-
} catch {
|
|
164
|
-
template = { common: {
|
|
165
|
-
loading: "Loading...",
|
|
166
|
-
error: "Error",
|
|
167
|
-
success: "Success",
|
|
168
|
-
cancel: "Cancel",
|
|
169
|
-
save: "Save",
|
|
170
|
-
delete: "Delete",
|
|
171
|
-
edit: "Edit",
|
|
172
|
-
add: "Add",
|
|
173
|
-
search: "Search"
|
|
174
|
-
} };
|
|
175
|
-
}
|
|
176
|
-
for (const [namespace, translations] of Object.entries(template)) {
|
|
177
|
-
const templatePath = path.default.join(localeDir, `${namespace}.json`);
|
|
178
|
-
if (await fs_promises.default.access(templatePath).then(() => true).catch(() => false) && !options.force) {
|
|
179
|
-
spinner.warn(`Template ${namespace}.json already exists for ${locale}. Use --force to overwrite.`);
|
|
180
|
-
continue;
|
|
181
|
-
}
|
|
182
|
-
await fs_promises.default.writeFile(templatePath, JSON.stringify(translations, null, 2));
|
|
183
|
-
}
|
|
184
|
-
spinner.succeed(`Generated template for ${locale} at locales/${locale}/`);
|
|
185
|
-
} catch (error) {
|
|
186
|
-
spinner.fail("Failed to generate template");
|
|
187
|
-
console.error(error);
|
|
188
|
-
process.exit(1);
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
cli$1.command("i18n-validate [locale]", "Validate translations for locale (or all locales)").action(async (locale) => {
|
|
192
|
-
const spinner = (0, ora.default)("Validating translations...").start();
|
|
193
|
-
try {
|
|
194
|
-
const localesDir = path.default.join(process.cwd(), "locales");
|
|
195
|
-
let locales;
|
|
196
|
-
try {
|
|
197
|
-
const entries = await fs_promises.default.readdir(localesDir);
|
|
198
|
-
const localeEntries = [];
|
|
199
|
-
for (const entry of entries) {
|
|
200
|
-
const entryPath = path.default.join(localesDir, entry);
|
|
201
|
-
if ((await fs_promises.default.stat(entryPath)).isDirectory()) localeEntries.push(entry);
|
|
202
|
-
}
|
|
203
|
-
locales = locale ? [locale] : localeEntries;
|
|
204
|
-
} catch {
|
|
205
|
-
locales = locale ? [locale] : [];
|
|
206
|
-
}
|
|
207
|
-
const results = [];
|
|
208
|
-
for (const loc of locales) {
|
|
209
|
-
const result = await validateLocale(loc);
|
|
210
|
-
results.push(result);
|
|
211
|
-
}
|
|
212
|
-
spinner.stop();
|
|
213
|
-
const hasErrors = results.some((r) => r.hasErrors);
|
|
214
|
-
for (const result of results) if (result.issues.length === 0) console.log(chalk.default.green(`✓ ${result.locale}: All translations valid`));
|
|
215
|
-
else {
|
|
216
|
-
console.log(chalk.default.yellow(`${result.locale}: ${result.issues.length} issues`));
|
|
217
|
-
result.issues.forEach((issue) => {
|
|
218
|
-
const icon = issue.type === "invalid" ? chalk.default.red("✗") : chalk.default.yellow("⚠");
|
|
219
|
-
console.log(` ${icon} ${issue.message}`);
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
if (hasErrors) {
|
|
223
|
-
console.log(chalk.default.red("\nValidation failed. Please fix issues above."));
|
|
224
|
-
process.exit(1);
|
|
225
|
-
} else console.log(chalk.default.green("\nAll translations are valid!"));
|
|
226
|
-
} catch (error) {
|
|
227
|
-
spinner.fail("Failed to validate translations");
|
|
228
|
-
console.error(error);
|
|
229
|
-
process.exit(1);
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
function createEmptyTemplate(obj) {
|
|
234
|
-
if (typeof obj !== "object" || obj === null) return "";
|
|
235
|
-
if (Array.isArray(obj)) return obj.map(() => "");
|
|
236
|
-
const template = {};
|
|
237
|
-
for (const [key, value] of Object.entries(obj)) template[key] = createEmptyTemplate(value);
|
|
238
|
-
return template;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
//#endregion
|
|
242
32
|
//#region src/index.ts
|
|
243
33
|
const cli = (0, cac.default)("kryo");
|
|
244
|
-
async function updateKryoConfig(moduleName) {
|
|
245
|
-
const configPath = node_path.default.join(process.cwd(), "kryo.config.ts");
|
|
246
|
-
if (!(0, node_fs.existsSync)(configPath)) {
|
|
247
|
-
console.warn(chalk.default.yellow(`Warning: kryo.config.ts not found at ${configPath}. Skipping config update.`));
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
let content = await node_fs_promises.default.readFile(configPath, "utf-8");
|
|
251
|
-
if (content.includes(`"${moduleName}"`) || content.includes(`'${moduleName}'`)) {
|
|
252
|
-
console.log(chalk.default.blue(`Module ${moduleName} is already in kryo.config.ts`));
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
const regex = /npmModules:\s*\[([\s\S]*?)\]/;
|
|
256
|
-
const match = content.match(regex);
|
|
257
|
-
if (match) {
|
|
258
|
-
const separator = match[1].trim().length > 0 ? "," : "";
|
|
259
|
-
`${separator}${moduleName}`;
|
|
260
|
-
const newContent = content.replace(regex, (fullMatch, innerContent) => {
|
|
261
|
-
if (!innerContent.trim()) return `npmModules: ["${moduleName}"]`;
|
|
262
|
-
return `npmModules: [${innerContent.trimEnd()}${separator} "${moduleName}"]`;
|
|
263
|
-
});
|
|
264
|
-
await node_fs_promises.default.writeFile(configPath, newContent, "utf-8");
|
|
265
|
-
console.log(chalk.default.green(`Updated kryo.config.ts with ${moduleName}`));
|
|
266
|
-
} else console.warn(chalk.default.yellow("Could not find 'npmModules' array in kryo.config.ts. Please add it manually."));
|
|
267
|
-
}
|
|
268
|
-
async function updateSchemaFile(moduleName) {
|
|
269
|
-
const schemaPath = node_path.default.join(process.cwd(), "lib", "schema.ts");
|
|
270
|
-
if (!(0, node_fs.existsSync)(schemaPath)) {
|
|
271
|
-
console.warn(chalk.default.yellow(`Warning: lib/schema.ts not found. Skipping schema update.`));
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
let content = await node_fs_promises.default.readFile(schemaPath, "utf-8");
|
|
275
|
-
const schemaVarName = `${moduleName.split("/").pop()?.replace("-module", "") || "module"}Schema`;
|
|
276
|
-
if (content.includes(schemaVarName) && content.includes(moduleName)) {
|
|
277
|
-
console.log(chalk.default.blue(`Schema ${schemaVarName} is already registered.`));
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
const importLine = `import { ${schemaVarName} } from "${moduleName}";\n`;
|
|
281
|
-
const lines = content.split("\n");
|
|
282
|
-
const lastImportIndex = lines.reduce((acc, line, idx) => line.startsWith("import") ? idx : acc, 0);
|
|
283
|
-
lines.splice(lastImportIndex + 1, 0, importLine.trim());
|
|
284
|
-
content = lines.join("\n");
|
|
285
|
-
const schemaRegex = /export const schema = \{([\s\S]*?)\};/;
|
|
286
|
-
const match = content.match(schemaRegex);
|
|
287
|
-
if (match) {
|
|
288
|
-
const innerContent = match[1];
|
|
289
|
-
const separator = innerContent.trim().endsWith(",") || !innerContent.trim() ? "" : ",";
|
|
290
|
-
const newContent = content.replace(schemaRegex, `export const schema = {${innerContent.trimEnd()}${separator}\n ...${schemaVarName},\n};`);
|
|
291
|
-
await node_fs_promises.default.writeFile(schemaPath, newContent, "utf-8");
|
|
292
|
-
console.log(chalk.default.green(`Updated lib/schema.ts with ${schemaVarName}`));
|
|
293
|
-
} else console.warn(chalk.default.yellow("Could not find 'export const schema' in lib/schema.ts. Please add the schema manually."));
|
|
294
|
-
}
|
|
295
|
-
cli.command("add <module>", "Install a module from npm").action(async (moduleName) => {
|
|
296
|
-
const spinner = (0, ora.default)("Updating configuration...");
|
|
297
|
-
try {
|
|
298
|
-
await updateKryoConfig(moduleName);
|
|
299
|
-
await updateSchemaFile(moduleName);
|
|
300
|
-
spinner.succeed("Configuration and Schema updated.");
|
|
301
|
-
} catch (error) {
|
|
302
|
-
spinner.fail("Failed to update configuration.");
|
|
303
|
-
console.error(error);
|
|
304
|
-
}
|
|
305
|
-
console.log(chalk.default.green(`\nSuccess! Module ${moduleName} is ready to use.\n`));
|
|
306
|
-
});
|
|
307
|
-
console.log("About to add i18n commands...");
|
|
308
|
-
createI18nCommands(cli);
|
|
309
|
-
console.log("i18n commands added successfully");
|
|
310
34
|
console.log("CLI commands:", cli.commands?.length || "undefined");
|
|
311
35
|
cli.help();
|
|
312
36
|
cli.version("0.1.0");
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["fs","path","fs"],"sources":["../src/commands/i18n.ts","../src/index.ts"],"sourcesContent":["import fs from \"fs/promises\";\nimport path from \"path\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport { glob } from \"glob\";\n\n// Inline types to avoid dependency issues\ninterface TranslationKey {\n namespace: string;\n key: string;\n file?: string;\n description?: string;\n}\n\ninterface ExtractedKeys {\n [namespace: string]: TranslationKey[];\n}\n\ninterface ValidationResult {\n locale: string;\n issues: Array<{\n type: \"missing\" | \"invalid\" | \"unused\";\n key: string;\n namespace: string;\n message: string;\n }>;\n hasErrors: boolean;\n}\n\nasync function extractKeys(paths: string[]): Promise<ExtractedKeys> {\n const keys: ExtractedKeys = {};\n\n // Get all TypeScript/JSX files\n const files = await glob(\n paths.map((p) => `${p}/**/*.{ts,tsx,js,jsx}`),\n {\n cwd: process.cwd(),\n ignore: [\"**/node_modules/**\", \"**/dist/**\", \"**/.git/**\"],\n },\n );\n\n for (const file of files) {\n await extractFromFile(file, keys);\n }\n\n return keys;\n}\n\nasync function extractFromFile(\n filePath: string,\n keys: ExtractedKeys,\n): Promise<void> {\n try {\n const content = await fs.readFile(filePath, \"utf-8\");\n\n // Find t('key') or t(\"key\") or t(`key`) patterns\n const regex = /t\\(['\"`]([^'\"`]+)['\"`]\\)/g;\n let match;\n\n while ((match = regex.exec(content)) !== null) {\n const key = match[1];\n const namespace = key.split(\".\")[0] || \"common\";\n\n if (!keys[namespace]) {\n keys[namespace] = [];\n }\n\n // Avoid duplicates\n const existingKey = keys[namespace].find(\n (k: TranslationKey) => k.key === key,\n );\n if (!existingKey) {\n keys[namespace].push({\n namespace,\n key,\n file: filePath,\n });\n }\n }\n } catch (error) {\n console.warn(`Warning: Could not process ${filePath}: ${error}`);\n }\n}\n\nasync function validateLocale(locale: string): Promise<ValidationResult> {\n const issues: ValidationResult[\"issues\"] = [];\n\n try {\n const localeDir = path.join(process.cwd(), \"locales\", locale);\n const files = await fs.readdir(localeDir);\n const jsonFiles = files.filter((file) => file.endsWith(\".json\"));\n\n // Check for invalid JSON\n for (const file of jsonFiles) {\n try {\n const filePath = path.join(localeDir, file);\n const content = await fs.readFile(filePath, \"utf-8\");\n JSON.parse(content);\n } catch {\n issues.push({\n type: \"invalid\",\n key: file,\n namespace: file.replace(\".json\", \"\"),\n message: `Invalid JSON in ${file}`,\n });\n }\n }\n\n // Compare with English base\n if (locale !== \"en\") {\n const enDir = path.join(process.cwd(), \"locales\", \"en\");\n try {\n const enFiles = await fs.readdir(enDir);\n const enJsonFiles = enFiles.filter((file) => file.endsWith(\".json\"));\n\n for (const enFile of enJsonFiles) {\n const namespace = enFile.replace(\".json\", \"\");\n const localeFile = path.join(localeDir, enFile);\n\n if (\n !(await fs\n .access(localeFile)\n .then(() => true)\n .catch(() => false))\n ) {\n issues.push({\n type: \"missing\",\n key: enFile,\n namespace,\n message: `Missing ${enFile} for locale ${locale}`,\n });\n }\n }\n } catch {\n // English base directory might not exist\n }\n }\n } catch (error) {\n issues.push({\n type: \"invalid\",\n key: locale,\n namespace: \"general\",\n message: `Could not read locale directory: ${error}`,\n });\n }\n\n return {\n locale,\n issues,\n hasErrors: issues.some(\n (issue) => issue.type === \"invalid\" || issue.type === \"missing\",\n ),\n };\n}\n\nexport function createI18nCommands(cli: any) {\n // Extract command\n cli\n .command(\n \"i18n-extract [paths...]\",\n \"Extract translation keys from source files\",\n )\n .option(\n \"-o, --output <path>\",\n \"Output file path\",\n \"locales/extracted-keys.json\",\n )\n .option(\"-v, --verbose\", \"Verbose output\")\n .action(async (paths: string[], options: any) => {\n const spinner = ora(\"Extracting translation keys...\").start();\n\n try {\n const targetPaths =\n Array.isArray(paths) && paths.length > 0\n ? paths\n : [\"src\", \"apps\", \"packages\"];\n const extractedKeys = await extractKeys(targetPaths);\n\n // Save extracted keys\n const outputPath = path.join(process.cwd(), options.output);\n await fs.mkdir(path.dirname(outputPath), { recursive: true });\n await fs.writeFile(outputPath, JSON.stringify(extractedKeys, null, 2));\n\n spinner.succeed(\n `Extracted ${Object.keys(extractedKeys).length} namespaces to ${options.output}`,\n );\n\n if (options.verbose) {\n for (const [namespace, keys] of Object.entries(extractedKeys)) {\n console.log(chalk.blue(`\\n${namespace}: ${keys.length} keys`));\n keys.forEach((k: TranslationKey) => console.log(` - ${k.key}`));\n }\n }\n } catch (error) {\n spinner.fail(\"Failed to extract keys\");\n console.error(error);\n process.exit(1);\n }\n });\n\n // Generate command\n cli\n .command(\n \"i18n-generate <locale>\",\n \"Generate translation template for locale\",\n )\n .option(\"-f, --force\", \"Overwrite existing files\")\n .action(async (locale: string, options: any) => {\n const spinner = ora(`Generating template for ${locale}...`).start();\n\n try {\n const localeDir = path.join(process.cwd(), \"locales\", locale);\n await fs.mkdir(localeDir, { recursive: true });\n\n // Read English base if available\n const enDir = path.join(process.cwd(), \"locales\", \"en\");\n let template = {};\n\n try {\n const files = await fs.readdir(enDir);\n const jsonFiles = files.filter((file) => file.endsWith(\".json\"));\n\n for (const file of jsonFiles) {\n const enPath = path.join(enDir, file);\n const content = await fs.readFile(enPath, \"utf-8\");\n const translations = JSON.parse(content);\n\n // Create empty template with same structure\n template = createEmptyTemplate(translations);\n }\n } catch {\n // Use basic template if no English base\n template = {\n common: {\n loading: \"Loading...\",\n error: \"Error\",\n success: \"Success\",\n cancel: \"Cancel\",\n save: \"Save\",\n delete: \"Delete\",\n edit: \"Edit\",\n add: \"Add\",\n search: \"Search\",\n },\n };\n }\n\n // Write each namespace to separate file\n for (const [namespace, translations] of Object.entries(template)) {\n const templatePath = path.join(localeDir, `${namespace}.json`);\n const exists = await fs\n .access(templatePath)\n .then(() => true)\n .catch(() => false);\n\n if (exists && !options.force) {\n spinner.warn(\n `Template ${namespace}.json already exists for ${locale}. Use --force to overwrite.`,\n );\n continue;\n }\n\n await fs.writeFile(\n templatePath,\n JSON.stringify(translations, null, 2),\n );\n }\n\n spinner.succeed(\n `Generated template for ${locale} at locales/${locale}/`,\n );\n } catch (error) {\n spinner.fail(\"Failed to generate template\");\n console.error(error);\n process.exit(1);\n }\n });\n\n // Validate command\n cli\n .command(\n \"i18n-validate [locale]\",\n \"Validate translations for locale (or all locales)\",\n )\n .action(async (locale?: string) => {\n const spinner = ora(\"Validating translations...\").start();\n\n try {\n const localesDir = path.join(process.cwd(), \"locales\");\n\n // Get available locales\n let locales: string[];\n try {\n const entries = await fs.readdir(localesDir);\n const localeEntries = [];\n for (const entry of entries) {\n const entryPath = path.join(localesDir, entry);\n const stat = await fs.stat(entryPath);\n if (stat.isDirectory()) {\n localeEntries.push(entry);\n }\n }\n locales = locale ? [locale] : localeEntries;\n } catch {\n locales = locale ? [locale] : [];\n }\n\n const results: ValidationResult[] = [];\n\n for (const loc of locales) {\n const result = await validateLocale(loc);\n results.push(result);\n }\n\n spinner.stop();\n\n const hasErrors = results.some((r) => r.hasErrors);\n\n for (const result of results) {\n if (result.issues.length === 0) {\n console.log(\n chalk.green(`✓ ${result.locale}: All translations valid`),\n );\n } else {\n console.log(\n chalk.yellow(`${result.locale}: ${result.issues.length} issues`),\n );\n result.issues.forEach((issue: any) => {\n const icon =\n issue.type === \"invalid\" ? chalk.red(\"✗\") : chalk.yellow(\"⚠\");\n console.log(` ${icon} ${issue.message}`);\n });\n }\n }\n\n if (hasErrors) {\n console.log(\n chalk.red(\"\\nValidation failed. Please fix issues above.\"),\n );\n process.exit(1);\n } else {\n console.log(chalk.green(\"\\nAll translations are valid!\"));\n }\n } catch (error) {\n spinner.fail(\"Failed to validate translations\");\n console.error(error);\n process.exit(1);\n }\n });\n}\n\nfunction createEmptyTemplate(obj: any): any {\n if (typeof obj !== \"object\" || obj === null) {\n return \"\";\n }\n\n if (Array.isArray(obj)) {\n return obj.map(() => \"\");\n }\n\n const template: any = {};\n for (const [key, value] of Object.entries(obj)) {\n template[key] = createEmptyTemplate(value);\n }\n\n return template;\n}\n","#!/usr/bin/env node\nimport cac from \"cac\";\nimport chalk from \"chalk\";\nimport execa from \"execa\";\nimport ora from \"ora\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { existsSync } from \"node:fs\";\nimport { createI18nCommands } from \"./commands/i18n\";\n\nconst cli = cac(\"kryo\");\n\nasync function updateKryoConfig(moduleName: string) {\n const configPath = path.join(process.cwd(), \"kryo.config.ts\");\n\n if (!existsSync(configPath)) {\n console.warn(\n chalk.yellow(\n `Warning: kryo.config.ts not found at ${configPath}. Skipping config update.`,\n ),\n );\n return;\n }\n\n let content = await fs.readFile(configPath, \"utf-8\");\n\n // Sprawdzamy, czy moduł już jest w configu\n if (\n content.includes(`\"${moduleName}\"`) ||\n content.includes(`'${moduleName}'`)\n ) {\n console.log(\n chalk.blue(`Module ${moduleName} is already in kryo.config.ts`),\n );\n return;\n }\n\n // Prosta edycja tekstu - szukamy npmModules: [\n // Zakładamy format: npmModules: [...]\n const regex = /npmModules:\\s*\\[([\\s\\S]*?)\\]/;\n const match = content.match(regex);\n\n if (match) {\n const currentList = match[1];\n // Sprawdzamy czy lista jest pusta czy ma już elementy\n const separator = currentList.trim().length > 0 ? \",\" : \"\";\n const newEntry = `${separator}\\n \"${moduleName}\"`;\n\n // Podmieniamy zawartość tablicy\n // Dodajemy nowy wpis na końcu\n const newContent = content.replace(regex, (fullMatch, innerContent) => {\n // Jeśli innerContent jest pusty (same białe znaki), po prostu wstawiamy\n if (!innerContent.trim()) {\n return `npmModules: [\"${moduleName}\"]`;\n }\n // Jeśli nie pusty, dodajemy po ostatnim elemencie\n // Ale najbezpieczniej jest po prostu wstawić do środka\n return `npmModules: [${innerContent.trimEnd()}${separator} \"${moduleName}\"]`;\n });\n\n await fs.writeFile(configPath, newContent, \"utf-8\");\n console.log(chalk.green(`Updated kryo.config.ts with ${moduleName}`));\n } else {\n console.warn(\n chalk.yellow(\n \"Could not find 'npmModules' array in kryo.config.ts. Please add it manually.\",\n ),\n );\n }\n}\n\nasync function updateSchemaFile(moduleName: string) {\n const schemaPath = path.join(process.cwd(), \"lib\", \"schema.ts\");\n\n if (!existsSync(schemaPath)) {\n console.warn(\n chalk.yellow(`Warning: lib/schema.ts not found. Skipping schema update.`),\n );\n return;\n }\n\n let content = await fs.readFile(schemaPath, \"utf-8\");\n\n // Derive schema name from module name\n // e.g. @arch-cadre/sample-module -> sampleSchema\n const baseName =\n moduleName.split(\"/\").pop()?.replace(\"-module\", \"\") || \"module\";\n const schemaVarName = `${baseName}Schema`;\n\n if (content.includes(schemaVarName) && content.includes(moduleName)) {\n console.log(chalk.blue(`Schema ${schemaVarName} is already registered.`));\n return;\n }\n\n // 1. Add import\n const importLine = `import { ${schemaVarName} } from \"${moduleName}\";\\n`;\n // Insert after the last import\n const lines = content.split(\"\\n\");\n const lastImportIndex = lines.reduce(\n (acc, line, idx) => (line.startsWith(\"import\") ? idx : acc),\n 0,\n );\n lines.splice(lastImportIndex + 1, 0, importLine.trim());\n content = lines.join(\"\\n\");\n\n // 2. Add to spread\n const schemaRegex = /export const schema = \\{([\\s\\S]*?)\\};/;\n const match = content.match(schemaRegex);\n\n if (match) {\n const innerContent = match[1];\n const separator =\n innerContent.trim().endsWith(\",\") || !innerContent.trim() ? \"\" : \",\";\n const newContent = content.replace(\n schemaRegex,\n `export const schema = {${innerContent.trimEnd()}${separator}\\n ...${schemaVarName},\\n};`,\n );\n await fs.writeFile(schemaPath, newContent, \"utf-8\");\n console.log(chalk.green(`Updated lib/schema.ts with ${schemaVarName}`));\n } else {\n console.warn(\n chalk.yellow(\n \"Could not find 'export const schema' in lib/schema.ts. Please add the schema manually.\",\n ),\n );\n }\n}\n\ncli\n .command(\"add <module>\", \"Install a module from npm\")\n .action(async (moduleName: string) => {\n const spinner = ora(\"Updating configuration...\");\n\n try {\n await updateKryoConfig(moduleName);\n await updateSchemaFile(moduleName);\n spinner.succeed(\"Configuration and Schema updated.\");\n } catch (error) {\n spinner.fail(\"Failed to update configuration.\");\n console.error(error);\n }\n\n console.log(\n chalk.green(`\\nSuccess! Module ${moduleName} is ready to use.\\n`),\n );\n });\n\n// Add i18n commands\nconsole.log(\"About to add i18n commands...\");\ncreateI18nCommands(cli);\nconsole.log(\"i18n commands added successfully\");\n\nconsole.log(\"CLI commands:\", cli.commands?.length || \"undefined\");\n\ncli.help();\ncli.version(\"0.1.0\");\n\nconsole.log(\"About to parse CLI arguments...\");\ncli.parse();\nconsole.log(\"CLI arguments parsed\");\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,eAAe,YAAY,OAAyC;CAClE,MAAM,OAAsB,EAAE;CAG9B,MAAM,QAAQ,qBACZ,MAAM,KAAK,MAAM,GAAG,EAAE,uBAAuB,EAC7C;EACE,KAAK,QAAQ,KAAK;EAClB,QAAQ;GAAC;GAAsB;GAAc;GAAa;EAC3D,CACF;AAED,MAAK,MAAM,QAAQ,MACjB,OAAM,gBAAgB,MAAM,KAAK;AAGnC,QAAO;;AAGT,eAAe,gBACb,UACA,MACe;AACf,KAAI;EACF,MAAM,UAAU,MAAMA,oBAAG,SAAS,UAAU,QAAQ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BAA4B;AAEhD,KAAI;AACF,QAAM,iBAAiB,WAAW;AAClC,QAAM,iBAAiB,WAAW;AAClC,UAAQ,QAAQ,oCAAoC;UAC7C,OAAO;AACd,UAAQ,KAAK,kCAAkC;AAC/C,UAAQ,MAAM,MAAM;;AAGtB,SAAQ,IACN,cAAM,MAAM,qBAAqB,WAAW,qBAAqB,CAClE;EACD;AAGJ,QAAQ,IAAI,gCAAgC;AAC5C,mBAAmB,IAAI;AACvB,QAAQ,IAAI,mCAAmC;AAE/C,QAAQ,IAAI,iBAAiB,IAAI,UAAU,UAAU,YAAY;AAEjE,IAAI,MAAM;AACV,IAAI,QAAQ,QAAQ;AAEpB,QAAQ,IAAI,kCAAkC;AAC9C,IAAI,OAAO;AACX,QAAQ,IAAI,uBAAuB"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { existsSync } from \"node:fs\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport cac from \"cac\";\nimport chalk from \"chalk\";\nimport execa from \"execa\";\nimport ora from \"ora\";\n\nconst cli = cac(\"kryo\");\n\n// cli\n// .command(\"add <module>\", \"Install a module from npm\")\n// .action(async (moduleName: string) => {\n// const spinner = ora(\"Updating configuration...\");\n\n// try {\n// await updateKryoConfig(moduleName);\n// await updateSchemaFile(moduleName);\n// spinner.succeed(\"Configuration and Schema updated.\");\n// } catch (error) {\n// spinner.fail(\"Failed to update configuration.\");\n// console.error(error);\n// }\n\n// console.log(\n// chalk.green(`\\nSuccess! Module ${moduleName} is ready to use.\\n`),\n// );\n// });\n\nconsole.log(\"CLI commands:\", cli.commands?.length || \"undefined\");\n\ncli.help();\ncli.version(\"0.1.0\");\n\nconsole.log(\"About to parse CLI arguments...\");\ncli.parse();\nconsole.log(\"CLI arguments parsed\");\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,uBAAU,OAAO;AAqBvB,QAAQ,IAAI,iBAAiB,IAAI,UAAU,UAAU,YAAY;AAEjE,IAAI,MAAM;AACV,IAAI,QAAQ,QAAQ;AAEpB,QAAQ,IAAI,kCAAkC;AAC9C,IAAI,OAAO;AACX,QAAQ,IAAI,uBAAuB"}
|