@windrun-huaiin/dev-scripts 6.8.2 → 6.9.1

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.
Files changed (65) hide show
  1. package/dist/cli.d.ts +2 -0
  2. package/dist/cli.d.ts.map +1 -0
  3. package/dist/cli.js +137 -1410
  4. package/dist/cli.mjs +145 -432
  5. package/dist/commands/check-translations.d.ts +3 -0
  6. package/dist/commands/check-translations.d.ts.map +1 -0
  7. package/dist/commands/check-translations.js +132 -0
  8. package/dist/commands/check-translations.mjs +130 -0
  9. package/dist/commands/clean-translations.d.ts +3 -0
  10. package/dist/commands/clean-translations.d.ts.map +1 -0
  11. package/dist/commands/clean-translations.js +148 -0
  12. package/dist/commands/clean-translations.mjs +146 -0
  13. package/dist/commands/create-diaomao-app.d.ts +2 -0
  14. package/dist/commands/create-diaomao-app.d.ts.map +1 -0
  15. package/dist/commands/create-diaomao-app.js +151 -0
  16. package/dist/commands/create-diaomao-app.mjs +149 -0
  17. package/dist/commands/deep-clean.d.ts +3 -0
  18. package/dist/commands/deep-clean.d.ts.map +1 -0
  19. package/dist/commands/deep-clean.js +119 -0
  20. package/dist/commands/deep-clean.mjs +117 -0
  21. package/dist/commands/easy-changeset.d.ts +2 -0
  22. package/dist/commands/easy-changeset.d.ts.map +1 -0
  23. package/dist/commands/easy-changeset.js +39 -0
  24. package/dist/commands/easy-changeset.mjs +37 -0
  25. package/dist/commands/generate-blog-index.d.ts +3 -0
  26. package/dist/commands/generate-blog-index.d.ts.map +1 -0
  27. package/dist/commands/generate-blog-index.js +302 -0
  28. package/dist/commands/generate-blog-index.mjs +300 -0
  29. package/dist/commands/generate-nextjs-architecture.d.ts +3 -0
  30. package/dist/commands/generate-nextjs-architecture.d.ts.map +1 -0
  31. package/dist/commands/generate-nextjs-architecture.js +84 -0
  32. package/dist/commands/generate-nextjs-architecture.mjs +82 -0
  33. package/dist/config/index.d.ts +10 -0
  34. package/dist/config/index.d.ts.map +1 -0
  35. package/dist/config/index.js +173 -0
  36. package/dist/config/index.mjs +170 -0
  37. package/dist/config/schema.d.ts +34 -0
  38. package/dist/config/schema.d.ts.map +1 -0
  39. package/dist/config/schema.js +80 -0
  40. package/dist/config/schema.mjs +78 -0
  41. package/dist/index.d.ts +6 -49
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.js +9 -996
  44. package/dist/index.mjs +4 -3
  45. package/dist/utils/file-scanner.d.ts +22 -0
  46. package/dist/utils/file-scanner.d.ts.map +1 -0
  47. package/dist/utils/file-scanner.js +70 -0
  48. package/dist/utils/file-scanner.mjs +65 -0
  49. package/dist/utils/logger.d.ts +24 -0
  50. package/dist/utils/logger.d.ts.map +1 -0
  51. package/dist/utils/logger.js +63 -0
  52. package/dist/utils/logger.mjs +61 -0
  53. package/dist/utils/translation-parser.d.ts +29 -0
  54. package/dist/utils/translation-parser.d.ts.map +1 -0
  55. package/dist/utils/translation-parser.js +225 -0
  56. package/dist/utils/translation-parser.mjs +218 -0
  57. package/package.json +5 -5
  58. package/dist/chunk-GVR6HFHM.mjs +0 -989
  59. package/dist/chunk-GVR6HFHM.mjs.map +0 -1
  60. package/dist/cli.d.mts +0 -1
  61. package/dist/cli.js.map +0 -1
  62. package/dist/cli.mjs.map +0 -1
  63. package/dist/index.d.mts +0 -49
  64. package/dist/index.js.map +0 -1
  65. package/dist/index.mjs.map +0 -1
