@hcmai/cli 0.21.12 → 0.21.13

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.js CHANGED
@@ -9804,6 +9804,7 @@ import {
9804
9804
  runMiniSmokeChecks,
9805
9805
  saveWorkspaceFileContent,
9806
9806
  validateMiniProject,
9807
+ validateMetaContent as validateMetaContent2,
9807
9808
  fromAxiosError as fromAxiosError22,
9808
9809
  CliError as CliError25,
9809
9810
  CliErrorCode as CliErrorCode26
@@ -10335,9 +10336,29 @@ async function workspaceValidateCommand(args) {
10335
10336
  const rootDir = resolveRootDir(args.dir);
10336
10337
  await requireWorkspaceContext(rootDir);
10337
10338
  const miniApps = await discoverMiniApps(rootDir);
10338
- const results = await Promise.all(
10339
- miniApps.map(async (app) => ({ app, result: await validateMiniProject(app.dir) }))
10340
- );
10339
+ const metaFiles = await readWorkspaceRawLocalFiles(path9.join(rootDir, "metas"));
10340
+ const metaResults = metaFiles.filter((file) => /\.ya?ml$/i.test(file.localPath)).map((file) => {
10341
+ const artifact = `meta:metas/${file.localPath}`;
10342
+ const validation = validateMetaContent2(`metas/${file.localPath}`, file.content);
10343
+ const message = (issue) => `${issue.path}: ${issue.message}${issue.hint ? `\uFF1B${issue.hint}` : ""}`;
10344
+ return {
10345
+ artifact,
10346
+ result: {
10347
+ valid: validation.errors.length === 0,
10348
+ errors: validation.errors.map(message),
10349
+ warnings: validation.issues.filter((issue) => issue.severity === "warn").map(message)
10350
+ }
10351
+ };
10352
+ });
10353
+ const results = [
10354
+ ...metaResults,
10355
+ ...await Promise.all(
10356
+ miniApps.map(async (app) => ({
10357
+ artifact: `mini:${app.appCode}`,
10358
+ result: await validateMiniProject(app.dir)
10359
+ }))
10360
+ )
10361
+ ];
10341
10362
  writeWorkspaceValidateResult(results, args.output ?? "table");
10342
10363
  process.exitCode = results.every((item) => item.result.valid) ? 0 : 1;
10343
10364
  return;
@@ -11305,14 +11326,14 @@ function writeWorkspaceValidateResult(results, format) {
11305
11326
  if (format !== "table") {
11306
11327
  process.stdout.write(
11307
11328
  formatObject22(
11308
- results.map((item) => ({ artifact: `mini:${item.app.appCode}`, ...item.result })),
11329
+ results.map((item) => ({ artifact: item.artifact, ...item.result })),
11309
11330
  { format }
11310
11331
  ) + "\n"
11311
11332
  );
11312
11333
  return;
11313
11334
  }
11314
11335
  const rows2 = results.map((item) => ({
11315
- artifact: `mini:${item.app.appCode}`,
11336
+ artifact: item.artifact,
11316
11337
  valid: item.result.valid ? "yes" : "no",
11317
11338
  errors: item.result.errors.length,
11318
11339
  warnings: item.result.warnings.length
@@ -11321,7 +11342,7 @@ function writeWorkspaceValidateResult(results, format) {
11321
11342
  for (const item of results) {
11322
11343
  if (!item.result.errors.length && !item.result.warnings.length) continue;
11323
11344
  process.stdout.write(`
11324
- mini:${item.app.appCode}
11345
+ ${item.artifact}
11325
11346
  `);
11326
11347
  for (const error of item.result.errors) process.stdout.write(` error: ${error}
11327
11348
  `);