@xylabs/ts-scripts-yarn3 7.0.1 → 7.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.mjs CHANGED
@@ -2424,6 +2424,31 @@ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, c
2424
2424
  import { promises as fs4 } from "fs";
2425
2425
  import chalk33 from "chalk";
2426
2426
  import sortPackageJson from "sort-package-json";
2427
+ var customPubLint = /* @__PURE__ */ __name((pkg) => {
2428
+ let errorCount = 0;
2429
+ let warningCount = 0;
2430
+ if (pkg.files === void 0) {
2431
+ console.warn(chalk33.yellow('Publint [custom]: "files" field is missing'));
2432
+ warningCount++;
2433
+ }
2434
+ if (pkg.main !== void 0) {
2435
+ console.warn(chalk33.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
2436
+ warningCount++;
2437
+ }
2438
+ if (pkg.sideEffects !== false) {
2439
+ console.warn(chalk33.yellow('Publint [custom]: "sideEffects" field should be set to false'));
2440
+ warningCount++;
2441
+ }
2442
+ if (pkg.resolutions !== void 0) {
2443
+ console.warn(chalk33.yellow('Publint [custom]: "resolutions" in use'));
2444
+ console.warn(chalk33.gray(JSON.stringify(pkg.resolutions, null, 2)));
2445
+ warningCount++;
2446
+ }
2447
+ return [
2448
+ errorCount,
2449
+ warningCount
2450
+ ];
2451
+ }, "customPubLint");
2427
2452
  var packagePublint = /* @__PURE__ */ __name(async ({ strict = true, verbose = false } = {}) => {
2428
2453
  const pkgDir = process.env.INIT_CWD;
2429
2454
  const sortedPkg = sortPackageJson(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
@@ -2438,11 +2463,7 @@ var packagePublint = /* @__PURE__ */ __name(async ({ strict = true, verbose = fa
2438
2463
  strict
2439
2464
  });
2440
2465
  const { formatMessage } = await import("publint/utils");
2441
- const validMessage = /* @__PURE__ */ __name((_message) => {
2442
- return true;
2443
- }, "validMessage");
2444
- const validMessages = messages.filter(validMessage);
2445
- for (const message of validMessages) {
2466
+ for (const message of messages) {
2446
2467
  switch (message.type) {
2447
2468
  case "error": {
2448
2469
  console.error(chalk33.red(`[${message.code}] ${formatMessage(message, pkg)}`));
@@ -2458,10 +2479,11 @@ var packagePublint = /* @__PURE__ */ __name(async ({ strict = true, verbose = fa
2458
2479
  }
2459
2480
  }
2460
2481
  }
2482
+ const [errorCount, warningCount] = customPubLint(pkg);
2461
2483
  if (verbose) {
2462
- console.log(chalk33.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
2484
+ console.log(chalk33.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
2463
2485
  }
2464
- return validMessages.filter((message) => message.type === "error").length;
2486
+ return messages.filter((message) => message.type === "error").length + errorCount;
2465
2487
  }, "packagePublint");
2466
2488
 
2467
2489
  // src/actions/package/recompile.ts