@xylabs/ts-scripts-yarn3 7.4.17 → 7.4.19

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 (199) hide show
  1. package/README.body.md +86 -0
  2. package/README.md +108 -0
  3. package/dist/actions/claude-commands.mjs +1 -1
  4. package/dist/actions/claude-commands.mjs.map +1 -1
  5. package/dist/actions/claude-rules.mjs +1 -1
  6. package/dist/actions/claude-rules.mjs.map +1 -1
  7. package/dist/actions/compile.mjs.map +1 -1
  8. package/dist/actions/cycle.mjs.map +1 -1
  9. package/dist/actions/dead.mjs.map +1 -1
  10. package/dist/actions/deplint/checkPackage/checkPackage.mjs +3 -0
  11. package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
  12. package/dist/actions/deplint/checkPackage/index.mjs +3 -0
  13. package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
  14. package/dist/actions/deplint/deplint.mjs +3 -0
  15. package/dist/actions/deplint/deplint.mjs.map +1 -1
  16. package/dist/actions/deplint/getExternalImportsFromFiles.mjs +3 -0
  17. package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
  18. package/dist/actions/deplint/getImportsFromFile.mjs +3 -0
  19. package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -1
  20. package/dist/actions/deplint/index.mjs +3 -0
  21. package/dist/actions/deplint/index.mjs.map +1 -1
  22. package/dist/actions/deploy-major.mjs.map +1 -1
  23. package/dist/actions/deploy-minor.mjs.map +1 -1
  24. package/dist/actions/deploy-next.mjs.map +1 -1
  25. package/dist/actions/deploy.mjs.map +1 -1
  26. package/dist/actions/fix.mjs.map +1 -1
  27. package/dist/actions/gen-docs.mjs.map +1 -1
  28. package/dist/actions/index.mjs +149 -41
  29. package/dist/actions/index.mjs.map +1 -1
  30. package/dist/actions/knip.mjs.map +1 -1
  31. package/dist/actions/lint.mjs.map +1 -1
  32. package/dist/actions/publint.mjs.map +1 -1
  33. package/dist/actions/publish.mjs.map +1 -1
  34. package/dist/actions/readme-gen.mjs +136 -20
  35. package/dist/actions/readme-gen.mjs.map +1 -1
  36. package/dist/actions/readme-init.mjs +83 -0
  37. package/dist/actions/readme-init.mjs.map +1 -0
  38. package/dist/actions/rebuild.mjs.map +1 -1
  39. package/dist/actions/reinstall.mjs.map +1 -1
  40. package/dist/actions/relint.mjs.map +1 -1
  41. package/dist/actions/retest.mjs +2 -2
  42. package/dist/actions/retest.mjs.map +1 -1
  43. package/dist/actions/sonar.mjs.map +1 -1
  44. package/dist/actions/test.mjs.map +1 -1
  45. package/dist/actions/up.mjs.map +1 -1
  46. package/dist/actions/updo.mjs.map +1 -1
  47. package/dist/actions/upplug.mjs.map +1 -1
  48. package/dist/actions/upyarn.mjs.map +1 -1
  49. package/dist/bin/xy.mjs +820 -576
  50. package/dist/bin/xy.mjs.map +1 -1
  51. package/dist/index.d.ts +42 -13
  52. package/dist/index.mjs +823 -573
  53. package/dist/index.mjs.map +1 -1
  54. package/dist/lib/claudeMdTemplate.mjs +1 -1
  55. package/dist/lib/claudeMdTemplate.mjs.map +1 -1
  56. package/dist/lib/generateReadmeFiles.mjs +118 -21
  57. package/dist/lib/generateReadmeFiles.mjs.map +1 -1
  58. package/dist/lib/index.mjs +120 -23
  59. package/dist/lib/index.mjs.map +1 -1
  60. package/dist/lib/runSteps.mjs.map +1 -1
  61. package/dist/lib/runXy.mjs.map +1 -1
  62. package/dist/xy/build/buildCommand.mjs +161 -0
  63. package/dist/xy/build/buildCommand.mjs.map +1 -0
  64. package/dist/xy/build/compileCommand.mjs +174 -0
  65. package/dist/xy/build/compileCommand.mjs.map +1 -0
  66. package/dist/xy/build/compileOnlyCommand.mjs +175 -0
  67. package/dist/xy/build/compileOnlyCommand.mjs.map +1 -0
  68. package/dist/xy/build/copyAssetsCommand.mjs +84 -0
  69. package/dist/xy/build/copyAssetsCommand.mjs.map +1 -0
  70. package/dist/xy/{xyBuildCommands.mjs → build/index.mjs} +111 -93
  71. package/dist/xy/build/index.mjs.map +1 -0
  72. package/dist/xy/build/rebuildCommand.mjs +114 -0
  73. package/dist/xy/build/rebuildCommand.mjs.map +1 -0
  74. package/dist/xy/build/recompileCommand.mjs +204 -0
  75. package/dist/xy/build/recompileCommand.mjs.map +1 -0
  76. package/dist/xy/common/claude/commandsCommand.mjs +107 -0
  77. package/dist/xy/common/claude/commandsCommand.mjs.map +1 -0
  78. package/dist/xy/common/claude/index.mjs +332 -0
  79. package/dist/xy/common/claude/index.mjs.map +1 -0
  80. package/dist/xy/common/claude/initCommand.mjs +283 -0
  81. package/dist/xy/common/claude/initCommand.mjs.map +1 -0
  82. package/dist/xy/common/claude/rulesCommand.mjs +129 -0
  83. package/dist/xy/common/claude/rulesCommand.mjs.map +1 -0
  84. package/dist/xy/common/claude/settingsCommand.mjs +90 -0
  85. package/dist/xy/common/claude/settingsCommand.mjs.map +1 -0
  86. package/dist/xy/common/cleanDocsCommand.mjs +45 -0
  87. package/dist/xy/common/cleanDocsCommand.mjs.map +1 -0
  88. package/dist/xy/common/deadCommand.mjs +116 -0
  89. package/dist/xy/common/deadCommand.mjs.map +1 -0
  90. package/dist/xy/common/genDocsCommand.mjs +125 -0
  91. package/dist/xy/common/genDocsCommand.mjs.map +1 -0
  92. package/dist/xy/common/gitignoreGenCommand.mjs +98 -0
  93. package/dist/xy/common/gitignoreGenCommand.mjs.map +1 -0
  94. package/dist/xy/common/gitlintCommand.mjs +82 -0
  95. package/dist/xy/common/gitlintCommand.mjs.map +1 -0
  96. package/dist/xy/{xyCommonCommands.mjs → common/index.mjs} +451 -241
  97. package/dist/xy/common/index.mjs.map +1 -0
  98. package/dist/xy/common/licenseCommand.mjs +100 -0
  99. package/dist/xy/common/licenseCommand.mjs.map +1 -0
  100. package/dist/xy/common/npmignoreGenCommand.mjs +98 -0
  101. package/dist/xy/common/npmignoreGenCommand.mjs.map +1 -0
  102. package/dist/xy/common/readme/genCommand.mjs +321 -0
  103. package/dist/xy/common/readme/genCommand.mjs.map +1 -0
  104. package/dist/xy/common/readme/index.mjs +361 -0
  105. package/dist/xy/common/readme/index.mjs.map +1 -0
  106. package/dist/xy/common/readme/initCommand.mjs +103 -0
  107. package/dist/xy/common/readme/initCommand.mjs.map +1 -0
  108. package/dist/xy/common/retestCommand.mjs +111 -0
  109. package/dist/xy/common/retestCommand.mjs.map +1 -0
  110. package/dist/xy/common/testCommand.mjs +108 -0
  111. package/dist/xy/common/testCommand.mjs.map +1 -0
  112. package/dist/xy/common/upplugCommand.mjs +113 -0
  113. package/dist/xy/common/upplugCommand.mjs.map +1 -0
  114. package/dist/xy/common/upyarnCommand.mjs +108 -0
  115. package/dist/xy/common/upyarnCommand.mjs.map +1 -0
  116. package/dist/xy/common/yarn3OnlyCommand.mjs +70 -0
  117. package/dist/xy/common/yarn3OnlyCommand.mjs.map +1 -0
  118. package/dist/xy/deploy/deployCommand.mjs +139 -0
  119. package/dist/xy/deploy/deployCommand.mjs.map +1 -0
  120. package/dist/xy/deploy/deployMajorCommand.mjs +139 -0
  121. package/dist/xy/deploy/deployMajorCommand.mjs.map +1 -0
  122. package/dist/xy/deploy/deployMinorCommand.mjs +139 -0
  123. package/dist/xy/deploy/deployMinorCommand.mjs.map +1 -0
  124. package/dist/xy/deploy/deployNextCommand.mjs +139 -0
  125. package/dist/xy/deploy/deployNextCommand.mjs.map +1 -0
  126. package/dist/xy/{xyDeployCommands.mjs → deploy/index.mjs} +53 -53
  127. package/dist/xy/deploy/index.mjs.map +1 -0
  128. package/dist/xy/deploy/publishCommand.mjs +108 -0
  129. package/dist/xy/deploy/publishCommand.mjs.map +1 -0
  130. package/dist/xy/index.mjs +820 -576
  131. package/dist/xy/index.mjs.map +1 -1
  132. package/dist/xy/install/cleanCommand.mjs +140 -0
  133. package/dist/xy/install/cleanCommand.mjs.map +1 -0
  134. package/dist/xy/install/dupdepsCommand.mjs +191 -0
  135. package/dist/xy/install/dupdepsCommand.mjs.map +1 -0
  136. package/dist/xy/{xyInstallCommands.mjs → install/index.mjs} +71 -68
  137. package/dist/xy/install/index.mjs.map +1 -0
  138. package/dist/xy/install/reinstallCommand.mjs +140 -0
  139. package/dist/xy/install/reinstallCommand.mjs.map +1 -0
  140. package/dist/xy/install/staticsCommand.mjs +191 -0
  141. package/dist/xy/install/staticsCommand.mjs.map +1 -0
  142. package/dist/{actions/clean-jest.mjs → xy/install/upCommand.mjs} +15 -6
  143. package/dist/xy/install/upCommand.mjs.map +1 -0
  144. package/dist/xy/install/updoCommand.mjs +112 -0
  145. package/dist/xy/install/updoCommand.mjs.map +1 -0
  146. package/dist/xy/lint/cycleCommand.mjs +163 -0
  147. package/dist/xy/lint/cycleCommand.mjs.map +1 -0
  148. package/dist/xy/lint/deplintCommand.mjs +814 -0
  149. package/dist/xy/lint/deplintCommand.mjs.map +1 -0
  150. package/dist/xy/lint/fixCommand.mjs +168 -0
  151. package/dist/xy/lint/fixCommand.mjs.map +1 -0
  152. package/dist/xy/{xyLintCommands.mjs → lint/index.mjs} +179 -145
  153. package/dist/xy/lint/index.mjs.map +1 -0
  154. package/dist/xy/lint/knipCommand.mjs +121 -0
  155. package/dist/xy/lint/knipCommand.mjs.map +1 -0
  156. package/dist/xy/lint/lintCommand.mjs +186 -0
  157. package/dist/xy/lint/lintCommand.mjs.map +1 -0
  158. package/dist/xy/lint/publintCommand.mjs +187 -0
  159. package/dist/xy/lint/publintCommand.mjs.map +1 -0
  160. package/dist/xy/lint/relintCommand.mjs +163 -0
  161. package/dist/xy/lint/relintCommand.mjs.map +1 -0
  162. package/dist/xy/lint/sonarCommand.mjs +121 -0
  163. package/dist/xy/lint/sonarCommand.mjs.map +1 -0
  164. package/dist/xy/xy.mjs +818 -574
  165. package/dist/xy/xy.mjs.map +1 -1
  166. package/package.json +2 -2
  167. package/templates/readme/README.body.md +11 -0
  168. package/templates/readme/README.template.md +22 -0
  169. package/dist/actions/clean-jest.mjs.map +0 -1
  170. package/dist/xy/xyBuildCommands.mjs.map +0 -1
  171. package/dist/xy/xyCommonCommands.mjs.map +0 -1
  172. package/dist/xy/xyDeployCommands.mjs.map +0 -1
  173. package/dist/xy/xyInstallCommands.mjs.map +0 -1
  174. package/dist/xy/xyLintCommands.mjs.map +0 -1
  175. /package/templates/{CLAUDE-project.md → claude/CLAUDE-project.md} +0 -0
  176. /package/templates/{commands → claude/commands}/xylabs-build.md +0 -0
  177. /package/templates/{commands → claude/commands}/xylabs-clean.md +0 -0
  178. /package/templates/{commands → claude/commands}/xylabs-compile.md +0 -0
  179. /package/templates/{commands → claude/commands}/xylabs-cycle.md +0 -0
  180. /package/templates/{commands → claude/commands}/xylabs-deplint.md +0 -0
  181. /package/templates/{commands → claude/commands}/xylabs-deploy-major.md +0 -0
  182. /package/templates/{commands → claude/commands}/xylabs-deploy-minor.md +0 -0
  183. /package/templates/{commands → claude/commands}/xylabs-deploy.md +0 -0
  184. /package/templates/{commands → claude/commands}/xylabs-fix.md +0 -0
  185. /package/templates/{commands → claude/commands}/xylabs-knip.md +0 -0
  186. /package/templates/{commands → claude/commands}/xylabs-lint.md +0 -0
  187. /package/templates/{commands → claude/commands}/xylabs-publint.md +0 -0
  188. /package/templates/{commands → claude/commands}/xylabs-rebuild.md +0 -0
  189. /package/templates/{commands → claude/commands}/xylabs-test.md +0 -0
  190. /package/templates/{rules → claude/rules}/xylabs-architecture.md +0 -0
  191. /package/templates/{rules → claude/rules}/xylabs-build.md +0 -0
  192. /package/templates/{rules → claude/rules}/xylabs-dependencies.md +0 -0
  193. /package/templates/{rules → claude/rules}/xylabs-error-handling.md +0 -0
  194. /package/templates/{rules → claude/rules}/xylabs-frameworks.md +0 -0
  195. /package/templates/{rules → claude/rules}/xylabs-git-workflow.md +0 -0
  196. /package/templates/{rules → claude/rules}/xylabs-linting.md +0 -0
  197. /package/templates/{rules → claude/rules}/xylabs-naming.md +0 -0
  198. /package/templates/{rules → claude/rules}/xylabs-style.md +0 -0
  199. /package/templates/{rules → claude/rules}/xylabs-typescript.md +0 -0