package/dist/cli.mjs CHANGED
@@ -1,459 +1,172 @@
1
1
  #!/usr/bin/env node
2
- import { loadConfig, validateConfig, checkTranslations, cleanTranslations, generateBlogIndex, Logger, DEFAULT_CONFIG, readJsonFile } from './chunk-GVR6HFHM.mjs';
3
2
  import { program } from 'commander';
4
- import { existsSync, unlinkSync, rmSync, readFileSync, writeFileSync, mkdirSync, statSync, readdirSync } from 'fs';
5
- import path, { resolve, join } from 'path';
6
- import { execSync } from 'child_process';
7
- import { pathExists, ensureDir, copy, rename, writeFile, readJson, writeJson, remove } from 'fs-extra';
8
- import os from 'os';
3
+ import { loadConfig, validateConfig } from './config/index.mjs';
4
+ import { checkTranslations } from './commands/check-translations.mjs';
5
+ import { cleanTranslations } from './commands/clean-translations.mjs';
6
+ import { generateBlogIndex } from './commands/generate-blog-index.mjs';
7
+ import { deepClean } from './commands/deep-clean.mjs';
8
+ import { easyChangeset } from './commands/easy-changeset.mjs';
9
+ import { generateNextjsArchitecture } from './commands/generate-nextjs-architecture.mjs';
10
+ import { createDiaomaoApp } from './commands/create-diaomao-app.mjs';
9
11
 
