@xylabs/ts-scripts-yarn3 6.0.3 → 6.0.5

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 (39) hide show
  1. package/dist/actions/fix.mjs +23 -60
  2. package/dist/actions/fix.mjs.map +1 -1
  3. package/dist/actions/index.mjs +83 -127
  4. package/dist/actions/index.mjs.map +1 -1
  5. package/dist/actions/lint.mjs +20 -66
  6. package/dist/actions/lint.mjs.map +1 -1
  7. package/dist/actions/recompile.mjs +1 -7
  8. package/dist/actions/recompile.mjs.map +1 -1
  9. package/dist/actions/relint.mjs +55 -45
  10. package/dist/actions/relint.mjs.map +1 -1
  11. package/dist/bin/package/relint.mjs +106 -0
  12. package/dist/bin/package/relint.mjs.map +1 -0
  13. package/dist/bin/xy.mjs +90 -102
  14. package/dist/bin/xy.mjs.map +1 -1
  15. package/dist/index.d.ts +29 -23
  16. package/dist/index.mjs +99 -141
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/xy/index.mjs +90 -102
  19. package/dist/xy/index.mjs.map +1 -1
  20. package/dist/xy/xy.mjs +90 -102
  21. package/dist/xy/xy.mjs.map +1 -1
  22. package/dist/xy/xyBuildCommands.mjs +1 -7
  23. package/dist/xy/xyBuildCommands.mjs.map +1 -1
  24. package/dist/xy/xyLintCommands.mjs +86 -112
  25. package/dist/xy/xyLintCommands.mjs.map +1 -1
  26. package/package.json +5 -4
  27. package/src/actions/fix.ts +3 -2
  28. package/src/actions/index.ts +0 -2
  29. package/src/actions/lint.ts +15 -42
  30. package/src/actions/recompile.ts +2 -5
  31. package/src/actions/relint.ts +71 -18
  32. package/src/bin/package/relint.ts +16 -0
  33. package/src/xy/xyLintCommands.ts +6 -8
  34. package/dist/actions/lint-clean.mjs +0 -222
  35. package/dist/actions/lint-clean.mjs.map +0 -1
  36. package/dist/actions/lint-profile.mjs +0 -118
  37. package/dist/actions/lint-profile.mjs.map +0 -1
  38. package/src/actions/lint-clean.ts +0 -24
  39. package/src/actions/lint-profile.ts +0 -5
@@ -3,7 +3,6 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
3
3
 
4
4
  // src/actions/lint.ts
5
5
  import chalk4 from "chalk";
6
- import { ESLint } from "eslint";
7
6
 
8
7
  // src/lib/checkResult.ts
9
8
  import chalk from "chalk";
@@ -64,28 +63,8 @@ var safeExit = /* @__PURE__ */ __name((func, exitOnFail = true) => {
64
63
  }
65
64
  }, "safeExit");
66
65
 
67
- // src/lib/yarn/workspace/yarnWorkspaces.ts
68
- import { spawnSync } from "node:child_process";
69
- var yarnWorkspaces = /* @__PURE__ */ __name(() => {
70
- const result = spawnSync("yarn", [
71
- "workspaces",
72
- "list",
73
- "--json",
74
- "--recursive"
75
- ], {
76
- encoding: "utf8",
77
- shell: true
78
- });
79
- if (result.error) {
80
- throw result.error;
81
- }
82
- return result.stdout.toString().split("\n").slice(0, -1).map((item) => {
83
- return JSON.parse(item);
84
- });
85
- }, "yarnWorkspaces");
86
-
87
66
  // src/lib/runSteps.ts
88
- import { spawnSync as spawnSync2 } from "node:child_process";
67
+ import { spawnSync } from "node:child_process";
89
68
  import { existsSync } from "node:fs";
90
69
  import chalk3 from "chalk";