@@ -0,0 +1,121 @@
1
+ // src/xy/lint/knipCommand.ts
2
+ import chalk4 from "chalk";
3
+
4
+ // src/lib/checkResult.ts
5
+ import chalk from "chalk";
6
+ var checkResult = (name, result, level = "error", exitOnFail = false) => {
7
+ if (result) {
8
+ const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
9
+ const chalkFunc = level === "error" ? chalk.red : chalk.yellow;
10
+ console[level](chalkFunc(`${name} had ${result} failures ${exiting}`));
11
+ if (exitOnFail) {
12
+ process.exit(result);
13
+ }
14
+ }
15
+ };
16
+
17
+ // src/lib/processEx.ts
18
+ import chalk2 from "chalk";
19
+
20
+ // src/lib/withError.ts
21
+ var withError = (ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
22
+ return predicate(ex) ? closure(ex) : void 0;
23
+ };
24
+
25
+ // src/lib/withErrnoException.ts
26
+ var withErrnoException = (ex, closure) => {
27
+ return withError(ex, closure, (ex2) => ex2.errno !== void 0);
28
+ };
29
+
30
+ // src/lib/processEx.ts
31
+ var processEx = (ex) => {
32
+ const error = typeof ex === "string" ? new Error(ex) : ex;
33
+ const exitCode = withErrnoException(error, (error2) => {
34
+ if (error2.code === "ENOENT") {
35
+ console.error(chalk2.red(`'${error2.path}' not found.`));
36
+ } else {
37
+ console.error(chalk2.red(`Errno: ${error2.code}`));
38
+ }
39
+ return error2.errno ?? -1;
40
+ }) ?? withError(error, (error2) => {
41
+ console.error(chalk2.red(`${error2.name}: ${error2.message}`));
42
+ return -1;
43
+ }) ?? (() => {
44
+ console.error(chalk2.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`));
45
+ return -1;
46
+ })();
47
+ process.exit(process.exitCode ?? exitCode);
48
+ };
49
+
50
+ // src/lib/safeExit.ts
51
+ var safeExit = (func, exitOnFail = true) => {
52
+ try {
53
+ const result = func();
54
+ if (result && exitOnFail) {
55
+ process.exit(result);
56
+ }
57
+ return result;
58
+ } catch (ex) {
59
+ return processEx(ex);
60
+ }
61
+ };
62
+
63
+ // src/lib/runSteps.ts
64
+ import { spawnSync } from "child_process";
65
+ import { existsSync } from "fs";
66
+ import chalk3 from "chalk";
67
+ var runSteps = (name, steps, exitOnFail = true, messages) => {
68
+ return safeExit(() => {
69
+ const pkgName = process.env.npm_package_name;
70
+ console.log(chalk3.green(`${name} [${pkgName}]`));
71
+ let totalStatus = 0;
72
+ for (const [i, [command, args, config]] of steps.entries()) {
73
+ if (messages?.[i]) {
74
+ console.log(chalk3.gray(messages?.[i]));
75
+ }
76
+ const argList = Array.isArray(args) ? args : args.split(" ");
77
+ if (command === "node" && !existsSync(argList[0])) {
78
+ throw new Error(`File not found [${argList[0]}]`);
79
+ }
80
+ const status = spawnSync(command, Array.isArray(args) ? args : args.split(" "), {
81
+ ...config,
82
+ encoding: "utf8",
83
+ env: { FORCE_COLOR: "3", ...process.env },
84
+ shell: true,
85
+ stdio: "inherit"
86
+ }).status ?? 0;
87
+ checkResult(name, status, "error", exitOnFail);
88
+ totalStatus += status ?? 0;
89
+ }
90
+ return totalStatus;
91
+ }, !!exitOnFail);
92
+ };
93
+
94
+ // src/actions/knip.ts
95
+ var knip = () => {
96
+ return runSteps("Knip", [["yarn", ["knip", "--dependencies", "--no-exit-code"]]]);
97
+ };
98
+
99
+ // src/xy/param.ts
100
+ var packagePositionalParam = (yargs) => {
101
+ return yargs.positional("package", { describe: "Specific package to target", type: "string" });
102
+ };
103
+
104
+ // src/xy/lint/knipCommand.ts
105
+ var knipCommand = {
106
+ command: "knip",
107
+ describe: "Knip - Run Knip",
108
+ builder: (yargs) => {
109
+ return packagePositionalParam(yargs);
110
+ },
111
+ handler: (argv) => {
112
+ if (argv.verbose) console.log("Knip");
113
+ const start = Date.now();
114
+ process.exitCode = knip();
115
+ console.log(chalk4.blue(`Knip finished in ${Date.now() - start}ms`));
116
+ }
117
+ };
118
+ export {
119
+ knipCommand
120
+ };
121
+ //# sourceMappingURL=knipCommand.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/xy/lint/knipCommand.ts","../../../src/lib/checkResult.ts","../../../src/lib/processEx.ts","../../../src/lib/withError.ts","../../../src/lib/withErrnoException.ts","../../../src/lib/safeExit.ts","../../../src/lib/runSteps.ts","../../../src/actions/knip.ts","../../../src/xy/param.ts"],"sourcesContent":["import chalk from 'chalk'\nimport type { CommandModule } from 'yargs'\n\nimport { knip } from '../../actions/index.ts'\nimport { packagePositionalParam } from '../param.ts'\n\nexport const knipCommand: CommandModule = {\n command: 'knip',\n describe: 'Knip - Run Knip',\n builder: (yargs) => {\n return packagePositionalParam(yargs)\n },\n handler: (argv) => {\n if (argv.verbose) console.log('Knip')\n const start = Date.now()\n process.exitCode = knip()\n console.log(chalk.blue(`Knip finished in ${Date.now() - start}ms`))\n },\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep\n = | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'npm' | 'vitest', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n","import { runSteps } from '../lib/index.ts'\n\nexport const knip = () => {\n return runSteps('Knip', [['yarn', ['knip', '--dependencies', '--no-exit-code']]])\n}\n","import type { Argv } from 'yargs'\n\nexport const packagePositionalParam = (yargs: Argv<unknown>) => {\n return yargs.positional('package', { describe: 'Specific package to target', type: 'string' })\n}\n"],"mappings":";AAAA,OAAOA,YAAW;;;ACAlB,OAAO,WAAW;AAEX,IAAM,cAAc,CAAC,MAAc,QAAgB,QAA0B,SAAS,aAAa,UAAU;AAClH,MAAI,QAAQ;AACV,UAAM,UAAU,aAAa,sBAAsB;AACnD,UAAM,YAAY,UAAU,UAAU,MAAM,MAAM,MAAM;AACxD,YAAQ,KAAK,EAAE,UAAU,GAAG,IAAI,QAAQ,MAAM,aAAa,OAAO,EAAE,CAAC;AACrE,QAAI,YAAY;AACd,cAAQ,KAAK,MAAM;AAAA,IACrB;AAAA,EACF;AACF;;;ACXA,OAAOC,YAAW;;;ACAX,IAAM,YAAY,CAEvB,IACA,SACA,YAAY,CAACC,QAAW,CAAC,CAACA,IAAG,QAAQ,CAAC,CAACA,IAAG,YACvC;AACH,SAAO,UAAU,EAAO,IAAI,QAAQ,EAAO,IAAI;AACjD;;;ACLO,IAAM,qBAAqB,CAChC,IAAa,YACV;AACH,SAAO,UAAa,IAAI,SAAS,CAACC,QAAiBA,IAA6B,UAAU,MAAS;AACrG;;;AFDO,IAAM,YAAY,CAAC,OAAgB;AACxC,QAAM,QAAQ,OAAO,OAAO,WAAW,IAAI,MAAM,EAAE,IAAI;AACvD,QAAM,WACF,mBAAmB,OAAO,CAACC,WAAU;AACrC,QAAIA,OAAM,SAAS,UAAU;AAC3B,cAAQ,MAAMC,OAAM,IAAI,IAAID,OAAM,IAAI,cAAc,CAAC;AAAA,IACvD,OAAO;AACL,cAAQ,MAAMC,O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mBAAmB,QAAQ,CAAC,CAAC,GAAG;AAAA,MAClD;AACA,YAAM,SACF,UAAU,SAAS,MAAM,QAAQ,IAAI,IAAI,OAAO,KAAK,MAAM,GAAG,GAAG;AAAA,QACjE,GAAG;AAAA,QACH,UAAU;AAAA,QACV,KAAK,EAAE,aAAa,KAAK,GAAG,QAAQ,IAAI;AAAA,QACxC,OAAO;AAAA,QACP,OAAO;AAAA,MACT,CAAC,EAAE,UAAU;AACf,kBAAY,MAAM,QAAQ,SAAS,UAAU;AAC7C,qBAAe,UAAU;AAAA,IAC3B;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAC,UAAU;AACjB;;;ACrCO,IAAM,OAAO,MAAM;AACxB,SAAO,SAAS,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,kBAAkB,gBAAgB,CAAC,CAAC,CAAC;AAClF;;;ACFO,IAAM,yBAAyB,CAAC,UAAyB;AAC9D,SAAO,MAAM,WAAW,WAAW,EAAE,UAAU,8BAA8B,MAAM,SAAS,CAAC;AAC/F;;;AREO,IAAM,cAA6B;AAAA,EACxC,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS,CAAC,UAAU;AAClB,WAAO,uBAAuB,KAAK;AAAA,EACrC;AAAA,EACA,SAAS,CAAC,SAAS;AACjB,QAAI,KAAK,QAAS,SAAQ,IAAI,MAAM;AACpC,UAAM,QAAQ,KAAK,IAAI;AACvB,YAAQ,WAAW,KAAK;AACxB,YAAQ,IAAIC,OAAM,KAAK,oBAAoB,KAAK,IAAI,IAAI,KAAK,IAAI,CAAC;AAAA,EACpE;AACF;","names":["chalk","chalk","ex","ex","error","chalk","chalk","chalk","chalk"]}
@@ -0,0 +1,186 @@
1
+ // src/xy/lint/lintCommand.ts
2
+ import chalk5 from "chalk";
3
+
4
+ // src/lib/checkResult.ts
5
+ import chalk from "chalk";
6
+ var checkResult = (name, result, level = "error", exitOnFail = false) => {
7
+ if (result) {
8
+ const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
9
+ const chalkFunc = level === "error" ? chalk.red : chalk.yellow;
10
+ console[level](chalkFunc(`${name} had ${result} failures ${exiting}`));
11
+ if (exitOnFail) {
12
+ process.exit(result);
13
+ }
14
+ }
15
+ };
16
+
17
+ // src/lib/processEx.ts
18
+ import chalk2 from "chalk";
19
+
20
+ // src/lib/withError.ts
21
+ var withError = (ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
22
+ return predicate(ex) ? closure(ex) : void 0;
23
+ };
24
+
25
+ // src/lib/withErrnoException.ts
26
+ var withErrnoException = (ex, closure) => {
27
+ return withError(ex, closure, (ex2) => ex2.errno !== void 0);
28
+ };
29
+
30
+ // src/lib/processEx.ts
31
+ var processEx = (ex) => {
32
+ const error = typeof ex === "string" ? new Error(ex) : ex;
33
+ const exitCode = withErrnoException(error, (error2) => {
34
+ if (error2.code === "ENOENT") {
35
+ console.error(chalk2.red(`'${error2.path}' not found.`));
36
+ } else {
37
+ console.error(chalk2.red(`Errno: ${error2.code}`));
38
+ }
39
+ return error2.errno ?? -1;
40
+ }) ?? withError(error, (error2) => {
41
+ console.error(chalk2.red(`${error2.name}: ${error2.message}`));
42
+ return -1;
43
+ }) ?? (() => {
44
+ console.error(chalk2.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`));
45
+ return -1;
46
+ })();
47
+ process.exit(process.exitCode ?? exitCode);
48
+ };
49
+
50
+ // src/lib/safeExit.ts
51
+ var safeExit = (func, exitOnFail = true) => {
52
+ try {
53
+ const result = func();
54
+ if (result && exitOnFail) {
55
+ process.exit(result);
56
+ }
57
+ return result;
58
+ } catch (ex) {
59
+ return processEx(ex);
60
+ }
61
+ };
62
+
63
+ // src/lib/runSteps.ts
64
+ import { spawnSync } from "child_process";
65
+ import { existsSync } from "fs";
66
+ import chalk3 from "chalk";
67
+ var runSteps = (name, steps, exitOnFail = true, messages) => {
68
+ return safeExit(() => {
69
+ const pkgName = process.env.npm_package_name;
70
+ console.log(chalk3.green(`${name} [${pkgName}]`));
71
+ let totalStatus = 0;
72
+ for (const [i, [command, args, config]] of steps.entries()) {
73
+ if (messages?.[i]) {
74
+ console.log(chalk3.gray(messages?.[i]));
75
+ }
76
+ const argList = Array.isArray(args) ? args : args.split(" ");
77
+ if (command === "node" && !existsSync(argList[0])) {
78
+ throw new Error(`File not found [${argList[0]}]`);
79
+ }
80
+ const status = spawnSync(command, Array.isArray(args) ? args : args.split(" "), {
81
+ ...config,
82
+ encoding: "utf8",
83
+ env: { FORCE_COLOR: "3", ...process.env },
84
+ shell: true,
85
+ stdio: "inherit"
86
+ }).status ?? 0;
87
+ checkResult(name, status, "error", exitOnFail);
88
+ totalStatus += status ?? 0;
89
+ }
90
+ return totalStatus;
91
+ }, !!exitOnFail);
92
+ };
93
+
94
+ // src/actions/lint.ts
95
+ import chalk4 from "chalk";
96
+ var lintPackage = ({
97
+ pkg,
98
+ fix: fix2,
99
+ verbose
100
+ }) => {
101
+ console.log(chalk4.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
102
+ const start = Date.now();
103
+ const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
104
+ ["yarn", [
105
+ "workspace",
106
+ pkg,
107
+ "run",
108
+ fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
109
+ ]]
110
+ ]);
111
+ console.log(chalk4.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk4.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk4.gray("seconds")}`));
112
+ return result;
113
+ };
114
+ var lint = ({
115
+ pkg,
116
+ verbose,
117
+ incremental,
118
+ fix: fix2
119
+ } = {}) => {
120
+ return pkg === void 0 ? lintAllPackages({
121
+ verbose,
122
+ incremental,
123
+ fix: fix2
124
+ }) : lintPackage({
125
+ pkg,
126
+ fix: fix2,
127
+ verbose
128
+ });
129
+ };
130
+ var lintAllPackages = ({ fix: fix2 = false } = {}) => {
131
+ console.log(chalk4.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
132
+ const start = Date.now();
133
+ const fixOptions = fix2 ? ["--fix"] : [];
134
+ const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
135
+ ["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
136
+ ]);
137
+ console.log(chalk4.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk4.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk4.gray("seconds")}`));
138
+ return result;
139
+ };
140
+
141
+ // src/actions/fix.ts
142
+ var fix = (params) => {
143
+ return lint({ ...params, fix: true });
144
+ };
145
+
146
+ // src/xy/param.ts
147
+ var packagePositionalParam = (yargs) => {
148
+ return yargs.positional("package", { describe: "Specific package to target", type: "string" });
149
+ };
150
+
151
+ // src/xy/lint/lintCommand.ts
152
+ var lintCommand = {
153
+ command: "lint [package]",
154
+ describe: "Lint - Run Eslint",
155
+ builder: (yargs) => {
156
+ return packagePositionalParam(yargs).option("fix", {
157
+ alias: "f",
158
+ default: false,
159
+ description: "Fix fixable issues",
160
+ type: "boolean"
161
+ }).option("cache", {
162
+ alias: "c",
163
+ default: false,
164
+ description: "Use caching for performance",
165
+ type: "boolean"
166
+ });
167
+ },
168
+ handler: (argv) => {
169
+ if (argv.verbose) console.log("Lint");
170
+ const start = Date.now();
171
+ process.exitCode = argv.fix ? fix({
172
+ pkg: argv.package,
173
+ cache: argv.cache,
174
+ verbose: !!argv.verbose
175
+ }) : lint({
176
+ pkg: argv.package,
177
+ cache: argv.cache,
178
+ verbose: !!argv.verbose
179
+ });
180
+ console.log(chalk5.blue(`Finished in ${Date.now() - start}ms`));
181
+ }
182
+ };
183
+ export {
184
+ lintCommand
185
+ };
186
+ //# sourceMappingURL=lintCommand.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/xy/lint/lintCommand.ts","../../../src/lib/checkResult.ts","../../../src/lib/processEx.ts","../../../src/lib/withError.ts","../../../src/lib/withErrnoException.ts","../../../src/lib/safeExit.ts","../../../src/lib/runSteps.ts","../../../src/actions/lint.ts","../../../src/actions/fix.ts","../../../src/xy/param.ts"],"sourcesContent":["import chalk from 'chalk'\nimport type { CommandModule } from 'yargs'\n\nimport { fix, lint } from '../../actions/index.ts'\nimport { packagePositionalParam } from '../param.ts'\n\nexport const lintCommand: CommandModule = {\n command: 'lint [package]',\n describe: 'Lint - Run Eslint',\n builder: (yargs) => {\n return packagePositionalParam(yargs)\n .option('fix', {\n alias: 'f',\n default: false,\n description: 'Fix fixable issues',\n type: 'boolean',\n })\n .option('cache', {\n alias: 'c',\n default: false,\n description: 'Use caching for performance',\n type: 'boolean',\n })\n },\n handler: (argv) => {\n if (argv.verbose) console.log('Lint')\n const start = Date.now()\n process.exitCode\n = argv.fix\n ? fix({\n pkg: argv.package as string, cache: argv.cache as boolean, verbose: !!argv.verbose,\n })\n : lint({\n pkg: argv.package as string, cache: argv.cache as boolean, verbose: !!argv.verbose,\n })\n console.log(chalk.blue(`Finished in ${Date.now() - start}ms`))\n },\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep\n = | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'npm' | 'vitest', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n","import chalk from 'chalk'\n\nimport { runSteps } from '../lib/index.ts'\n\nexport interface LintParams {\n cache?: boolean\n fix?: boolean\n incremental?: boolean\n pkg?: string\n verbose?: boolean\n}\n\nexport interface LintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nexport const lintPackage = ({\n pkg, fix, verbose,\n}: LintParams & Required<Pick<LintParams, 'pkg'>>) => {\n console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [${pkg}]`))\n const start = Date.now()\n\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [${pkg}]`, [\n ['yarn', ['workspace',\n pkg,\n 'run',\n fix ? 'package-fix' : verbose ? 'package-lint-verbose' : 'package-lint',\n ]],\n ])\n console.log(chalk.gray(`${fix ? 'Fixed in' : 'Linted in'} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`))\n return result\n}\n\nexport const lint = ({\n pkg, verbose, incremental, fix,\n}: LintParams = {}) => {\n return pkg === undefined\n ? lintAllPackages({\n verbose, incremental, fix,\n })\n : lintPackage({\n pkg, fix, verbose,\n })\n}\n\nexport const lintAllPackages = ({ fix = false }: LintParams = {}) => {\n console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [All-Packages]`))\n const start = Date.now()\n // const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n // const incrementalOptions = incremental ? ['--since', '-Ap'] : ['--parallel', '-Ap']\n const fixOptions = fix ? ['--fix'] : []\n\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [All-Packages]`, [\n ['yarn', ['eslint', '--cache', '--cache-location', '.eslintcache', '--cache-strategy', 'content', ...fixOptions]],\n ])\n console.log(chalk.gray(`${fix ? 'Fixed in' : 'Linted in'} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`))\n return result\n}\n","import type { LintParams } from './lint.ts'\nimport { lint } from './lint.ts'\n\nexport const fix = (params?: LintParams) => {\n return lint({ ...params, fix: true })\n}\n","import type { Argv } from 'yargs'\n\nexport const packagePositionalParam = (yargs: Argv<unknown>) => {\n return yargs.positional('package', { describe: 'Specific package to target', type: 'string' })\n}\n"],"mappings":";AAAA,OAAOA,YAAW;;;ACAlB,OAAO,WAAW;AAEX,IAAM,cAAc,CAAC,MAAc,QAAgB,QAA0B,SAAS,aAAa,UAAU;AAClH,MAAI,QAAQ;AACV,UAAM,UAAU,aAAa,sBAAsB;AACnD,UAAM,YAAY,UAAU,UAAU,MAAM,MAAM,MAAM;AACxD,YAAQ,KAAK,EAAE,UAAU,GAAG,IAAI,QAAQ,MAAM,aAAa,OAAO,EAAE,CAAC;AACrE,QAAI,YAAY;AACd,cAAQ,KAAK,MAAM;AAAA,IACrB;AAAA,EACF;AACF;;;ACXA,OAAOC,YAAW;;;ACAX,IAAM,YAAY,CAEvB,IACA,SACA,YAAY,CAACC,QAAW,CAAC,CAACA,IAAG,QAAQ,CAAC,CAACA,IAAG,YACvC;AACH,SAAO,UAAU,EAAO,IAAI,QAAQ,EAAO,IAAI;AACjD;;;ACLO,IAAM,qBAAqB,CAChC,IAAa,YACV;AACH,SAAO,UAAa,IAAI,SAAS,CAACC,QAAiBA,IAA6B,UAAU,MAAS;AACrG;;;AFDO,IAAM,YAAY,CAAC,OAAgB;AACxC,QAAM,QAAQ,OAAO,OAAO,WAAW,IAAI,MAAM,EAAE,IAAI;AACvD,QAAM,WACF,mBAAmB,OAAO,CAACC,WAAU;AACrC,QAAIA,OAAM,SAAS,U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,SAAS;AAAA,MACT,aAAa;AAAA,MACb,MAAM;AAAA,IACR,CAAC;AAAA,EACL;AAAA,EACA,SAAS,CAAC,SAAS;AACjB,QAAI,KAAK,QAAS,SAAQ,IAAI,MAAM;AACpC,UAAM,QAAQ,KAAK,IAAI;AACvB,YAAQ,WACJ,KAAK,MACH,IAAI;AAAA,MACF,KAAK,KAAK;AAAA,MAAmB,OAAO,KAAK;AAAA,MAAkB,SAAS,CAAC,CAAC,KAAK;AAAA,IAC7E,CAAC,IACD,KAAK;AAAA,MACH,KAAK,KAAK;AAAA,MAAmB,OAAO,KAAK;AAAA,MAAkB,SAAS,CAAC,CAAC,KAAK;AAAA,IAC7E,CAAC;AACP,YAAQ,IAAIC,OAAM,KAAK,eAAe,KAAK,IAAI,IAAI,KAAK,IAAI,CAAC;AAAA,EAC/D;AACF;","names":["chalk","chalk","ex","ex","error","chalk","chalk","chalk","chalk","fix","chalk","chalk"]}
@@ -0,0 +1,187 @@
1
+ // src/xy/lint/publintCommand.ts
2
+ import chalk5 from "chalk";
3
+
4
+ // src/lib/checkResult.ts
5
+ import chalk from "chalk";
6
+ var checkResult = (name, result, level = "error", exitOnFail = false) => {
7
+ if (result) {
8
+ const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
9
+ const chalkFunc = level === "error" ? chalk.red : chalk.yellow;
10
+ console[level](chalkFunc(`${name} had ${result} failures ${exiting}`));
11
+ if (exitOnFail) {
12
+ process.exit(result);
13
+ }
14
+ }
15
+ };
16
+
17
+ // src/lib/processEx.ts
18
+ import chalk2 from "chalk";
19
+
20
+ // src/lib/withError.ts
21
+ var withError = (ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
22
+ return predicate(ex) ? closure(ex) : void 0;
23
+ };
24
+
25
+ // src/lib/withErrnoException.ts
26
+ var withErrnoException = (ex, closure) => {
27
+ return withError(ex, closure, (ex2) => ex2.errno !== void 0);
28
+ };
29
+
30
+ // src/lib/processEx.ts
31
+ var processEx = (ex) => {
32
+ const error = typeof ex === "string" ? new Error(ex) : ex;
33
+ const exitCode = withErrnoException(error, (error2) => {
34
+ if (error2.code === "ENOENT") {
35
+ console.error(chalk2.red(`'${error2.path}' not found.`));
36
+ } else {
37
+ console.error(chalk2.red(`Errno: ${error2.code}`));
38
+ }
39
+ return error2.errno ?? -1;
40
+ }) ?? withError(error, (error2) => {
41
+ console.error(chalk2.red(`${error2.name}: ${error2.message}`));
42
+ return -1;
43
+ }) ?? (() => {
44
+ console.error(chalk2.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`));
45
+ return -1;
46
+ })();
47
+ process.exit(process.exitCode ?? exitCode);
48
+ };
49
+
50
+ // src/lib/safeExit.ts
51
+ var safeExit = (func, exitOnFail = true) => {
52
+ try {
53
+ const result = func();
54
+ if (result && exitOnFail) {
55
+ process.exit(result);
56
+ }
57
+ return result;
58
+ } catch (ex) {
59
+ return processEx(ex);
60
+ }
61
+ };
62
+ var safeExitAsync = async (func, exitOnFail = true) => {
63
+ try {
64
+ const result = await func();
65
+ if (result && exitOnFail) {
66
+ process.exit(result);
67
+ }
68
+ return result;
69
+ } catch (ex) {
70
+ return processEx(ex);
71
+ }
72
+ };
73
+
74
+ // src/lib/runSteps.ts
75
+ import { spawnSync } from "child_process";
76
+ import { existsSync } from "fs";
77
+ import chalk3 from "chalk";
78
+ var runSteps = (name, steps, exitOnFail = true, messages) => {
79
+ return safeExit(() => {
80
+ const pkgName = process.env.npm_package_name;
81
+ console.log(chalk3.green(`${name} [${pkgName}]`));
82
+ let totalStatus = 0;
83
+ for (const [i, [command, args, config]] of steps.entries()) {
84
+ if (messages?.[i]) {
85
+ console.log(chalk3.gray(messages?.[i]));
86
+ }
87
+ const argList = Array.isArray(args) ? args : args.split(" ");
88
+ if (command === "node" && !existsSync(argList[0])) {
89
+ throw new Error(`File not found [${argList[0]}]`);
90
+ }
91
+ const status = spawnSync(command, Array.isArray(args) ? args : args.split(" "), {
92
+ ...config,
93
+ encoding: "utf8",
94
+ env: { FORCE_COLOR: "3", ...process.env },
95
+ shell: true,
96
+ stdio: "inherit"
97
+ }).status ?? 0;
98
+ checkResult(name, status, "error", exitOnFail);
99
+ totalStatus += status ?? 0;
100
+ }
101
+ return totalStatus;
102
+ }, !!exitOnFail);
103
+ };
104
+
105
+ // src/lib/runStepsAsync.ts
106
+ import { spawn } from "child_process";
107
+ import { existsSync as existsSync2 } from "fs";
108
+ import chalk4 from "chalk";
109
+ var runStepAsync = (name, step, exitOnFail = true, message) => {
110
+ return new Promise((resolve) => {
111
+ const [command, args, config] = step;
112
+ if (message) {
113
+ console.log(chalk4.gray(message));
114
+ }
115
+ const argList = Array.isArray(args) ? args : args.split(" ");
116
+ if (command === "node" && !existsSync2(argList[0])) {
117
+ throw new Error(`File not found [${argList[0]}]`);
118
+ }
119
+ spawn(command, Array.isArray(args) ? args : args.split(" "), {
120
+ ...config,
121
+ env: { FORCE_COLOR: "3", ...process.env },
122
+ shell: true,
123
+ stdio: "inherit"
124
+ }).on("close", (code) => {
125
+ if (code) {
126
+ console.error(
127
+ chalk4.red(
128
+ `Command Exited With Non-Zero Result [${chalk4.gray(code)}] | ${chalk4.yellow(command)} ${chalk4.white(
129
+ Array.isArray(args) ? args.join(" ") : args
130
+ )}`
131
+ )
132
+ );
133
+ checkResult(name, code, "error", exitOnFail);
134
+ resolve(code);
135
+ } else {
136
+ resolve(0);
137
+ }
138
+ });
139
+ });
140
+ };
141
+ var runStepsAsync = async (name, steps, exitOnFail = true, messages) => {
142
+ return await safeExitAsync(async () => {
143
+ const pkgName = process.env.npm_package_name;
144
+ console.log(chalk4.green(`${name} [${pkgName}]`));
145
+ let result = 0;
146
+ for (const [i, step] of steps.entries()) {
147
+ result += await runStepAsync(name, step, exitOnFail, messages?.[i]);
148
+ }
149
+ return result;
150
+ });
151
+ };
152
+
153
+ // src/actions/publint.ts
154
+ var publint = async ({ verbose, pkg }) => {
155
+ return pkg === void 0 ? publintAll({ verbose }) : await publintPackage({ pkg, verbose });
156
+ };
157
+ var publintPackage = ({ pkg }) => {
158
+ return runStepsAsync(`Publint [${pkg}]`, [["yarn", ["workspace", pkg, "run", "package-publint"]]]);
159
+ };
160
+ var publintAll = ({ verbose }) => {
161
+ const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
162
+ return runSteps("Publint", [["yarn", ["workspaces", "foreach", "-pA", ...verboseOptions, "run", "package-publint"]]]);
163
+ };
164
+
165
+ // src/xy/param.ts
166
+ var packagePositionalParam = (yargs) => {
167
+ return yargs.positional("package", { describe: "Specific package to target", type: "string" });
168
+ };
169
+
170
+ // src/xy/lint/publintCommand.ts
171
+ var publintCommand = {
172
+ command: "publint [package]",
173
+ describe: "Publint - Run Publint",
174
+ builder: (yargs) => {
175
+ return packagePositionalParam(yargs);
176
+ },
177
+ handler: async (argv) => {
178
+ if (argv.verbose) console.log("Publint");
179
+ const start = Date.now();
180
+ process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
181
+ console.log(chalk5.blue(`Finished in ${Date.now() - start}ms`));
182
+ }
183
+ };
184
+ export {
185
+ publintCommand
186
+ };
187
+ //# sourceMappingURL=publintCommand.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/xy/lint/publintCommand.ts","../../../src/lib/checkResult.ts","../../../src/lib/processEx.ts","../../../src/lib/withError.ts","../../../src/lib/withErrnoException.ts","../../../src/lib/safeExit.ts","../../../src/lib/runSteps.ts","../../../src/lib/runStepsAsync.ts","../../../src/actions/publint.ts","../../../src/xy/param.ts"],"sourcesContent":["import chalk from 'chalk'\nimport type { CommandModule } from 'yargs'\n\nimport { publint } from '../../actions/index.ts'\nimport { packagePositionalParam } from '../param.ts'\n\nexport const publintCommand: CommandModule = {\n command: 'publint [package]',\n describe: 'Publint - Run Publint',\n builder: (yargs) => {\n return packagePositionalParam(yargs)\n },\n handler: async (argv) => {\n if (argv.verbose) console.log('Publint')\n const start = Date.now()\n process.exitCode = await publint({ pkg: argv.package as string, verbose: !!argv.verbose })\n console.log(chalk.blue(`Finished in ${Date.now() - start}ms`))\n },\n}\n","import chalk from 'chalk'\n\nexport const checkResult = (name: string, result: number, level: 'error' | 'warn' = 'error', exitOnFail = false) => {\n if (result) {\n const exiting = exitOnFail ? '[Exiting Process]' : '[Continuing]'\n const chalkFunc = level === 'error' ? chalk.red : chalk.yellow\n console[level](chalkFunc(`${name} had ${result} failures ${exiting}`))\n if (exitOnFail) {\n process.exit(result)\n }\n }\n}\n","import chalk from 'chalk'\n\nimport { withErrnoException } from './withErrnoException.ts'\nimport { withError } from './withError.ts'\n\nexport const processEx = (ex: unknown) => {\n const error = typeof ex === 'string' ? new Error(ex) : ex\n const exitCode\n = withErrnoException(error, (error) => {\n if (error.code === 'ENOENT') {\n console.error(chalk.red(`'${error.path}' not found.`))\n } else {\n console.error(chalk.red(`Errno: ${error.code}`))\n }\n return error.errno ?? -1\n })\n ?? withError(error, (error) => {\n console.error(chalk.red(`${error.name}: ${error.message}`))\n return -1\n })\n ?? (() => {\n console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))\n return -1\n })()\n // This allows us to use a previously set exit code\n process.exit(process.exitCode ?? exitCode)\n}\n","export const withError = <T extends Error = Error>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ex: any,\n closure: (error: T) => number,\n predicate = (ex: T) => (!!ex.name && !!ex.message),\n) => {\n return predicate(ex as T) ? closure(ex as T) : undefined\n}\n","import { withError } from './withError.ts'\n\nexport const withErrnoException = <T extends NodeJS.ErrnoException = NodeJS.ErrnoException>(\n ex: unknown, closure: (error: T) => number,\n) => {\n return withError<T>(ex, closure, (ex: unknown) => (ex as NodeJS.ErrnoException).errno !== undefined)\n}\n","/** Catch child process a crash and returns the code */\n\nimport { processEx } from './processEx.ts'\n\nconst safeExit = (func: () => number, exitOnFail = true): number => {\n try {\n const result = func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nconst safeExitAsync = async (func: () => Promise<number>, exitOnFail = true): Promise<number> => {\n try {\n const result = await func()\n if (result && exitOnFail) {\n process.exit(result)\n }\n return result\n } catch (ex) {\n return processEx(ex)\n }\n}\n\nexport { safeExit, safeExitAsync }\n","import type { SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport { safeExit } from './safeExit.ts'\n\nexport type ScriptStep\n = | [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'npm' | 'vitest', /* arg */ string | string[]]\n | [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]\n\nexport const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {\n return safeExit(() => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let totalStatus = 0\n for (const [i, [command, args, config]] of steps.entries()) {\n if (messages?.[i]) {\n console.log(chalk.gray(messages?.[i]))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n const status\n = spawnSync(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n encoding: 'utf8',\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).status ?? 0\n checkResult(name, status, 'error', exitOnFail)\n totalStatus += status ?? 0\n }\n return totalStatus\n }, !!exitOnFail)\n}\n","import { spawn } from 'node:child_process'\nimport { existsSync } from 'node:fs'\n\nimport chalk from 'chalk'\n\nimport { checkResult } from './checkResult.ts'\nimport type { ScriptStep } from './runSteps.ts'\nimport { safeExitAsync } from './safeExit.ts'\n\nexport const runStepAsync = (name: string, step: ScriptStep, exitOnFail = true, message?: string) => {\n return new Promise<number>((resolve) => {\n const [command, args, config] = step\n if (message) {\n console.log(chalk.gray(message))\n }\n const argList = Array.isArray(args) ? args : args.split(' ')\n if (command === 'node' && !existsSync(argList[0])) {\n throw new Error(`File not found [${argList[0]}]`)\n }\n spawn(command, Array.isArray(args) ? args : args.split(' '), {\n ...config,\n env: { FORCE_COLOR: '3', ...process.env },\n shell: true,\n stdio: 'inherit',\n }).on('close', (code) => {\n if (code) {\n console.error(\n chalk.red(\n `Command Exited With Non-Zero Result [${chalk.gray(code)}] | ${chalk.yellow(command)} ${chalk.white(\n Array.isArray(args) ? args.join(' ') : args,\n )}`,\n ),\n )\n checkResult(name, code, 'error', exitOnFail)\n resolve(code)\n } else {\n resolve(0)\n }\n })\n })\n}\n\nexport const runStepsAsync = async (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]) => {\n return await safeExitAsync(async () => {\n const pkgName = process.env.npm_package_name\n console.log(chalk.green(`${name} [${pkgName}]`))\n let result = 0\n for (const [i, step] of steps.entries()) {\n result += await runStepAsync(name, step, exitOnFail, messages?.[i])\n }\n return result\n })\n}\n","import { runSteps, runStepsAsync } from '../lib/index.ts'\n\nexport interface PublintParams {\n pkg?: string\n verbose?: boolean\n}\n\nexport interface PublintPackageParams {\n pkg: string\n verbose?: boolean\n}\n\nexport const publint = async ({ verbose, pkg }: PublintParams) => {\n return pkg === undefined\n ? publintAll({ verbose })\n : await publintPackage({ pkg, verbose })\n}\n\nexport const publintPackage = ({ pkg }: PublintPackageParams) => {\n return runStepsAsync(`Publint [${pkg}]`, [['yarn', ['workspace', pkg, 'run', 'package-publint']]])\n}\n\nexport const publintAll = ({ verbose }: PublintParams) => {\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n return runSteps('Publint', [['yarn', ['workspaces', 'foreach', '-pA', ...verboseOptions, 'run', 'package-publint']]])\n}\n","import type { Argv } from 'yargs'\n\nexport const packagePositionalParam = (yargs: Argv<unknown>) => {\n return yargs.positional('package', { describe: 'Specific package to target', type: 'string' })\n}\n"],"mappings":";AAAA,OAAOA,YAAW;;;ACAlB,OAAO,WAAW;AAEX,IAAM,cAAc,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