10
- var MONOREPO_CLEAN_TARGETS = [
11
- { pattern: "node_modules", description: "Root directory dependencies" },
12
- { pattern: "packages/*/node_modules", description: "Package dependencies" },
13
- { pattern: "apps/*/node_modules", description: "Application dependencies" },
14
- { pattern: "apps/*/.next", description: "Next.js cache" },
15
- { pattern: "packages/*/dist", description: "Package build artifacts" },
16
- { pattern: "apps/*/dist", description: "Application build artifacts" },
17
- { pattern: ".turbo", description: "Root directory Turbo cache" },
18
- { pattern: "packages/*/.turbo", description: "Package Turbo cache" },
19
- { pattern: "apps/*/.turbo", description: "Application Turbo cache" },
20
- { pattern: "pnpm-lock.yaml", description: "pnpm lock file", isFile: true }
21
- ];
22
- var SINGLE_CLEAN_TARGETS = [
23
- { pattern: "node_modules", description: "Root directory dependencies" },
24
- { pattern: ".next", description: "Next.js cache" },
25
- { pattern: "pnpm-lock.yaml", description: "pnpm lock file", isFile: true }
26
- ];
27
- function globDirsOrFiles(pattern, cwd2, isFile) {
28
- if (!pattern.includes("*")) {
29
- const abs = resolve(cwd2, pattern);
30
- if (isFile) {
31
- return existsSync(abs) ? [abs] : [];
32
- }
33
- return existsSync(abs) && statSync(abs).isDirectory() ? [abs] : [];
34
- }
35
- const [base, rest] = pattern.split("/*");
36
- const absBase = resolve(cwd2, base);
37
- if (!existsSync(absBase) || !statSync(absBase).isDirectory()) return [];
38
- const subdirs = readdirSync(absBase);
39
- return subdirs.map((d) => join(absBase, d, rest.replace(/^[\/]/, ""))).filter((p) => existsSync(p) && (isFile ? true : statSync(p).isDirectory()));
40
- }
41
- async function deepClean(config, yes = false, cwd2 = typeof process !== "undefined" ? process.cwd() : ".") {
42
- const logger = new Logger(config);
43
- if (process.env.NODE_ENV === "production") {
44
- logger.error("\u274C Production environment prohibits deep clean operations");
45
- logger.log(" If you need to clean, please set: NODE_ENV=development");
46
- logger.saveToFile("deep-clean.log", cwd2);
47
- return 1;
48
- }
49
- logger.warn("==============================");
50
- logger.warn(`\u203C\uFE0F Current working directory: \u2B55 ${cwd2} \u2B55`);
51
- logger.warn("==============================");
52
- const isMonorepo = existsSync(resolve(cwd2, "pnpm-workspace.yaml"));
53
- const cleanTargets = isMonorepo ? MONOREPO_CLEAN_TARGETS : SINGLE_CLEAN_TARGETS;
54
- let totalToDelete = [];
55
- let groupDeleteMap = {};
56
- for (const target of cleanTargets) {
57
- const found = globDirsOrFiles(target.pattern, cwd2, target.isFile);
58
- groupDeleteMap[target.description] = found;
59
- if (found.length === 0) {
60
- logger.info(`\u{1F4AF} ${target.description}: No need to clean`);
61
- } else {
62
- logger.log(`
63
- [${target.description}]`);
64
- found.forEach((p) => logger.warn(`\u{1F459} [Preview] ${p}`));
65
- totalToDelete.push(...found);
66
- }
67
- }
68
- if (totalToDelete.length === 0) {
69
- logger.success("No directories or files to clean.");
70
- logger.saveToFile("deep-clean.log", cwd2);
71
- return 0;
72
- }
73
- if (!yes) {
74
- logger.log("\nIf you need to actually delete, please add --yes parameter.");
75
- logger.saveToFile("deep-clean.log", cwd2);
76
- return 0;
77
- }
78
- let deleted = 0;
79
- for (const target of cleanTargets) {
80
- const items = groupDeleteMap[target.description] || [];
81
- if (items.length > 0) {
82
- logger.log(`
83
- [${target.description}]`);
84
- for (const p of items) {
85
- try {
86
- if (target.isFile) {
87
- unlinkSync(p);
88
- if (!existsSync(p)) {
89
- logger.success(`\u{1F37B} Deleted: ${p}`);
90
- deleted++;
91
- } else {
92
- logger.error(`\u274C Delete failed: ${p} (file still exists)`);
93
- }
94
- } else {
95
- rmSync(p, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
96
- if (!existsSync(p)) {
97
- logger.success(`\u{1F37B} Deleted: ${p}`);
98
- deleted++;
99
- } else {
100
- logger.error(`\u274C Delete failed: ${p} (directory still exists)`);
101
- }
102
- }
103
- } catch (e) {
104
- logger.error(`\u274C Delete failed: ${p} (${e.message})`);
12
+ // get current working directory, ensure it works in Node.js environment
13
+ const cwd = typeof process !== 'undefined' ? process.cwd() : '.';
14
+ program
15
+ .name('dev-scripts')
16
+ .description('development scripts for multi-language projects')
17
+ .version('5.0.0');
18
+ program
19
+ .command('check-translations')
20
+ .description('check the completeness and consistency of translation files')
21
+ .option('-v, --verbose', 'show detailed logs', false)
22
+ .action(async (options) => {
23
+ try {
24
+ const config = loadConfig(cwd, {}, options.verbose);
25
+ // apply verbose option after loading
26
+ if (options.verbose) {
27
+ config.output.verbose = true;
105
28
  }
106
- }
107
- }
108
- }
109
- logger.log(`
110
- \u{1F37A} Total cleaned: ${deleted} directories or files.`);
111
- logger.saveToFile("deep-clean.log", cwd2);
112
- return 0;
113
- }
114
- async function easyChangeset(cwd2 = typeof process !== "undefined" ? process.cwd() : ".") {
115
- if (process.env.NODE_ENV === "production") {
116
- console.log("\u274C Production environment prohibits deep clean operations");
117
- console.log(" If you need to clean, please set: NODE_ENV=development");
118
- return 1;
119
- }
120
- console.log("==============================");
121
- console.log(`\u203C\uFE0F Current working directory: \u2B55 ${cwd2} \u2B55`);
122
- console.log("==============================");
123
- const changesetDir = join(cwd2, ".changeset");
124
- const mdxFile = join(changesetDir, "d8-template.mdx");
125
- const mdFile = join(changesetDir, "d8-template.md");
126
- if (!existsSync(changesetDir)) {
127
- console.log("\u274C No .changeset directory found, skipping.");
128
- return 1;
129
- }
130
- if (!existsSync(mdxFile)) {
131
- console.log("\u274C No .changeset/d8-template.mdx file found, skipping.");
132
- return 1;
133
- }
134
- try {
135
- const content = readFileSync(mdxFile, "utf-8");
136
- writeFileSync(mdFile, content, "utf-8");
137
- console.log("\u2705 Copied d8-template.mdx content to d8-template.md");
138
- return 0;
139
- } catch (e) {
140
- console.log("\u274C Copy failed:", e.message);
141
- return 1;
142
- }
143
- }
144
- function getCurrentDateString() {
145
- const now = /* @__PURE__ */ new Date();
146
- const year = now.getFullYear();
147
- const month = String(now.getMonth() + 1).padStart(2, "0");
148
- const day = String(now.getDate()).padStart(2, "0");
149
- return `${year}-${month}-${day}`;
150
- }
151
- async function generateNextjsArchitecture(config, cwd2 = typeof process !== "undefined" ? process.cwd() : ".") {
152
- const logger = new Logger(config);
153
- try {
154
- let renderTree2 = function(nodes, depth = 0, parentPath = "") {
155
- let mdx2 = "";
156
- for (const node of nodes) {
157
- const nodePath = parentPath ? `${parentPath}/${node.name}` : node.name;
158
- const anotion = architectureConfig[node.name] || "";
159
- const displayName = depth === 0 && node.name === "." ? "ROOT" : node.name;
160
- if (node.type === "directory") {
161
- if (!node.contents || node.contents.length === 0) {
162
- mdx2 += `${" ".repeat(depth)}<ZiaFolder name="${displayName}" anotion="${anotion}" className="opacity-50" disabled/>
163
- `;
164
- } else {
165
- mdx2 += `${" ".repeat(depth)}<ZiaFolder name="${displayName}" anotion="${anotion}" defaultOpen>
166
- `;
167
- mdx2 += renderTree2(node.contents, depth + 1, nodePath);
168
- mdx2 += `${" ".repeat(depth)}</ZiaFolder>
169
- `;
170
- }
171
- } else if (node.type === "file") {
172
- mdx2 += `${" ".repeat(depth)}<ZiaFile name="${node.name}" anotion="${anotion}" href="" />
173
- `;
29
+ validateConfig(config);
30
+ const exitCode = await checkTranslations(config, cwd);
31
+ if (typeof process !== 'undefined') {
32
+ process.exit(exitCode);
174
33
  }
175
- }
176
- return mdx2;
177
- };
178
- var renderTree = renderTree2;
179
- const logsDir = join(cwd2, config.output?.logDir || "logs");
180
- const blogDir = join(cwd2, config.blog?.mdxDir || "src/mdx/blog");
181
- if (!existsSync(logsDir)) mkdirSync(logsDir, { recursive: true });
182
- if (!existsSync(blogDir)) mkdirSync(blogDir, { recursive: true });
183
- const treeJsonPath = join(logsDir, "project_tree.json");
184
- logger.log(`Running tree command to generate ${treeJsonPath}`);
185
- execSync(`tree -a -J -I '.next|node_modules|logs|dist|pnpm-lock.yaml|turbo|.turbo|public|.cursor|.DS_Store|.git' > ${treeJsonPath}`);
186
- const tree = readJsonFile(treeJsonPath);
187
- if (!tree) {
188
- logger.error("Failed to read tree JSON result!");
189
- return 1;
190
- }
191
- const userConfig = config.architectureConfig || {};
192
- const architectureConfig = { ...DEFAULT_CONFIG.architectureConfig || {}, ...userConfig };
193
- const frontmatter = `---
194
- title: About Project Structure
195
- description: Show all source code directories and files
196
- icon: Gift
197
- date: ${getCurrentDateString()}
198
- ---
199
-
200
- ## Quick Started
201
-
202
- `;
203
- const filesContent = renderTree2(tree);
204
- const indentedFilesContent = filesContent.split("\n").map((line) => line ? " " + line : "").join("\n");
205
- const mdx = frontmatter + "<Files>\n" + indentedFilesContent + "</Files>\n";
206
- const outputMdxPath = join(blogDir, "nextjs-architecture.mdx");
207
- writeFileSync(outputMdxPath, mdx);
208
- logger.success(`Successfully generated ${outputMdxPath}`);
209
- logger.saveToFile("generate-nextjs-architecture.log", cwd2);
210
- return 0;
211
- } catch (error) {
212
- logger.error(`Error generating nextjs architecture mdx: ${error}`);
213
- return 1;
214
- }
215
- }
216
- async function createDiaomaoApp(targetDir) {
217
- if (!targetDir) {
218
- console.error("Usage: create-diaomao-app <project-name>");
219
- process.exit(1);
220
- }
221
- const cwd2 = process.cwd();
222
- const cwdPackageJson = path.join(cwd2, "package.json");
223
- const cwdWorkspaceYaml = path.join(cwd2, "pnpm-workspace.yaml");
224
- const hasPkgJson = await pathExists(cwdPackageJson);
225
- const hasWorkspace = await pathExists(cwdWorkspaceYaml);
226
- let destDir;
227
- if (hasPkgJson && hasWorkspace) {
228
- console.error("Detected monorepo environment, NextJS DO NOT SUPPORT MONOREPO WELL!");
229
- process.exit(1);
230
- } else if (hasPkgJson && !hasWorkspace) {
231
- console.error("Warning: You are in a directory that already contains package.json");
232
- console.error("This might create a nested project structure which is usually not intended.");
233
- console.error("");
234
- console.error("Recommendations:");
235
- console.error("- If you want to create a standalone project, run this command in an empty directory");
236
- console.error("- If you want to add to a monorepo, run this command in the monorepo root");
237
- console.error("");
238
- process.exit(1);
239
- } else {
240
- destDir = path.resolve(cwd2, targetDir);
241
- }
242
- const tempDir = path.join(os.tmpdir(), `diaomao-template-${Date.now()}`);
243
- console.log(`Creating project: ${targetDir}...`);
244
- try {
245
- await ensureDir(tempDir);
246
- console.log("Downloading diaomao template from npm...");
247
- execSync(`npm pack @windrun-huaiin/diaomao`, { cwd: tempDir, stdio: "inherit" });
248
- const packageFiles = execSync("ls *.tgz", { cwd: tempDir, encoding: "utf8" }).trim().split("\n");
249
- const packageFile = packageFiles[0];
250
- execSync(`tar -xzf ${packageFile}`, { cwd: tempDir });
251
- const templateDir = path.join(tempDir, "package");
252
- await copy(templateDir, destDir, { overwrite: true });
253
- const envTxtPath = path.join(destDir, ".env.local.txt");
254
- const envPath = path.join(destDir, ".env.local");
255
- if (await pathExists(envTxtPath)) {
256
- await rename(envTxtPath, envPath);
257
- console.log("Renamed .env.local.txt to .env.local");
258
34
  }
259
- const changesetDir = path.join(destDir, ".changeset");
260
- if (await pathExists(changesetDir)) {
261
- const templateFile = path.join(changesetDir, "d8-template.mdx");
262
- const changesetContent = `---
263
- "${path.basename(targetDir)}": major
264
- ---
265
-
266
- feat(init): app created by @windrun-huaiin/diaomao`;
267
- await writeFile(templateFile, changesetContent, "utf8");
268
- console.log("Created changeset template file: d8-template.mdx");
269
- }
270
- const pkgPath = path.join(destDir, "package.json");
271
- const pkg = await readJson(pkgPath);
272
- pkg.name = path.basename(targetDir);
273
- pkg.version = "1.0.0";
274
- pkg.private = true;
275
- pkg.pnpm = {
276
- "onlyBuiltDependencies": [
277
- "@clerk/shared",
278
- "@parcel/watcher",
279
- "@tailwindcss/oxide",
280
- "core-js",
281
- "esbuild",
282
- "sharp",
283
- "unrs-resolver"
284
- ],
285
- "overrides": {
286
- "@types/react": "19.1.2",
287
- "@types/react-dom": "19.1.3"
288
- },
289
- "patchedDependencies": {
290
- "fumadocs-ui@15.3.3": "patches/fumadocs-ui@15.3.3.patch"
291
- }
292
- };
293
- if (pkg.scripts) {
294
- delete pkg.scripts["djvp"];
295
- }
296
- delete pkg.publishConfig;
297
- delete pkg.files;
298
- await writeJson(pkgPath, pkg, { spaces: 2 });
299
- console.log("Installing dependencies...");
300
- try {
301
- execSync("pnpm install", { cwd: destDir, stdio: "inherit" });
302
- } catch (error) {
303
- console.warn("pnpm failed, trying npm...");
304
- try {
305
- execSync("npm install", { cwd: destDir, stdio: "inherit" });
306
- } catch (npmError) {
307
- console.error("Failed to install dependencies. Please run npm install or pnpm install manually.");
308
- }
309
- }
310
- console.log("Initializing Git repository...");
311
- try {
312
- execSync("git init", { cwd: destDir, stdio: "inherit" });
313
- execSync("git add .", { cwd: destDir, stdio: "inherit" });
314
- execSync('git commit -m "feat: initial commit from diaomao template"', { cwd: destDir, stdio: "inherit" });
315
- } catch (error) {
316
- console.warn("Failed to initialize Git repository. Please initialize manually.");
35
+ catch (error) {
36
+ console.error('Error:', error);
37
+ if (typeof process !== 'undefined') {
38
+ process.exit(1);
39
+ }
317
40
  }
318
- console.log(`
319
- \u2705 Project created: ${destDir}`);
320
- console.log(`
321
- Next steps:`);
322
- console.log(` cd ${targetDir}`);
323
- console.log(` pnpm build`);
324
- console.log(` pnpm dev`);
325
- console.log(` NOTE: if you want to update @windrun-huaiin packages, please run pnpm windrun`);
326
- console.log(` NOTE: please check .env.local file and set your own env!`);
327
- } catch (error) {
328
- console.error("Failed to create project:", error);
329
- process.exit(1);
330
- } finally {
41
+ });
42
+ program
43
+ .command('clean-translations')
44
+ .description('clean unused translation keys')
45
+ .option('-v, --verbose', 'show detailed logs', false)
46
+ .option('--remove', 'actually delete unused keys (default only show)', false)
47
+ .action(async (options) => {
331
48
  try {
332
- await remove(tempDir);
333
- } catch (cleanupError) {
334
- console.warn("Failed to cleanup temporary directory:", tempDir);
335
- }
336
- }
337
- }
338
-
339
- // src/cli.ts
340
- var cwd = typeof process !== "undefined" ? process.cwd() : ".";
341
- program.name("dev-scripts").description("development scripts for multi-language projects").version("5.0.0");
342
- program.command("check-translations").description("check the completeness and consistency of translation files").option("-v, --verbose", "show detailed logs", false).action(async (options) => {
343
- try {
344
- const config = loadConfig(cwd, {}, options.verbose);
345
- if (options.verbose) {
346
- config.output.verbose = true;
347
- }
348
- validateConfig(config);
349
- const exitCode = await checkTranslations(config, cwd);
350
- if (typeof process !== "undefined") {
351
- process.exit(exitCode);
49
+ const config = loadConfig(cwd, {}, options.verbose);
50
+ // apply verbose option after loading
51
+ if (options.verbose) {
52
+ config.output.verbose = true;
53
+ }
54
+ validateConfig(config);
55
+ const exitCode = await cleanTranslations(config, options.remove, cwd);
56
+ if (typeof process !== 'undefined') {
57
+ process.exit(exitCode);
58
+ }
352
59
  }
353
- } catch (error) {
354
- console.error("Error:", error);
355
- if (typeof process !== "undefined") {
356
- process.exit(1);
60
+ catch (error) {
61
+ console.error('Error:', error);
62
+ if (typeof process !== 'undefined') {
63
+ process.exit(1);
64
+ }
357
65
  }
358
- }
359
66
  });
360
- program.command("clean-translations").description("clean unused translation keys").option("-v, --verbose", "show detailed logs", false).option("--remove", "actually delete unused keys (default only show)", false).action(async (options) => {
361
- try {
362
- const config = loadConfig(cwd, {}, options.verbose);
363
- if (options.verbose) {
364
- config.output.verbose = true;
365
- }
366
- validateConfig(config);
367
- const exitCode = await cleanTranslations(config, options.remove, cwd);
368
- if (typeof process !== "undefined") {
369
- process.exit(exitCode);
67
+ program
68
+ .command('generate-blog-index')
69
+ .description('generate blog index file')
70
+ .option('-v, --verbose', 'show detailed logs', false)
71
+ .action(async (options) => {
72
+ try {
73
+ const config = loadConfig(cwd, {}, options.verbose);
74
+ // apply verbose option after loading
75
+ if (options.verbose) {
76
+ config.output.verbose = true;
77
+ }
78
+ validateConfig(config);
79
+ const exitCode = await generateBlogIndex(config, cwd);
80
+ if (typeof process !== 'undefined') {
81
+ process.exit(exitCode);
82
+ }
370
83
  }
371
- } catch (error) {
372
- console.error("Error:", error);
373
- if (typeof process !== "undefined") {
374
- process.exit(1);
84
+ catch (error) {
85
+ console.error('Error:', error);
86
+ if (typeof process !== 'undefined') {
87
+ process.exit(1);
88
+ }
375
89
  }
376
- }
377
90
  });
378
- program.command("generate-blog-index").description("generate blog index file").option("-v, --verbose", "show detailed logs", false).action(async (options) => {
379
- try {
380
- const config = loadConfig(cwd, {}, options.verbose);
381
- if (options.verbose) {
382
- config.output.verbose = true;
383
- }
384
- validateConfig(config);
385
- const exitCode = await generateBlogIndex(config, cwd);
386
- if (typeof process !== "undefined") {
387
- process.exit(exitCode);
91
+ program
92
+ .command('deep-clean')
93
+ .description('clean all node_modules, dist, .next, .turbo and related caches in monorepo')
94
+ .option('--yes', 'actually delete matched directories (default only preview)', false)
95
+ .option('-v, --verbose', 'show detailed logs', false)
96
+ .action(async (options) => {
97
+ try {
98
+ const config = loadConfig(cwd, {}, options.verbose);
99
+ if (options.verbose) {
100
+ config.output.verbose = true;
101
+ }
102
+ validateConfig(config);
103
+ const exitCode = await deepClean(config, options.yes, cwd);
104
+ if (typeof process !== 'undefined') {
105
+ process.exit(exitCode);
106
+ }
388
107
  }
389
- } catch (error) {
390
- console.error("Error:", error);
391
- if (typeof process !== "undefined") {
392
- process.exit(1);
108
+ catch (error) {
109
+ console.error('Error:', error);
110
+ if (typeof process !== 'undefined') {
111
+ process.exit(1);
112
+ }
393
113
  }
394
- }
395
114
  });
396
- program.command("deep-clean").description("clean all node_modules, dist, .next, .turbo and related caches in monorepo").option("--yes", "actually delete matched directories (default only preview)", false).option("-v, --verbose", "show detailed logs", false).action(async (options) => {
397
- try {
398
- const config = loadConfig(cwd, {}, options.verbose);
399
- if (options.verbose) {
400
- config.output.verbose = true;
401
- }
402
- validateConfig(config);
403
- const exitCode = await deepClean(config, options.yes, cwd);
404
- if (typeof process !== "undefined") {
405
- process.exit(exitCode);
115
+ program
116
+ .command('easy-changeset')
117
+ .description('copy .changeset/d8-template.mdx to .changeset/d8-template.md if both exist')
118
+ .action(async () => {
119
+ try {
120
+ const exitCode = await easyChangeset(cwd);
121
+ if (typeof process !== 'undefined') {
122
+ process.exit(exitCode);
123
+ }
406
124
  }
407
- } catch (error) {
408
- console.error("Error:", error);
409
- if (typeof process !== "undefined") {
410
- process.exit(1);
125
+ catch (error) {
126
+ console.error('Error:', error);
127
+ if (typeof process !== 'undefined') {
128
+ process.exit(1);
129
+ }
411
130
  }
412
- }
413
131
  });
414
- program.command("easy-changeset").description("copy .changeset/d8-template.mdx to .changeset/d8-template.md if both exist").action(async () => {
415
- try {
416
- const exitCode = await easyChangeset(cwd);
417
- if (typeof process !== "undefined") {
418
- process.exit(exitCode);
132
+ program
133
+ .command('generate-nextjs-architecture')
134
+ .description('generate nextjs-architecture.mdx for project structure')
135
+ .option('-v, --verbose', 'show detailed logs', false)
136
+ .action(async (options) => {
137
+ try {
138
+ const config = loadConfig(cwd, {}, options.verbose);
139
+ if (options.verbose) {
140
+ config.output.verbose = true;
141
+ }
142
+ validateConfig(config);
143
+ const exitCode = await generateNextjsArchitecture(config, cwd);
144
+ if (typeof process !== 'undefined') {
145
+ process.exit(exitCode);
146
+ }
419
147
  }
420
- } catch (error) {
421
- console.error("Error:", error);
422
- if (typeof process !== "undefined") {
423
- process.exit(1);
148
+ catch (error) {
149
+ console.error('Error:', error);
150
+ if (typeof process !== 'undefined') {
151
+ process.exit(1);
152
+ }
424
153
  }
425
- }
426
154
  });
427
- program.command("generate-nextjs-architecture").description("generate nextjs-architecture.mdx for project structure").option("-v, --verbose", "show detailed logs", false).action(async (options) => {
428
- try {
429
- const config = loadConfig(cwd, {}, options.verbose);
430
- if (options.verbose) {
431
- config.output.verbose = true;
432
- }
433
- validateConfig(config);
434
- const exitCode = await generateNextjsArchitecture(config, cwd);
435
- if (typeof process !== "undefined") {
436
- process.exit(exitCode);
437
- }
438
- } catch (error) {
439
- console.error("Error:", error);
440
- if (typeof process !== "undefined") {
441
- process.exit(1);
155
+ program
156
+ .command('create-diaomao-app <project-name>')
157
+ .description('create a new diaomao app from template')
158
+ .action(async (projectName) => {
159
+ try {
160
+ await createDiaomaoApp(projectName);
442
161
  }
443
- }
444
- });
445
- program.command("create-diaomao-app <project-name>").description("create a new diaomao app from template").action(async (projectName) => {
446
- try {
447
- await createDiaomaoApp(projectName);
448
- } catch (error) {
449
- console.error("Error:", error);
450
- if (typeof process !== "undefined") {
451
- process.exit(1);
162
+ catch (error) {
163
+ console.error('Error:', error);
164
+ if (typeof process !== 'undefined') {
165
+ process.exit(1);
166
+ }
452
167
  }
453
- }
454
168
  });
455
- if (typeof process !== "undefined") {
456
- program.parse(process.argv);
169
+ // parse command line arguments
170
+ if (typeof process !== 'undefined') {
171
+ program.parse(process.argv);
457
172
  }
458
- //# sourceMappingURL=cli.mjs.map
459
- //# sourceMappingURL=cli.mjs.map
@@ -0,0 +1,3 @@
1
+ import { DevScriptsConfig } from '@dev-scripts/config/schema';
2
+ export declare function checkTranslations(config: DevScriptsConfig, cwd?: string): Promise<number>;
3
+ //# sourceMappingURL=check-translations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-translations.d.ts","sourceRoot":"","sources":["../../src/commands/check-translations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAc7D,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,GAAE,MAA6D,GAAG,OAAO,CAAC,MAAM,CAAC,CA2IrJ"}