@xylabs/ts-scripts-yarn3 6.0.2 → 6.0.4

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 (43) hide show
  1. package/dist/actions/fix.mjs +28 -59
  2. package/dist/actions/fix.mjs.map +1 -1
  3. package/dist/actions/index.mjs +96 -121
  4. package/dist/actions/index.mjs.map +1 -1
  5. package/dist/actions/lint.mjs +25 -65
  6. package/dist/actions/lint.mjs.map +1 -1
  7. package/dist/actions/package/index.mjs +3 -2
  8. package/dist/actions/package/index.mjs.map +1 -1
  9. package/dist/actions/package/lint.mjs +3 -2
  10. package/dist/actions/package/lint.mjs.map +1 -1
  11. package/dist/actions/relint.mjs +61 -45
  12. package/dist/actions/relint.mjs.map +1 -1
  13. package/dist/bin/package/fix.mjs +3 -2
  14. package/dist/bin/package/fix.mjs.map +1 -1
  15. package/dist/bin/package/lint.mjs +3 -2
  16. package/dist/bin/package/lint.mjs.map +1 -1
  17. package/dist/bin/package/relint.mjs +106 -0
  18. package/dist/bin/package/relint.mjs.map +1 -0
  19. package/dist/bin/xy.mjs +100 -94
  20. package/dist/bin/xy.mjs.map +1 -1
  21. package/dist/index.d.ts +29 -23
  22. package/dist/index.mjs +112 -135
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/xy/index.mjs +100 -94
  25. package/dist/xy/index.mjs.map +1 -1
  26. package/dist/xy/xy.mjs +100 -94
  27. package/dist/xy/xy.mjs.map +1 -1
  28. package/dist/xy/xyLintCommands.mjs +97 -111
  29. package/dist/xy/xyLintCommands.mjs.map +1 -1
  30. package/package.json +5 -4
  31. package/src/actions/fix.ts +3 -2
  32. package/src/actions/index.ts +0 -2
  33. package/src/actions/lint.ts +19 -42
  34. package/src/actions/package/lint.ts +2 -2
  35. package/src/actions/relint.ts +73 -18
  36. package/src/bin/package/relint.ts +16 -0
  37. package/src/xy/xyLintCommands.ts +6 -8
  38. package/dist/actions/lint-clean.mjs +0 -222
  39. package/dist/actions/lint-clean.mjs.map +0 -1
  40. package/dist/actions/lint-profile.mjs +0 -118
  41. package/dist/actions/lint-profile.mjs.map +0 -1
  42. package/src/actions/lint-clean.ts +0 -24
  43. 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,31 @@ 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"
101
+ var lintPackage = /* @__PURE__ */ __name(({ pkg, fix: fix2, verbose }) => {
102
+ console.log(chalk4.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
103
+ const start = Date.now();
104
+ const verboseOptions = verbose ? [
105
+ "--verbose"
106
+ ] : [
107
+ "--no-verbose"
132
108
  ];
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);
109
+ const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
110
+ [
111
+ "yarn",
112
+ [
113
+ "workspace",
114
+ pkg,
115
+ ...verboseOptions,
116
+ "run",
117
+ fix2 ? "package-fix" : "package-lint"
118
+ ]
119
+ ]
120
+ ]);
121
+ console.log(chalk4.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk4.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk4.gray("seconds")}`));
122
+ return result;
155
123
  }, "lintPackage");
156
- var lint = /* @__PURE__ */ __name(async ({ pkg, verbose, incremental, fix: fix2 } = {}) => {
157
- return pkg ? await lintPackage({
124
+ var lint = /* @__PURE__ */ __name(({ pkg, verbose, incremental, fix: fix2 } = {}) => {
125
+ return pkg ? lintPackage({
158
126
  pkg,
159
127
  fix: fix2
160
128
  }) : lintAllPackages({
@@ -196,8 +164,9 @@ var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2, verbose = true, incre
196
164
  }, "lintAllPackages");
197
165
 
198
166
  // src/actions/fix.ts
199
- var fix = /* @__PURE__ */ __name(async () => {
200
- return await lint({
167
+ var fix = /* @__PURE__ */ __name((params) => {
168
+ return lint({
169
+ ...params,
201
170
  fix: true
202
171
  });
203
172
  }, "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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I,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 = ({\n pkg, fix, verbose,\n}: LintParams & Required<Pick<LintParams, 'pkg'>>) => {\n console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [All-Packages]`))\n const start = Date.now()\n const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']\n\n const result = runSteps(`${fix ? 'Fix' : 'Lint'} [All-Packages]`, [\n ['yarn', ['workspace',\n pkg,\n ...verboseOptions,\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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;","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","verbose","console","log","chalk","gray","start","Date","now","verboseOptions","result","runSteps","magenta","toFixed","lint","incremental","lintAllPackages","incrementalOptions","fix","params","lint"]}
