@xylabs/ts-scripts-yarn3 7.0.0 → 7.0.2

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 (53) hide show
  1. package/dist/actions/deplint/checkPackage/checkPackage.mjs +11 -1
  2. package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
  3. package/dist/actions/deplint/checkPackage/index.mjs +11 -1
  4. package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
  5. package/dist/actions/deplint/deplint.mjs +33 -21
  6. package/dist/actions/deplint/deplint.mjs.map +1 -1
  7. package/dist/actions/deplint/index.mjs +33 -21
  8. package/dist/actions/deplint/index.mjs.map +1 -1
  9. package/dist/actions/index.mjs +132 -108
  10. package/dist/actions/index.mjs.map +1 -1
  11. package/dist/actions/package/compile/compile.mjs +25 -74
  12. package/dist/actions/package/compile/compile.mjs.map +1 -1
  13. package/dist/actions/package/compile/index.mjs +25 -74
  14. package/dist/actions/package/compile/index.mjs.map +1 -1
  15. package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
  16. package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
  17. package/dist/actions/package/gen-docs.mjs +1 -1
  18. package/dist/actions/package/gen-docs.mjs.map +1 -1
  19. package/dist/actions/package/index.mjs +96 -84
  20. package/dist/actions/package/index.mjs.map +1 -1
  21. package/dist/actions/package/publint.mjs +27 -10
  22. package/dist/actions/package/publint.mjs.map +1 -1
  23. package/dist/actions/package/recompile.mjs +25 -74
  24. package/dist/actions/package/recompile.mjs.map +1 -1
  25. package/dist/actions/publint.mjs +3 -3
  26. package/dist/actions/publint.mjs.map +1 -1
  27. package/dist/bin/package/build-only.mjs +27 -76
  28. package/dist/bin/package/build-only.mjs.map +1 -1
  29. package/dist/bin/package/build.mjs +27 -76
  30. package/dist/bin/package/build.mjs.map +1 -1
  31. package/dist/bin/package/compile-only.mjs +27 -76
  32. package/dist/bin/package/compile-only.mjs.map +1 -1
  33. package/dist/bin/package/compile-tsup.mjs.map +1 -1
  34. package/dist/bin/package/compile.mjs +27 -76
  35. package/dist/bin/package/compile.mjs.map +1 -1
  36. package/dist/bin/package/gen-docs.mjs +1 -1
  37. package/dist/bin/package/gen-docs.mjs.map +1 -1
  38. package/dist/bin/package/publint.mjs +27 -10
  39. package/dist/bin/package/publint.mjs.map +1 -1
  40. package/dist/bin/package/recompile.mjs +27 -76
  41. package/dist/bin/package/recompile.mjs.map +1 -1
  42. package/dist/bin/xy.mjs +38 -25
  43. package/dist/bin/xy.mjs.map +1 -1
  44. package/dist/index.d.ts +125 -96
  45. package/dist/index.mjs +134 -109
  46. package/dist/index.mjs.map +1 -1
  47. package/dist/xy/index.mjs +38 -25
  48. package/dist/xy/index.mjs.map +1 -1
  49. package/dist/xy/xy.mjs +38 -25
  50. package/dist/xy/xy.mjs.map +1 -1
  51. package/dist/xy/xyLintCommands.mjs +38 -25
  52. package/dist/xy/xyLintCommands.mjs.map +1 -1
  53. package/package.json +12 -14
@@ -1042,8 +1042,18 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
1042
1042
  __name(getUnusedPeerDependencies, "getUnusedPeerDependencies");
1043
1043
 
1044
1044
  // src/actions/deplint/checkPackage/checkPackage.ts