91
70
  var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages) => {
@@ -101,7 +80,7 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
101
80
  if (command === "node" && !existsSync(argList[0])) {
102
81
  throw new Error(`File not found [${argList[0]}]`);
103
82
  }
104
- const status = spawnSync2(command, Array.isArray(args) ? args : args.split(" "), {
83
+ const status = spawnSync(command, Array.isArray(args) ? args : args.split(" "), {
105
84
  ...config,
106
85
  encoding: "utf8",
107
86
  env: {
@@ -119,42 +98,25 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
119
98
  }, "runSteps");
120
99
 
121
100
  // src/actions/lint.ts
122
- var dumpMessages = /* @__PURE__ */ __name((lintResults) => {
123
- const colors = [
124
- "white",
125
- "yellow",
126
- "red"
127
- ];
128
- const severity = [
129
- "none",
130
- "warning",
131
- "error"
132
- ];
133
- for (const lintResult of lintResults) {
134
- if (lintResult.messages.length > 0) {
135
- console.log(chalk4.gray(`${lintResult.filePath}`));
136
- for (const message of lintResult.messages) {
137
- console.log(chalk4.gray(` ${message.line}:${message.column}`), chalk4[colors[message.severity]](` ${severity[message.severity]}`), chalk4.white(` ${message.message}`), chalk4.gray(` ${message.ruleId}`));
138
- }
139
- }
140
- }
141
- }, "dumpMessages");
142
- var lintPackage = /* @__PURE__ */ __name(async ({ pkg, fix: fix2 }) => {
143
- const workspace = yarnWorkspaces().find((workspace2) => workspace2.name === pkg);
144
- if (!workspace) {
145
- console.error(chalk4.red(`Unable to locate package [${chalk4.magenta(pkg)}]`));
146
- process.exit(1);
147
- }
148
- const engine = new ESLint({
149
- cache: true,
150
- fix: fix2
151
- });
152
- const lintResults = await engine.lintFiles(workspace.location);
153
- dumpMessages(lintResults);
154
- return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
101
+ var lintPackage = /* @__PURE__ */ __name(({ pkg, fix: fix2 }) => {
102
+ console.log(chalk4.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
103
+ const start = Date.now();
104
+ const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
105
+ [
106
+ "yarn",
107
+ [
108
+ "workspace",
109
+ pkg,
110
+ "run",
111
+ fix2 ? "package-fix" : "package-lint"
112
+ ]
113
+ ]
114
+ ]);
115
+ console.log(chalk4.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk4.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk4.gray("seconds")}`));
116
+ return result;
155
117
  }, "lintPackage");
156
- var lint = /* @__PURE__ */ __name(async ({ pkg, verbose, incremental, fix: fix2 } = {}) => {
157
- return pkg ? await lintPackage({
118
+ var lint = /* @__PURE__ */ __name(({ pkg, verbose, incremental, fix: fix2 } = {}) => {
119
+ return pkg ? lintPackage({
158
120
  pkg,
159
121
  fix: fix2
160
122
  }) : lintAllPackages({
@@ -196,8 +158,9 @@ var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2, verbose = true, incre
196
158
  }, "lintAllPackages");
197
159
 
198
160
  // src/actions/fix.ts
199
- var fix = /* @__PURE__ */ __name(async () => {
200
- return await lint({
161
+ var fix = /* @__PURE__ */ __name((params) => {
162
+ return lint({
163
+ ...params,
201
164
  fix: true
202
165
  });
203
166
  }, "fix");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/actions/lint.ts","../../src/lib/checkResult.ts","../../src/lib/processEx.ts","../../src/lib/withError.ts","../../src/lib/withErrnoException.ts","../../src/lib/safeExit.ts","../../src/lib/yarn/workspace/yarnWorkspaces.ts","../../src/lib/runSteps.ts","../../src/actions/fix.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { ESLint } from 'eslint'\n\nimport { runSteps, yarnWorkspaces } from '../lib/index.ts'\n\nexport interface LintParams {\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\nconst dumpMessages = (lintResults: ESLint.LintResult[]) => {\n const colors: ('white' | 'red' | 'yellow')[] = ['white', 'yellow', 'red']\n const severity: string[] = ['none', 'warning', 'error']\n\n for (const lintResult of lintResults) {\n if (lintResult.messages.length > 0) {\n console.log(chalk.gray(`${lintResult.filePath}`))\n for (const message of lintResult.messages) {\n console.log(\n chalk.gray(`\\t${message.line}:${message.column}`),\n chalk[colors[message.severity]](`\\t${severity[message.severity]}`),\n chalk.white(`\\t${message.message}`),\n chalk.gray(`\\t${message.ruleId}`),\n )\n }\n }\n }\n}\n\nexport const lintPackage = async ({ pkg, fix }: LintParams) => {\n const workspace = yarnWorkspaces().find(workspace => workspace.name === pkg)\n if (!workspace) {\n console.error(chalk.red(`Unable to locate package [${chalk.magenta(pkg)}]`))\n process.exit(1)\n }\n\n const engine = new ESLint({ cache: true, fix })\n\n const lintResults = await engine.lintFiles(workspace.location)\n\n dumpMessages(lintResults)\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n\nexport const lintAll = async ({ fix }: LintParams) => {\n const workspace = yarnWorkspaces()\n return (await Promise.all(workspace.map(ws =>\n lintPackage({ pkg: ws.name, fix })))).reduce((prev, curr) => prev + curr, 0)\n}\n\nexport const lint = async ({\n pkg, verbose, incremental, fix,\n}: LintParams = {}) => {\n return pkg\n ? await lintPackage({ pkg, fix })\n : lintAllPackages({\n verbose, incremental, fix,\n })\n}\n\nexport const lintAllPackages = ({\n fix, verbose = true, incremental,\n}: 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\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [All-Packages]`, [\n ['yarn', ['workspaces',\n 'foreach',\n ...verboseOptions,\n ...incrementalOptions,\n 'run',\n fix ? 'package-fix' : '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","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 { spawnSync } from 'node:child_process'\n\nimport type { Workspace } from './Workspace.ts'\n\nexport const yarnWorkspaces = (): Workspace[] => {\n const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], { encoding: 'utf8', shell: true })\n if (result.error) {\n throw result.error\n }\n return (\n result.stdout\n .toString()\n // NOTE: This probably doesn't work on Windows\n // TODO: Replace /r/n with /n first\n .split('\\n')\n .slice(0, -1)\n .map((item) => {\n return JSON.parse(item)\n })\n )\n}\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' | 'jest', /* 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 { lint } from './lint.ts'\n\nexport const fix = async () => {\n return await lint({ fix: true })\n}\n"],"mappings":";;;;AAAA,OAAOA,YAAW;AAClB,SAASC,cAAc;;;ACDvB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QAAID,YAAY;AACdO,cAAQC,KAAKV,MAAAA;IAC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,UAAUa,QAAQ;AAE7DjC,eAAaC,WAAAA;AAEb,SAAOA,YAAYiC,OAAO,CAACC,MAAM/B,eAAe+B,OAAO/B,WAAWgC,YAAY,CAAA;AAChF,GAd2B;AAsBpB,IAAMC,OAAO,8BAAO,EACzBC,KAAKC,SAASC,aAAaC,KAAAA,KAAG,IAChB,CAAC,MAAC;AAChB,SAAOH,MACH,MAAMI,YAAY;IAAEJ;IAAKG,KAAAA;EAAI,CAAA,IAC7BE,gBAAgB;IACdJ;IAASC;IAAaC,KAAAA;EACxB,CAAA;AACN,GARoB;AAUb,IAAME,kBAAkB,wBAAC,EAC9BF,KAAAA,MAAKF,UAAU,MAAMC,YAAW,IAClB,CAAC,MAAC;AAChBI,UAAQC,IAAIC,OAAMC,KAAK,GAAGN,OAAM,QAAQ,MAAA,iBAAuB,CAAA;AAC/D,QAAMO,QAAQC,KAAKC,IAAG;AACtB,QAAMC,iBAAiBZ,UAAU;IAAC;MAAe;IAAC;;AAClD,QAAMa,qBAAqBZ,cAAc;IAAC;IAAW;MAAS;IAAC;IAAc;;AAE7E,QAAMa,SAASC,SAAS,GAAGb,OAAM,QAAQ,MAAA,oBAA0B;IACjE;MAAC;MAAQ;QAAC;QACR;WACGU;WACAC;QACH;QACAX,OAAM,gBAAgB;;;GAEzB;AACDG,UAAQC,IAAIC,OAAMC,KAAK,GAAGN,OAAM,aAAa,WAAA,KAAgBK,OAAMS,UAAUN,KAAKC,IAAG,IAAKF,SAAS,KAAMQ,QAAQ,CAAA,CAAA,CAAA,KAAQV,OAAMC,KAAK,SAAA,CAAA,EAAY,CAAA;AAChJ,SAAOM;AACT,GAnB+B;;;AQlExB,IAAMI,MAAM,mCAAA;AACjB,SAAO,MAAMC,KAAK;IAAED,KAAK;EAAK,CAAA;AAChC,GAFmB;","names":["chalk","ESLint","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","message","undefined","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","yarnWorkspaces","result","spawnSync","encoding","shell","error","stdout","toString","split","slice","map","item","JSON","parse","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","dumpMessages","lintResults","colors","severity","lintResult","messages","length","console","log","chalk","gray","filePath","message","line","column","white","ruleId","lintPackage","pkg","fix","workspace","yarnWorkspaces","find","name","error","red","magenta","process","exit","engine","ESLint","cache","lintFiles","location","reduce","prev","errorCount","lint","pkg","verbose","incremental","fix","lintPackage","lintAllPackages","console","log","chalk","gray","start","Date","now","verboseOptions","incrementalOptions","result","runSteps","magenta","toFixed","fix","lint"]}
1
+ {"version":3,"sources":["../../src/actions/lint.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/fix.ts"],"sourcesContent":["import chalk from 'chalk'\n\nimport { runSteps } from '../lib/index.ts'\n\nexport interface LintParams {\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 = ({ pkg, fix }: LintParams & Required<Pick<LintParams, 'pkg'>>) => {\n console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [All-Packages]`))\n const start = Date.now()\n\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [All-Packages]`, [\n ['yarn', ['workspace',\n pkg,\n 'run',\n fix ? 'package-fix' : '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\n ? lintPackage({ pkg, fix })\n : lintAllPackages({\n verbose, incremental, fix,\n })\n}\n\nexport const lintAllPackages = ({\n fix, verbose = true, incremental,\n}: 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\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [All-Packages]`, [\n ['yarn', ['workspaces',\n 'foreach',\n ...verboseOptions,\n ...incrementalOptions,\n 'run',\n fix ? 'package-fix' : '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","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' | 'jest', /* 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 type { LintParams } from './lint.ts'\nimport { lint } from './lint.ts'\n\nexport const fix = (params?: LintParams) => {\n return lint({ ...params, fix: true })\n}\n"],"mappings":";;;;AAAA,OAAOA,YAAW;;;ACAlB,OAAOC,WAAW;AAEX,IAAMC,cAAc,wBAACC,MAAcC,QAAgBC,QAA0B,SAASC,aAAa,UAAK;AAC7G,MAAIF,QAAQ;AACV,UAAMG,UAAUD,aAAa,sBAAsB;AACnD,UAAME,YAAYH,UAAU,UAAUI,MAAMC,MAAMD,MAAME;AACxDC,YAAQP,KAAAA,EAAOG,UAAU,GAAGL,IAAAA,QAAYC,MAAAA,aAAmBG,OAAAA,EAAS,CAAA;AACpE,QAAID,YAAY;AACdO,cAAQC,KAAKV,MAAAA;IACf;EACF;AACF,GAT2B;;;ACF3B,OAAOW,YAAW;;;ACAX,IAAMC,YAAY,wBAEvBC,IACAC,SACAC,YAAY,CAACF,QAAW,CAAC,CAACA,IAAGG,QAAQ,CAAC,CAACH,IAAGI,YAAQ;AAElD,SAAOF,UAAUF,EAAAA,IAAWC,QAAQD,EAAAA,IAAWK;AACjD,GAPyB;;;ACElB,IAAMC,qBAAqB,wBAChCC,IAAaC,YAAAA;AAEb,SAAOC,UAAaF,IAAIC,SAAS,CAACD,QAAiBA,IAA6BG,UAAUC,MAAAA;AAC5F,GAJkC;;;AFG3B,IAAMC,YAAY,wBAACC,OAAAA;AACxB,QAAMC,QAAQ,OAAOD,OAAO,WAAW,IAAIE,MAAMF,EAAAA,IAAM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C;AAChB,SAAOD,MACHD,YAAY;IAAEC;IAAKC,KAAAA;EAAI,CAAA,IACvBe,gBAAgB;IACdF;IAASC;IAAad,KAAAA;EACxB,CAAA;AACN,GARoB;AAUb,IAAMe,kBAAkB,wBAAC,EAC9Bf,KAAAA,MAAKa,UAAU,MAAMC,YAAW,IAClB,CAAC,MAAC;AAChBb,UAAQC,IAAIC,OAAMC,KAAK,GAAGJ,OAAM,QAAQ,MAAA,iBAAuB,CAAA;AAC/D,QAAMK,QAAQC,KAAKC,IAAG;AACtB,QAAMS,iBAAiBH,UAAU;IAAC;MAAe;IAAC;;AAClD,QAAMI,qBAAqBH,cAAc;IAAC;IAAW;MAAS;IAAC;IAAc;;AAE7E,QAAMN,SAASC,SAAS,GAAGT,OAAM,QAAQ,MAAA,oBAA0B;IACjE;MAAC;MAAQ;QAAC;QACR;WACGgB;WACAC;QACH;QACAjB,OAAM,gBAAgB;;;GAEzB;AACDC,UAAQC,IAAIC,OAAMC,KAAK,GAAGJ,OAAM,aAAa,WAAA,KAAgBG,OAAMO,UAAUJ,KAAKC,IAAG,IAAKF,SAAS,KAAMM,QAAQ,CAAA,CAAA,CAAA,KAAQR,OAAMC,KAAK,SAAA,CAAA,EAAY,CAAA;AAChJ,SAAOI;AACT,GAnB+B;;;AOtCxB,IAAMU,MAAM,wBAACC,WAAAA;AAClB,SAAOC,KAAK;IAAE,GAAGD;IAAQD,KAAK;EAAK,CAAA;AACrC,GAFmB;","names":["chalk","chalk","checkResult","name","result","level","exitOnFail","exiting","chalkFunc","chalk","red","yellow","console","process","exit","chalk","withError","ex","closure","predicate","name","message","undefined","withErrnoException","ex","closure","withError","errno","undefined","processEx","ex","error","Error","exitCode","withErrnoException","code","console","chalk","red","path","errno","withError","name","message","JSON","stringify","process","exit","safeExit","func","exitOnFail","result","process","exit","ex","processEx","spawnSync","existsSync","chalk","runSteps","name","steps","exitOnFail","messages","safeExit","pkgName","process","env","npm_package_name","console","log","chalk","green","totalStatus","i","command","args","config","entries","gray","argList","Array","isArray","split","existsSync","Error","status","spawnSync","encoding","FORCE_COLOR","shell","stdio","checkResult","lintPackage","pkg","fix","console","log","chalk","gray","start","Date","now","result","runSteps","magenta","toFixed","lint","verbose","incremental","lintAllPackages","verboseOptions","incrementalOptions","fix","params","lint"]}
@@ -988,50 +988,25 @@ var dupdeps = /* @__PURE__ */ __name(() => {
988
988
 
989
989
  // src/actions/lint.ts
990
990
  import chalk15 from "chalk";
991
- import { ESLint as ESLint2 } from "eslint";
992
- var dumpMessages = /* @__PURE__ */ __name((lintResults) => {
993
- const colors = [
994
- "white",
995
- "yellow",
996
- "red"
997
- ];
998
- const severity = [
999
- "none",
1000
- "warning",
1001
- "error"
1002
- ];
1003
- for (const lintResult of lintResults) {
1004
- if (lintResult.messages.length > 0) {
1005
- console.log(chalk15.gray(`${lintResult.filePath}`));
1006
- for (const message of lintResult.messages) {
1007
- console.log(chalk15.gray(` ${message.line}:${message.column}`), chalk15[colors[message.severity]](` ${severity[message.severity]}`), chalk15.white(` ${message.message}`), chalk15.gray(` ${message.ruleId}`));
1008
- }
1009
- }
1010
- }
1011
- }, "dumpMessages");
1012
- var lintPackage = /* @__PURE__ */ __name(async ({ pkg, fix: fix2 }) => {
1013
- const workspace = yarnWorkspaces().find((workspace2) => workspace2.name === pkg);
1014
- if (!workspace) {
1015
- console.error(chalk15.red(`Unable to locate package [${chalk15.magenta(pkg)}]`));
1016
- process.exit(1);
1017
- }
1018
- const engine = new ESLint2({
1019
- cache: true,
1020
- fix: fix2
1021
- });
1022
- const lintResults = await engine.lintFiles(workspace.location);
1023
- dumpMessages(lintResults);
1024
- return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
991
+ var lintPackage = /* @__PURE__ */ __name(({ pkg, fix: fix2 }) => {
992
+ console.log(chalk15.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
993
+ const start = Date.now();
994
+ const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
995
+ [
996
+ "yarn",
997
+ [
998
+ "workspace",
999
+ pkg,
1000
+ "run",
1001
+ fix2 ? "package-fix" : "package-lint"
1002
+ ]
1003
+ ]
1004
+ ]);
1005
+ console.log(chalk15.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk15.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk15.gray("seconds")}`));
1006
+ return result;
1025
1007
  }, "lintPackage");
1026
- var lintAll = /* @__PURE__ */ __name(async ({ fix: fix2 }) => {
1027
- const workspace = yarnWorkspaces();
1028
- return (await Promise.all(workspace.map((ws) => lintPackage({
1029
- pkg: ws.name,
1030
- fix: fix2
1031
- })))).reduce((prev, curr) => prev + curr, 0);
1032
- }, "lintAll");
1033
- var lint = /* @__PURE__ */ __name(async ({ pkg, verbose, incremental, fix: fix2 } = {}) => {
1034
- return pkg ? await lintPackage({
1008
+ var lint = /* @__PURE__ */ __name(({ pkg, verbose, incremental, fix: fix2 } = {}) => {
1009
+ return pkg ? lintPackage({
1035
1010
  pkg,
1036
1011
  fix: fix2
1037
1012
  }) : lintAllPackages({
@@ -1073,8 +1048,9 @@ var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2, verbose = true, incre
1073
1048
  }, "lintAllPackages");
1074
1049
 
1075
1050
  // src/actions/fix.ts
1076
- var fix = /* @__PURE__ */ __name(async () => {
1077
- return await lint({
1051
+ var fix = /* @__PURE__ */ __name((params) => {
1052
+ return lint({
1053
+ ...params,
1078
1054
  fix: true
1079
1055
  });
1080
1056
  }, "fix");
@@ -1276,47 +1252,6 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
1276
1252
  }))).reduce((prev, value) => prev || value, 0);
1277
1253
  }, "license");
1278
1254
 
1279
- // src/actions/lint-clean.ts
1280
- import { rmSync } from "node:fs";
1281
- var lintClean = /* @__PURE__ */ __name(async () => {
1282
- console.log("Lint Clean [.eslintcache]");
1283
- const workspaces = yarnWorkspaces();
1284
- const result = workspaces.map(({ location, name }) => {
1285
- const dist = `${location}/.eslintcache`;
1286
- try {
1287
- rmSync(dist, {
1288
- force: true,
1289
- recursive: true
1290
- });
1291
- return 0;
1292
- } catch (ex) {
1293
- const error = ex;
1294
- console.error(`Lint Clean [.eslintcache] Failed [${name}, ${error.message}]`);
1295
- return 1;
1296
- }
1297
- }).reduce((prev, result2) => prev || result2, 0);
1298
- return result || await lint();
1299
- }, "lintClean");
1300
-
1301
- // src/actions/lint-profile.ts
1302
- var lintProfile = /* @__PURE__ */ __name(() => {
1303
- return runSteps("Lint Profile", [
1304
- [
1305
- "yarn",
1306
- [
1307
- "xy",
1308
- "lint"
1309
- ],
1310
- {
1311
- env: {
1312
- ...process.env,
1313
- TIMING: "1"
1314
- }
1315
- }
1316
- ]
1317
- ]);
1318
- }, "lintProfile");
1319
-
1320
1255
  // src/actions/npmignore-gen.ts
1321
1256
  var filename2 = ".npmignore";
1322
1257
  var npmignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename2, pkg), "npmignoreGen");
@@ -2111,10 +2046,10 @@ import path7 from "node:path";
2111
2046
  import { cwd as cwd4 } from "node:process";
2112
2047
  import { pathToFileURL } from "node:url";
2113
2048
  import chalk29 from "chalk";
2114
- import { ESLint as ESLint3 } from "eslint";
2049
+ import { ESLint as ESLint2 } from "eslint";
2115
2050
  import { findUp } from "find-up";
2116
2051
  import picomatch from "picomatch";
2117
- var dumpMessages2 = /* @__PURE__ */ __name((lintResults) => {
2052
+ var dumpMessages = /* @__PURE__ */ __name((lintResults) => {
2118
2053
  const colors = [
2119
2054
  "white",
2120
2055
  "yellow",
@@ -2174,7 +2109,7 @@ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, c
2174
2109
  ".vscode",
2175
2110
  ".github"
2176
2111
  ];
2177
- const engine = new ESLint3({
2112
+ const engine = new ESLint2({
2178
2113
  baseConfig: [
2179
2114
  ...eslintConfig
2180
2115
  ],
@@ -2187,9 +2122,9 @@ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, c
2187
2122
  console.log(chalk29.green(`Linting ${pkg} [files = ${files.length}]`));
2188
2123
  }
2189
2124
  const lintResults = await engine.lintFiles(files);
2190
- dumpMessages2(lintResults);
2125
+ dumpMessages(lintResults);
2191
2126
  if (fix2) {
2192
- await ESLint3.outputFixes(lintResults);
2127
+ await ESLint2.outputFixes(lintResults);
2193
2128
  }
2194
2129
  return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
2195
2130
  }, "packageLint");
@@ -2269,23 +2204,17 @@ var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incrementa
2269
2204
  verbose
2270
2205
  });
2271
2206
  }, "recompile");
2272
- var recompilePackage = /* @__PURE__ */ __name(({ verbose, target, pkg }) => {
2207
+ var recompilePackage = /* @__PURE__ */ __name(({ target, pkg }) => {
2273
2208
  const targetOptions = target ? [
2274
2209
  "-t",
2275
2210
  target
2276
2211
  ] : [];
2277
- const verboseOptions = verbose ? [
2278
- "--verbose"
2279
- ] : [
2280
- "--no-verbose"
2281
- ];
2282
2212
  return runStepsAsync(`Recompile [${pkg}]`, [
2283
2213
  [
2284
2214
  "yarn",
2285
2215
  [
2286
2216
  "workspace",
2287
2217
  pkg,
2288
- ...verboseOptions,
2289
2218
  "run",
2290
2219
  "package-recompile",
2291
2220
  ...targetOptions
@@ -2353,7 +2282,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
2353
2282
  }, "recompileAll");
2354
2283
 
2355
2284
  // src/actions/reinstall.ts
2356
- import { closeSync, openSync, rmSync as rmSync2 } from "node:fs";
2285
+ import { closeSync, openSync, rmSync } from "node:fs";
2357
2286
  var reinstall = /* @__PURE__ */ __name(() => {
2358
2287
  console.log("Reinstall [Clear Lock File]");
2359
2288
  closeSync(openSync("./yarn.lock", "w"));
@@ -2362,7 +2291,7 @@ var reinstall = /* @__PURE__ */ __name(() => {
2362
2291
  const result = workspaces.map(({ location, name }) => {
2363
2292
  const dist = `${location}/node_modules`;
2364
2293
  try {
2365
- rmSync2(dist, {
2294
+ rmSync(dist, {
2366
2295
  force: true,
2367
2296
  recursive: true
2368
2297
  });
@@ -2382,35 +2311,63 @@ var reinstall = /* @__PURE__ */ __name(() => {
2382
2311
  }, "reinstall");
2383
2312
 
2384
2313
  // src/actions/relint.ts
2385
- import { rmSync as rmSync3 } from "node:fs";
2386
- var relint = /* @__PURE__ */ __name(() => {
2387
- console.log("Relint - Cleaning [.eslintcache]");
2388
- const workspaces = yarnWorkspaces();
2389
- const result = workspaces.map(({ location, name }) => {
2390
- const dist = `${location}/.eslintcache`;
2391
- try {
2392
- rmSync3(dist, {
2393
- force: true,
2394
- recursive: true
2395
- });
2396
- return 0;
2397
- } catch (ex) {
2398
- const error = ex;
2399
- console.error(`Relint - Cleaning [.eslintcache] Failed [${name}, ${error.message}]`);
2400
- return 1;
2401
- }
2402
- }).reduce((prev, result2) => prev || result2, 0);
2403
- return result || runSteps("Relint", [
2314
+ import chalk31 from "chalk";
2315
+ var relintPackage = /* @__PURE__ */ __name(({ pkg }) => {
2316
+ console.log(chalk31.gray(`${"Relint"} [All-Packages]`));
2317
+ const start = Date.now();
2318
+ const result = runSteps("Relint [All-Packages]", [
2404
2319
  [
2405
2320
  "yarn",
2406
2321
  [
2407
- "eslint",
2408
- ".",
2409
- "--cache"
2322
+ "workspace",
2323
+ pkg,
2324
+ "run",
2325
+ "package-relint"
2410
2326
  ]
2411
2327
  ]
2412
2328
  ]);
2329
+ console.log(chalk31.gray(`${"Relinted in"} [${chalk31.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk31.gray("seconds")}`));
2330
+ return result;
2331
+ }, "relintPackage");
2332
+ var relint = /* @__PURE__ */ __name(({ pkg, verbose, incremental } = {}) => {
2333
+ return pkg ? relintPackage({
2334
+ pkg
2335
+ }) : relintAllPackages({
2336
+ verbose,
2337
+ incremental
2338
+ });
2413
2339
  }, "relint");
2340
+ var relintAllPackages = /* @__PURE__ */ __name(({ verbose = true, incremental } = {}) => {
2341
+ console.log(chalk31.gray(`${"Relint"} [All-Packages]`));
2342
+ const start = Date.now();
2343
+ const verboseOptions = verbose ? [
2344
+ "--verbose"
2345
+ ] : [
2346
+ "--no-verbose"
2347
+ ];
2348
+ const incrementalOptions = incremental ? [
2349
+ "--since",
2350
+ "-Ap"
2351
+ ] : [
2352
+ "--parallel",
2353
+ "-Ap"
2354
+ ];
2355
+ const result = runSteps(`${"Relint"} [All-Packages]`, [
2356
+ [
2357
+ "yarn",
2358
+ [
2359
+ "workspaces",
2360
+ "foreach",
2361
+ ...verboseOptions,
2362
+ ...incrementalOptions,
2363
+ "run",
2364
+ "package-relint"
2365
+ ]
2366
+ ]
2367
+ ]);
2368
+ console.log(chalk31.gray(`Relinted in [${chalk31.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk31.gray("seconds")}`));
2369
+ return result;
2370
+ }, "relintAllPackages");
2414
2371
 
2415
2372
  // src/actions/retest.ts
2416
2373
  var retest = /* @__PURE__ */ __name(() => {
@@ -2448,7 +2405,7 @@ var sonar = /* @__PURE__ */ __name(() => {
2448
2405
  }, "sonar");
2449
2406
 
2450
2407
  // src/actions/statics.ts
2451
- import chalk31 from "chalk";
2408
+ import chalk32 from "chalk";
2452
2409
  var DefaultDependencies = [
2453
2410
  "axios",
2454
2411
  "@xylabs/pixel",
@@ -2459,7 +2416,7 @@ var DefaultDependencies = [
2459
2416
  "@mui/system"
2460
2417
  ];
2461
2418
  var statics = /* @__PURE__ */ __name(() => {
2462
- console.log(chalk31.green("Check Required Static Dependencies"));
2419
+ console.log(chalk32.green("Check Required Static Dependencies"));
2463
2420
  const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
2464
2421
  return detectDuplicateDependencies(statics2, DefaultDependencies);
2465
2422
  }, "statics");
@@ -2597,11 +2554,8 @@ export {
2597
2554
  gitlintFix,
2598
2555
  license,
2599
2556
  lint,
2600
- lintAll,
2601
2557
  lintAllPackages,
2602
- lintClean,
2603
2558
  lintPackage,
2604
- lintProfile,
2605
2559
  npmignoreGen,
2606
2560
  packageClean,
2607
2561
  packageCleanOutputs,
@@ -2626,6 +2580,8 @@ export {
2626
2580
  recompilePackage,
2627
2581
  reinstall,
2628
2582
  relint,
2583
+ relintAllPackages,
2584
+ relintPackage,
2629
2585
  retest,
2630
2586
  sonar,
2631
2587
  statics,