@@ -988,50 +988,31 @@ 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"
991
+ var lintPackage = /* @__PURE__ */ __name(({ pkg, fix: fix2, verbose }) => {
992
+ console.log(chalk15.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
993
+ const start = Date.now();
994
+ const verboseOptions = verbose ? [
995
+ "--verbose"
996
+ ] : [
997
+ "--no-verbose"
1002
998
  ];
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);
999
+ const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
1000
+ [
1001
+ "yarn",
1002
+ [
1003
+ "workspace",
1004
+ pkg,
1005
+ ...verboseOptions,
1006
+ "run",
1007
+ fix2 ? "package-fix" : "package-lint"
1008
+ ]
1009
+ ]
1010
+ ]);
1011
+ console.log(chalk15.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk15.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk15.gray("seconds")}`));
1012
+ return result;
1025
1013
  }, "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({
1014
+ var lint = /* @__PURE__ */ __name(({ pkg, verbose, incremental, fix: fix2 } = {}) => {
1015
+ return pkg ? lintPackage({
1035
1016
  pkg,
1036
1017
  fix: fix2
1037
1018
  }) : lintAllPackages({
@@ -1073,8 +1054,9 @@ var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2, verbose = true, incre
1073
1054
  }, "lintAllPackages");
1074
1055
 
1075
1056
  // src/actions/fix.ts
1076
- var fix = /* @__PURE__ */ __name(async () => {
1077
- return await lint({
1057
+ var fix = /* @__PURE__ */ __name((params) => {
1058
+ return lint({
1059
+ ...params,
1078
1060
  fix: true
1079
1061
  });
1080
1062
  }, "fix");
@@ -1276,47 +1258,6 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
1276
1258
  }))).reduce((prev, value) => prev || value, 0);
1277
1259
  }, "license");
1278
1260
 
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
1261
  // src/actions/npmignore-gen.ts
1321
1262
  var filename2 = ".npmignore";
1322
1263
  var npmignoreGen = /* @__PURE__ */ __name((pkg) => generateIgnoreFiles(filename2, pkg), "npmignoreGen");
@@ -2111,10 +2052,10 @@ import path7 from "node:path";
2111
2052
  import { cwd as cwd4 } from "node:process";
2112
2053
  import { pathToFileURL } from "node:url";
2113
2054
  import chalk29 from "chalk";
2114
- import { ESLint as ESLint3 } from "eslint";
2055
+ import { ESLint as ESLint2 } from "eslint";
2115
2056
  import { findUp } from "find-up";
2116
2057
  import picomatch from "picomatch";
2117
- var dumpMessages2 = /* @__PURE__ */ __name((lintResults) => {
2058
+ var dumpMessages = /* @__PURE__ */ __name((lintResults) => {
2118
2059
  const colors = [
2119
2060
  "white",
2120
2061
  "yellow",
@@ -2160,7 +2101,7 @@ function getFiles(dir, ignoreFolders) {
2160
2101
  });
2161
2102
  }
2162
2103
  __name(getFiles, "getFiles");
2163
- var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false) => {
2104
+ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, cache = true) => {
2164
2105
  const pkg = process.env.INIT_CWD;
2165
2106
  const configPath = await getRootESLintConfig();
2166
2107
  const { default: eslintConfig } = await import(configPath.href);
@@ -2174,21 +2115,22 @@ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false) =
2174
2115
  ".vscode",
2175
2116
  ".github"
2176
2117
  ];
2177
- const engine = new ESLint3({
2118
+ const engine = new ESLint2({
2178
2119
  baseConfig: [
2179
2120
  ...eslintConfig
2180
2121
  ],
2181
2122
  fix: fix2,
2182
- warnIgnored: false
2123
+ warnIgnored: false,
2124
+ cache
2183
2125
  });
2184
2126
  const files = getFiles(cwd4(), ignoreFolders);
2185
2127
  if (verbose) {
2186
2128
  console.log(chalk29.green(`Linting ${pkg} [files = ${files.length}]`));
2187
2129
  }
2188
2130
  const lintResults = await engine.lintFiles(files);
2189
- dumpMessages2(lintResults);
2131
+ dumpMessages(lintResults);
2190
2132
  if (fix2) {
2191
- await ESLint3.outputFixes(lintResults);
2133
+ await ESLint2.outputFixes(lintResults);
2192
2134
  }
2193
2135
  return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
2194
2136
  }, "packageLint");
@@ -2352,7 +2294,7 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
2352
2294
  }, "recompileAll");
2353
2295
 
2354
2296
  // src/actions/reinstall.ts
2355
- import { closeSync, openSync, rmSync as rmSync2 } from "node:fs";
2297
+ import { closeSync, openSync, rmSync } from "node:fs";
2356
2298
  var reinstall = /* @__PURE__ */ __name(() => {
2357
2299
  console.log("Reinstall [Clear Lock File]");
2358
2300
  closeSync(openSync("./yarn.lock", "w"));
@@ -2361,7 +2303,7 @@ var reinstall = /* @__PURE__ */ __name(() => {
2361
2303
  const result = workspaces.map(({ location, name }) => {
2362
2304
  const dist = `${location}/node_modules`;
2363
2305
  try {
2364
- rmSync2(dist, {
2306
+ rmSync(dist, {
2365
2307
  force: true,
2366
2308
  recursive: true
2367
2309
  });
@@ -2381,35 +2323,69 @@ var reinstall = /* @__PURE__ */ __name(() => {
2381
2323
  }, "reinstall");
2382
2324
 
2383
2325
  // src/actions/relint.ts
2384
- import { rmSync as rmSync3 } from "node:fs";
2385
- var relint = /* @__PURE__ */ __name(() => {
2386
- console.log("Relint - Cleaning [.eslintcache]");
2387
- const workspaces = yarnWorkspaces();
2388
- const result = workspaces.map(({ location, name }) => {
2389
- const dist = `${location}/.eslintcache`;
2390
- try {
2391
- rmSync3(dist, {
2392
- force: true,
2393
- recursive: true
2394
- });
2395
- return 0;
2396
- } catch (ex) {
2397
- const error = ex;
2398
- console.error(`Relint - Cleaning [.eslintcache] Failed [${name}, ${error.message}]`);
2399
- return 1;
2400
- }
2401
- }).reduce((prev, result2) => prev || result2, 0);
2402
- return result || runSteps("Relint", [
2326
+ import chalk31 from "chalk";
2327
+ var relintPackage = /* @__PURE__ */ __name(({ pkg, verbose }) => {
2328
+ console.log(chalk31.gray(`${"Relint"} [All-Packages]`));
2329
+ const start = Date.now();
2330
+ const verboseOptions = verbose ? [
2331
+ "--verbose"
2332
+ ] : [
2333
+ "--no-verbose"
2334
+ ];
2335
+ const result = runSteps("Relint [All-Packages]", [
2403
2336
  [
2404
2337
  "yarn",
2405
2338
  [
2406
- "eslint",
2407
- ".",
2408
- "--cache"
2339
+ "workspace",
2340
+ pkg,
2341
+ ...verboseOptions,
2342
+ "run",
2343
+ "package-relint"
2409
2344
  ]
2410
2345
  ]
2411
2346
  ]);
2347
+ console.log(chalk31.gray(`${"Relinted in"} [${chalk31.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk31.gray("seconds")}`));
2348
+ return result;
2349
+ }, "relintPackage");
2350
+ var relint = /* @__PURE__ */ __name(({ pkg, verbose, incremental } = {}) => {
2351
+ return pkg ? relintPackage({
2352
+ pkg
2353
+ }) : relintAllPackages({
2354
+ verbose,
2355
+ incremental
2356
+ });
2412
2357
  }, "relint");
2358
+ var relintAllPackages = /* @__PURE__ */ __name(({ verbose = true, incremental } = {}) => {
2359
+ console.log(chalk31.gray(`${"Relint"} [All-Packages]`));
2360
+ const start = Date.now();
2361
+ const verboseOptions = verbose ? [
2362
+ "--verbose"
2363
+ ] : [
2364
+ "--no-verbose"
2365
+ ];
2366
+ const incrementalOptions = incremental ? [
2367
+ "--since",
2368
+ "-Ap"
2369
+ ] : [
2370
+ "--parallel",
2371
+ "-Ap"
2372
+ ];
2373
+ const result = runSteps(`${"Relint"} [All-Packages]`, [
2374
+ [
2375
+ "yarn",
2376
+ [
2377
+ "workspaces",
2378
+ "foreach",
2379
+ ...verboseOptions,
2380
+ ...incrementalOptions,
2381
+ "run",
2382
+ "package-relint"
2383
+ ]
2384
+ ]
2385
+ ]);
2386
+ console.log(chalk31.gray(`Relinted in [${chalk31.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk31.gray("seconds")}`));
2387
+ return result;
2388
+ }, "relintAllPackages");
2413
2389
 
2414
2390
  // src/actions/retest.ts
2415
2391
  var retest = /* @__PURE__ */ __name(() => {
@@ -2447,7 +2423,7 @@ var sonar = /* @__PURE__ */ __name(() => {
2447
2423
  }, "sonar");
2448
2424
 
2449
2425
  // src/actions/statics.ts
2450
- import chalk31 from "chalk";
2426
+ import chalk32 from "chalk";
2451
2427
  var DefaultDependencies = [
2452
2428
  "axios",
2453
2429
  "@xylabs/pixel",
@@ -2458,7 +2434,7 @@ var DefaultDependencies = [
2458
2434
  "@mui/system"
2459
2435
  ];
2460
2436
  var statics = /* @__PURE__ */ __name(() => {
2461
- console.log(chalk31.green("Check Required Static Dependencies"));
2437
+ console.log(chalk32.green("Check Required Static Dependencies"));
2462
2438
  const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
2463
2439
  return detectDuplicateDependencies(statics2, DefaultDependencies);
2464
2440
  }, "statics");
@@ -2596,11 +2572,8 @@ export {
2596
2572
  gitlintFix,
2597
2573
  license,
2598
2574
  lint,
2599
- lintAll,
2600
2575
  lintAllPackages,
2601
- lintClean,
2602
2576
  lintPackage,
2603
- lintProfile,
2604
2577
  npmignoreGen,
2605
2578
  packageClean,
2606
2579
  packageCleanOutputs,
@@ -2625,6 +2598,8 @@ export {
2625
2598
  recompilePackage,
2626
2599
  reinstall,
2627
2600
  relint,
2601
+ relintAllPackages,
2602
+ relintPackage,
2628
2603
  retest,
2629
2604
  sonar,
2630
2605
  statics,