1045
- function checkPackage({ name, location, deps = false, devDeps = false, peerDeps = false }) {
1045
+ function checkPackage({ name, location, deps = false, devDeps = false, peerDeps = false, verbose = false }) {
1046
1046
  const { srcFiles, distFiles } = findFiles(location);
1047
+ if (verbose) {
1048
+ console.info(`Checking package: ${name} at ${location}`);
1049
+ console.info(`Source files: ${srcFiles.length}, Distribution files: ${distFiles.length}`);
1050
+ for (const file of srcFiles) {
1051
+ console.info(`Source file: ${file}`);
1052
+ }
1053
+ for (const file of distFiles) {
1054
+ console.info(`Distribution file: ${file}`);
1055
+ }
1056
+ }
1047
1057
  const checkDeps = deps || !(deps || devDeps || peerDeps);
1048
1058
  const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
1049
1059
  const checkPeerDeps = peerDeps;
@@ -1074,34 +1084,36 @@ function checkPackage({ name, location, deps = false, devDeps = false, peerDeps
1074
1084
  __name(checkPackage, "checkPackage");
1075
1085
 
1076
1086
  // src/actions/deplint/deplint.ts
1077
- var deplint = /* @__PURE__ */ __name(({ pkg, deps, devDeps, peerDeps }) => {
1078
- if (pkg) {
1079
- const { location, name } = yarnWorkspace(pkg);
1080
- console.log(`Running Deplint for ${name}`);
1081
- checkPackage({
1082
- name,
1083
- location,
1084
- devDeps,
1085
- deps,
1086
- peerDeps
1087
- });
1088
- } else {
1087
+ var deplint = /* @__PURE__ */ __name(({ pkg, deps, devDeps, peerDeps, verbose }) => {
1088
+ let totalErrors = 0;
1089
+ if (pkg === void 0) {
1089
1090
  const workspaces = yarnWorkspaces();
1090
- console.log("Deplint Started...");
1091
- let totalErrors = 0;
1091
+ console.info("Deplint Started...");
1092
1092
  for (const workspace of workspaces) {
1093
1093
  totalErrors += checkPackage({
1094
1094
  ...workspace,
1095
1095
  deps,
1096
1096
  devDeps,
1097
- peerDeps
1097
+ peerDeps,
1098
+ verbose
1098
1099
  });
1099
1100
  }
1100
- if (totalErrors > 0) {
1101
- console.log(`Deplint: Found ${chalk16.red(totalErrors)} dependency problems. ${chalk16.red("\u2716")}`);
1102
- } else {
1103
- console.log(`Deplint: Found no dependency problems. ${chalk16.green("\u2714")}`);
1104
- }
1101
+ } else {
1102
+ const { location, name } = yarnWorkspace(pkg);
1103
+ console.info(`Running Deplint for ${name}`);
1104
+ totalErrors += checkPackage({
1105
+ name,
1106
+ location,
1107
+ devDeps,
1108
+ deps,
1109
+ peerDeps,
1110
+ verbose
1111
+ });
1112
+ }
1113
+ if (totalErrors > 0) {
1114
+ console.warn(`Deplint: Found ${chalk16.red(totalErrors)} dependency problems. ${chalk16.red("\u2716")}`);
1115
+ } else {
1116
+ console.info(`Deplint: Found no dependency problems. ${chalk16.green("\u2714")}`);
1105
1117
  }
1106
1118
  return 0;
1107
1119
  }, "deplint");
@@ -1599,58 +1611,14 @@ var packageClean = /* @__PURE__ */ __name(async () => {
1599
1611
  }, "packageClean");
1600
1612
 
1601
1613
  // src/actions/package/compile/compile.ts
1602
- import chalk29 from "chalk";
1603
-
1604
- // src/actions/package/publint.ts
1605
- import { promises as fs4 } from "fs";
1606
- import chalk24 from "chalk";
1607
- import sortPackageJson from "sort-package-json";
1608
- var packagePublint = /* @__PURE__ */ __name(async (params) => {
1609
- const pkgDir = process.env.INIT_CWD;
1610
- const sortedPkg = sortPackageJson(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
1611
- await fs4.writeFile(`${pkgDir}/package.json`, sortedPkg);
1612
- const pkg = JSON.parse(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
1613
- console.log(chalk24.green(`Publint: ${pkg.name}`));
1614
- console.log(chalk24.gray(pkgDir));
1615
- const { publint: publint2 } = await import("publint");
1616
- const { messages } = await publint2({
1617
- level: "suggestion",
1618
- pkgDir,
1619
- strict: true
1620
- });
1621
- const { formatMessage } = await import("publint/utils");
1622
- const validMessage = /* @__PURE__ */ __name((_message) => {
1623
- return true;
1624
- }, "validMessage");
1625
- const validMessages = messages.filter(validMessage);
1626
- for (const message of validMessages) {
1627
- switch (message.type) {
1628
- case "error": {
1629
- console.error(chalk24.red(`[${message.code}] ${formatMessage(message, pkg)}`));
1630
- break;
1631
- }
1632
- case "warning": {
1633
- console.warn(chalk24.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
1634
- break;
1635
- }
1636
- default: {
1637
- console.log(chalk24.white(`[${message.code}] ${formatMessage(message, pkg)}`));
1638
- break;
1639
- }
1640
- }
1641
- }
1642
- if (params?.verbose) {
1643
- console.log(chalk24.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`));
1644
- }
1645
- return validMessages.filter((message) => message.type === "error").length;
1646
- }, "packagePublint");
1614
+ import chalk28 from "chalk";
1647
1615
 
1648
1616
  // src/actions/package/compile/packageCompileTsup.ts
1649
- import chalk28 from "chalk";
1617
+ import chalk27 from "chalk";
1650
1618
  import { build as build2, defineConfig } from "tsup";
1651
1619
 
1652
1620
  // src/actions/package/compile/inputs.ts
1653
- import chalk25 from "chalk";
1621
+ import chalk24 from "chalk";
1654
1622
  import { glob as glob2 } from "glob";
1655
1623
  var getAllInputs = /* @__PURE__ */ __name((srcDir, verbose = false) => {
1656
1624
  return [
@@ -1659,7 +1627,7 @@ var getAllInputs = /* @__PURE__ */ __name((srcDir, verbose = false) => {
1659
1627
  }).map((file) => {
1660
1628
  const result = file.slice(Math.max(0, srcDir.length + 1));
1661
1629
  if (verbose) {
1662
- console.log(chalk25.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
1630
+ console.log(chalk24.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
1663
1631
  }
1664
1632
  return result;
1665
1633
  }),
@@ -1668,7 +1636,7 @@ var getAllInputs = /* @__PURE__ */ __name((srcDir, verbose = false) => {
1668
1636
  }).map((file) => {
1669
1637
  const result = file.slice(Math.max(0, srcDir.length + 1));
1670
1638
  if (verbose) {
1671
- console.log(chalk25.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
1639
+ console.log(chalk24.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
1672
1640
  }
1673
1641
  return result;
1674
1642
  })
@@ -1735,7 +1703,7 @@ __name(deepMergeObjects, "deepMergeObjects");
1735
1703
 
1736
1704
  // src/actions/package/compile/packageCompileTsc.ts
1737
1705
  import { cwd as cwd2 } from "process";
1738
- import chalk26 from "chalk";
1706
+ import chalk25 from "chalk";
1739
1707
  import { createProgramFromConfig } from "tsc-prog";
1740
1708
  import ts2, { DiagnosticCategory, formatDiagnosticsWithColorAndContext, getPreEmitDiagnostics, sys } from "typescript";
1741
1709
 
@@ -1752,7 +1720,7 @@ var getCompilerOptions = /* @__PURE__ */ __name((options = {}, fileName = "tscon
1752
1720
  var packageCompileTsc = /* @__PURE__ */ __name((platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
1753
1721
  const pkg = process.env.INIT_CWD ?? cwd2();
1754
1722
  if (verbose) {
1755
- console.log(chalk26.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
1723
+ console.log(chalk25.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
1756
1724
  }
1757
1725
  const configFilePath = ts2.findConfigFile("./", ts2.sys.fileExists, "tsconfig.json");
1758
1726
  if (configFilePath === void 0) {
@@ -1770,10 +1738,10 @@ var packageCompileTsc = /* @__PURE__ */ __name((platform, entries, srcDir = "src
1770
1738
  emitDeclarationOnly: true,
1771
1739
  noEmit: false
1772
1740
  };
1773
- console.log(chalk26.cyan(`Validating Files: ${entries.length}`));
1741
+ console.log(chalk25.cyan(`Validating Files: ${entries.length}`));
1774
1742
  if (verbose) {
1775
1743
  for (const entry of entries) {
1776
- console.log(chalk26.grey(`Validating: ${entry}`));
1744
+ console.log(chalk25.grey(`Validating: ${entry}`));
1777
1745
  }
1778
1746
  }
1779
1747
  try {
@@ -1802,7 +1770,7 @@ var packageCompileTsc = /* @__PURE__ */ __name((platform, entries, srcDir = "src
1802
1770
  return 0;
1803
1771
  } finally {
1804
1772
  if (verbose) {
1805
- console.log(chalk26.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
1773
+ console.log(chalk25.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
1806
1774
  }
1807
1775
  }
1808
1776
  }, "packageCompileTsc");
@@ -1810,7 +1778,7 @@ var packageCompileTsc = /* @__PURE__ */ __name((platform, entries, srcDir = "src
1810
1778
  // src/actions/package/compile/packageCompileTscTypes.ts
1811
1779
  import path7 from "path";
1812
1780
  import { cwd as cwd3 } from "process";
1813
- import chalk27 from "chalk";
1781
+ import chalk26 from "chalk";
1814
1782
  import { rollup } from "rollup";
1815
1783
  import dts from "rollup-plugin-dts";
1816
1784
  import nodeExternals from "rollup-plugin-node-externals";
@@ -1843,8 +1811,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
1843
1811
  if (ignoredWarningCodes.has(warning.code ?? "")) {
1844
1812
  return;
1845
1813
  }
1846
- console.warn(chalk27.yellow(`[${warning.code}] ${warning.message}`));
1847
- console.warn(chalk27.gray(inputPath));
1814
+ console.warn(chalk26.yellow(`[${warning.code}] ${warning.message}`));
1815
+ console.warn(chalk26.gray(inputPath));
1848
1816
  warn(warning);
1849
1817
  }
1850
1818
  });
@@ -1854,8 +1822,8 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
1854
1822
  });
1855
1823
  } catch (ex) {
1856
1824
  const error = ex;
1857
- console.warn(chalk27.red(error));
1858
- console.warn(chalk27.gray(inputPath));
1825
+ console.warn(chalk26.red(error));
1826
+ console.warn(chalk26.gray(inputPath));
1859
1827
  }
1860
1828
  if (verbose) {
1861
1829
  console.log(`Bundled declarations written to ${outputPath}`);
@@ -1864,7 +1832,7 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
1864
1832
  __name(bundleDts, "bundleDts");
1865
1833
  var packageCompileTscTypes = /* @__PURE__ */ __name(async (entries, outDir, platform, srcDir = "build", verbose = false) => {
1866
1834
  if (verbose) {
1867
- console.log(chalk27.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
1835
+ console.log(chalk26.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
1868
1836
  console.log(`Entries: ${entries.join(", ")}`);
1869
1837
  }
1870
1838
  const pkg = process.env.INIT_CWD ?? cwd3();
@@ -1893,7 +1861,7 @@ var packageCompileTscTypes = /* @__PURE__ */ __name(async (entries, outDir, plat
1893
1861
  }, verbose);
1894
1862
  }));
1895
1863
  if (verbose) {
1896
- console.log(chalk27.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
1864
+ console.log(chalk26.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
1897
1865
  }
1898
1866
  return 0;
1899
1867
  }, "packageCompileTscTypes");
@@ -1905,15 +1873,15 @@ var compileFolder = /* @__PURE__ */ __name(async (srcDir, entries, buildDir, opt
1905
1873
  console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
1906
1874
  }
1907
1875
  if (entries.length === 0) {
1908
- console.warn(chalk28.yellow(`No entries found in ${srcDir} to compile`));
1876
+ console.warn(chalk27.yellow(`No entries found in ${srcDir} to compile`));
1909
1877
  return 0;
1910
1878
  }
1911
1879
  if (verbose) {
1912
- console.log(chalk28.gray(`buildDir [${buildDir}]`));
1880
+ console.log(chalk27.gray(`buildDir [${buildDir}]`));
1913
1881
  }
1914
1882
  const validationResult = packageCompileTsc(options?.platform ?? "neutral", entries, srcDir, buildDir, void 0, verbose);
1915
1883
  if (validationResult !== 0) {
1916
- console.error(chalk28.red(`Compile:Validation had ${validationResult} errors`));
1884
+ console.error(chalk27.red(`Compile:Validation had ${validationResult} errors`));
1917
1885
  return validationResult;
1918
1886
  }
1919
1887
  const optionsParams = tsupOptions([
@@ -1946,12 +1914,12 @@ var compileFolder = /* @__PURE__ */ __name(async (srcDir, entries, buildDir, opt
1946
1914
  ];
1947
1915
  }))).flat();
1948
1916
  if (verbose) {
1949
- console.log(chalk28.cyan(`TSUP:build:start [${srcDir}]`));
1950
- console.log(chalk28.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
1917
+ console.log(chalk27.cyan(`TSUP:build:start [${srcDir}]`));
1918
+ console.log(chalk27.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
1951
1919
  }
1952
1920
  await Promise.all(optionsList.map((options2) => build2(options2)));
1953
1921
  if (verbose) {
1954
- console.log(chalk28.cyan(`TSUP:build:stop [${srcDir}]`));
1922
+ console.log(chalk27.cyan(`TSUP:build:stop [${srcDir}]`));
1955
1923
  }
1956
1924
  if (bundleTypes) {
1957
1925
  await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
@@ -2059,19 +2027,14 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
2059
2027
  // src/actions/package/compile/compile.ts
2060
2028
  var packageCompile = /* @__PURE__ */ __name(async (inConfig = {}) => {
2061
2029
  const pkg = process.env.INIT_CWD;
2062
- console.log(chalk29.green(`Compiling ${pkg}`));
2030
+ console.log(chalk28.green(`Compiling ${pkg}`));
2063
2031
  const config2 = await loadConfig(inConfig);
2064
- const publint2 = config2.publint;
2065
- const tsupResults = await packageCompileTsup(config2);
2066
- if (tsupResults > 0) {
2067
- return tsupResults;
2068
- }
2069
- return publint2 ? await packagePublint(config2) : 0;
2032
+ return await packageCompileTsup(config2);
2070
2033
  }, "packageCompile");
2071
2034
 
2072
2035
  // src/actions/package/copy-assets.ts
2073
2036
  import path8 from "path/posix";
2074
- import chalk30 from "chalk";
2037
+ import chalk29 from "chalk";
2075
2038
  import cpy2 from "cpy";
2076
2039
  var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) => {
2077
2040
  try {
@@ -2090,7 +2053,7 @@ var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) =>
2090
2053
  flat: false
2091
2054
  });
2092
2055
  if (values.length > 0) {
2093
- console.log(chalk30.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
2056
+ console.log(chalk29.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
2094
2057
  }
2095
2058
  for (const value of values) {
2096
2059
  console.log(`${value.split("/").pop()} => ./dist/${target}`);
@@ -2163,7 +2126,7 @@ var packageCycle = /* @__PURE__ */ __name(async () => {
2163
2126
  // src/actions/package/gen-docs.ts
2164
2127
  import { existsSync as existsSync4 } from "fs";
2165
2128
  import path9 from "path";
2166
- import chalk31 from "chalk";
2129
+ import chalk30 from "chalk";
2167
2130
  import { Application, ArgumentsReader, TSConfigReader, TypeDocReader } from "typedoc";
2168
2131
  var ExitCodes = {
2169
2132
  CompileError: 3,
@@ -2176,7 +2139,7 @@ var ExitCodes = {
2176
2139
  };
2177
2140
  var packageGenDocs = /* @__PURE__ */ __name(async () => {
2178
2141
  const pkg = process.env.INIT_CWD;
2179
- if (pkg && !existsSync4(path9.join(pkg, "typedoc.json"))) {
2142
+ if (pkg !== void 0 && !existsSync4(path9.join(pkg, "typedoc.json"))) {
2180
2143
  return;
2181
2144
  }
2182
2145
  const app = await Application.bootstrap({
@@ -2265,7 +2228,7 @@ var runTypeDoc = /* @__PURE__ */ __name(async (app) => {
2265
2228
  return ExitCodes.OutputError;
2266
2229
  }
2267
2230
  }
2268
- console.log(chalk31.green(`${pkgName} - Ok`));
2231
+ console.log(chalk30.green(`${pkgName} - Ok`));
2269
2232
  return ExitCodes.Ok;
2270
2233
  }, "runTypeDoc");
2271
2234
 
@@ -2274,7 +2237,7 @@ import { readdirSync } from "fs";
2274
2237
  import path10 from "path";
2275
2238
  import { cwd as cwd4 } from "process";
2276
2239
  import { pathToFileURL } from "url";
2277
- import chalk32 from "chalk";
2240
+ import chalk31 from "chalk";
2278
2241
  import { ESLint } from "eslint";
2279
2242
  import { findUp } from "find-up";
2280
2243
  import picomatch from "picomatch";
@@ -2291,10 +2254,10 @@ var dumpMessages = /* @__PURE__ */ __name((lintResults) => {
2291
2254
  ];
2292
2255
  for (const lintResult of lintResults) {
2293
2256
  if (lintResult.messages.length > 0) {
2294
- console.log(chalk32.gray(`
2257
+ console.log(chalk31.gray(`
2295
2258
  ${lintResult.filePath}`));
2296
2259
  for (const message of lintResult.messages) {
2297
- console.log(chalk32.gray(` ${message.line}:${message.column}`), chalk32[colors[message.severity]](` ${severity[message.severity]}`), chalk32.white(` ${message.message}`), chalk32.gray(` ${message.ruleId}`));
2260
+ console.log(chalk31.gray(` ${message.line}:${message.column}`), chalk31[colors[message.severity]](` ${severity[message.severity]}`), chalk31.white(` ${message.message}`), chalk31.gray(` ${message.ruleId}`));
2298
2261
  }
2299
2262
  }
2300
2263
  }
@@ -2349,7 +2312,7 @@ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, c
2349
2312
  });
2350
2313
  const files = getFiles(cwd4(), ignoreFolders);
2351
2314
  if (verbose) {
2352
- console.log(chalk32.green(`Linting ${pkg} [files = ${files.length}]`));
2315
+ console.log(chalk31.green(`Linting ${pkg} [files = ${files.length}]`));
2353
2316
  }
2354
2317
  const lintResults = await engine.lintFiles(files);
2355
2318
  dumpMessages(lintResults);
@@ -2359,10 +2322,71 @@ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, c
2359
2322
  const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
2360
2323
  const lintTime = Date.now() - start;
2361
2324
  const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
2362
- console.log(chalk32.white(`Linted ${chalk32[filesCountColor](files.length)} files in ${chalk32[lintTimeColor](lintTime)}ms`));
2325
+ console.log(chalk31.white(`Linted ${chalk31[filesCountColor](files.length)} files in ${chalk31[lintTimeColor](lintTime)}ms`));
2363
2326
  return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
2364
2327
  }, "packageLint");
2365
2328
 
2329
+ // src/actions/package/publint.ts
2330
+ import { promises as fs4 } from "fs";
2331
+ import chalk32 from "chalk";
2332
+ import sortPackageJson from "sort-package-json";
2333
+ var customPubLint = /* @__PURE__ */ __name((pkg) => {
2334
+ let errorCount = 0;
2335
+ let warningCount = 0;
2336
+ if (pkg.files === void 0) {
2337
+ console.error(chalk32.yellow('Publint [custom]: "files" field is missing'));
2338
+ warningCount++;
2339
+ }
2340
+ if (pkg.main !== void 0) {
2341
+ console.error(chalk32.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
2342
+ warningCount++;
2343
+ }
2344
+ if (pkg.sideEffects !== false) {
2345
+ console.error(chalk32.yellow('Publint [custom]: "sideEffects" field should be set to false'));
2346
+ warningCount++;
2347
+ }
2348
+ return [
2349
+ errorCount,
2350
+ warningCount
2351
+ ];
2352
+ }, "customPubLint");
2353
+ var packagePublint = /* @__PURE__ */ __name(async ({ strict = true, verbose = false } = {}) => {
2354
+ const pkgDir = process.env.INIT_CWD;
2355
+ const sortedPkg = sortPackageJson(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
2356
+ await fs4.writeFile(`${pkgDir}/package.json`, sortedPkg);
2357
+ const pkg = JSON.parse(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
2358
+ console.log(chalk32.green(`Publint: ${pkg.name}`));
2359
+ console.log(chalk32.gray(pkgDir));
2360
+ const { publint: publint2 } = await import("publint");
2361
+ const { messages } = await publint2({
2362
+ level: "suggestion",
2363
+ pkgDir,
2364
+ strict
2365
+ });
2366
+ const { formatMessage } = await import("publint/utils");
2367
+ for (const message of messages) {
2368
+ switch (message.type) {
2369
+ case "error": {
2370
+ console.error(chalk32.red(`[${message.code}] ${formatMessage(message, pkg)}`));
2371
+ break;
2372
+ }
2373
+ case "warning": {
2374
+ console.warn(chalk32.yellow(`[${message.code}] ${formatMessage(message, pkg)}`));
2375
+ break;
2376
+ }
2377
+ default: {
2378
+ console.log(chalk32.white(`[${message.code}] ${formatMessage(message, pkg)}`));
2379
+ break;
2380
+ }
2381
+ }
2382
+ }
2383
+ const [errorCount, warningCount] = customPubLint(pkg);
2384
+ if (verbose) {
2385
+ console.log(chalk32.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
2386
+ }
2387
+ return messages.filter((message) => message.type === "error").length + errorCount;
2388
+ }, "packagePublint");
2389
+
2366
2390
  // src/actions/package/recompile.ts
2367
2391
  var packageRecompile = /* @__PURE__ */ __name(async () => {
2368
2392
  return await packageClean() || await packageCompile();
@@ -2370,10 +2394,10 @@ var packageRecompile = /* @__PURE__ */ __name(async () => {
2370
2394
 
2371
2395
  // src/actions/publint.ts
2372
2396
  var publint = /* @__PURE__ */ __name(async ({ verbose, pkg }) => {
2373
- return pkg ? await publintPackage({
2374
- pkg,
2397
+ return pkg === void 0 ? publintAll({
2375
2398
  verbose
2376
- }) : publintAll({
2399
+ }) : await publintPackage({
2400
+ pkg,
2377
2401
  verbose
2378
2402
  });
2379
2403
  }, "publint");