@xylabs/ts-scripts-yarn3 6.1.0 → 6.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/bin/package/relint.ts","../../../src/actions/package/lint.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport chalk from 'chalk'\n\nimport { packageLint } from '../../actions/index.ts'\n\npackageLint(false, false, true)\n .then((value) => {\n if (value) {\n process.exit(value)\n }\n })\n .catch((reason) => {\n console.error(chalk.red(reason))\n process.exit(-1)\n })\n","import { readdirSync } from 'node:fs'\nimport path from 'node:path'\nimport { cwd } from 'node:process'\nimport { pathToFileURL } from 'node:url'\n\nimport chalk from 'chalk'\nimport { ESLint } from 'eslint'\nimport { findUp } from 'find-up'\nimport picomatch from 'picomatch'\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(`\\n${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\nasync function getRootESLintConfig() {\n // Locate the root eslint.config.mjs\n const configPath = await findUp('eslint.config.mjs')\n\n if (!configPath) {\n throw new Error('eslint.config.mjs not found in the monorepo')\n }\n\n return pathToFileURL(configPath)\n}\n\nfunction getFiles(dir: string, ignoreFolders: string[]): string[] {\n const currentDirectory = cwd()\n const subDirectory = dir.split(currentDirectory)[1]\n if (ignoreFolders.includes(subDirectory)) return []\n return readdirSync(dir, { withFileTypes: true })\n .flatMap((dirent) => {\n const res = path.resolve(dir, dirent.name)\n const relativePath = subDirectory ? `${subDirectory}/${dirent.name}` : dirent.name\n\n const ignoreMatchers = ignoreFolders.map(pattern => picomatch(pattern))\n\n // Exclude ignored paths\n if (ignoreMatchers.some(isMatch => isMatch(relativePath))) return []\n\n return dirent.isDirectory()\n ? getFiles(res, ignoreFolders)\n : [res]\n })\n}\n\nexport const packageLint = async (fix = false, verbose = false, cache = true) => {\n const pkg = process.env.INIT_CWD\n const configPath = await getRootESLintConfig()\n const { default: eslintConfig } = await import(configPath.href)\n\n // List of folders to ignore\n const ignoreFolders = ['node_modules', 'dist', 'packages', '.git', 'build', '.yarn', '.vscode', '.github']\n\n const engine = new ESLint({\n baseConfig: [...eslintConfig], fix, warnIgnored: false, cache,\n })\n\n const files = getFiles(cwd(), ignoreFolders)\n if (verbose) {\n console.log(chalk.green(`Linting ${pkg} [files = ${files.length}]`))\n }\n const lintResults = await engine.lintFiles(files)\n\n dumpMessages(lintResults)\n\n if (fix) {\n await ESLint.outputFixes(lintResults)\n }\n\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n"],"mappings":";;;;;AAEA,OAAOA,YAAW;;;ACFlB,SAASC,mBAAmB;AAC5B,OAAOC,UAAU;AACjB,SAASC,WAAW;AACpB,SAASC,qBAAqB;AAE9B,OAAOC,WAAW;AAClB,SAASC,cAAc;AACvB,SAASC,cAAc;AACvB,OAAOC,eAAe;AAEtB,IAAMC,eAAe,wBAACC,gBAAAA;AACpB,QAAMC,SAAyC;IAAC;IAAS;IAAU;;AACnE,QAAMC,WAAqB;IAAC;IAAQ;IAAW;;AAE/C,aAAWC,cAAcH,aAAa;AACpC,QAAIG,WAAWC,SAASC,SAAS,GAAG;AAClCC,cAAQC,IAAIC,MAAMC,KAAK;EAAKN,WAAWO,QAAQ,EAAE,CAAA;AACjD,iBAAWC,WAAWR,WAAWC,UAAU;AACzCE,gBAAQC,IACNC,MAAMC,KAAK,IAAKE,QAAQC,IAAI,IAAID,QAAQE,MAAM,EAAE,GAChDL,MAAMP,OAAOU,QAAQT,Q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IAAQ;IAAY;IAAQ;IAAS;IAAS;IAAW;;AAEhG,QAAMiC,SAAS,IAAIC,OAAO;IACxBC,YAAY;SAAIJ;;IAAeR;IAAKa,aAAa;IAAOX;EAC1D,CAAA;AAEA,QAAMY,QAAQvC,SAASI,IAAAA,GAAOF,aAAAA;AAC9B,MAAIwB,SAAS;AACXzC,YAAQC,IAAIC,MAAMqD,MAAM,WAAWZ,GAAAA,aAAgBW,MAAMvD,MAAM,GAAG,CAAA;EACpE;AACA,QAAML,cAAc,MAAMwD,OAAOM,UAAUF,KAAAA;AAE3C7D,eAAaC,WAAAA;AAEb,MAAI8C,KAAK;AACP,UAAMW,OAAOM,YAAY/D,WAAAA;EAC3B;AAEA,SAAOA,YAAYgE,OAAO,CAACC,MAAM9D,eAAe8D,OAAO9D,WAAW+D,YAAY,CAAA;AAChF,GAzB2B;;;ADtD3BC,YAAY,OAAO,OAAO,IAAA,EACvBC,KAAK,CAACC,UAAAA;AACL,MAAIA,OAAO;AACTC,YAAQC,KAAKF,KAAAA;EACf;AACF,CAAA,EACCG,MAAM,CAACC,WAAAA;AACNC,UAAQC,MAAMC,OAAMC,IAAIJ,MAAAA,CAAAA;AACxBH,UAAQC,KAAK,EAAC;AAChB,CAAA;","names":["chalk","readdirSync","path","cwd","pathToFileURL","chalk","ESLint","findUp","picomatch","dumpMessages","lintResults","colors","severity","lintResult","messages","length","console","log","chalk","gray","filePath","message","line","column","white","ruleId","getRootESLintConfig","configPath","findUp","Error","pathToFileURL","getFiles","dir","ignoreFolders","currentDirectory","cwd","subDirectory","split","includes","readdirSync","withFileTypes","flatMap","dirent","res","path","resolve","name","relativePath","ignoreMatchers","map","pattern","picomatch","some","isMatch","isDirectory","packageLint","fix","verbose","cache","pkg","process","env","INIT_CWD","default","eslintConfig","href","engine","ESLint","baseConfig","warnIgnored","files","green","lintFiles","outputFixes","reduce","prev","errorCount","packageLint","then","value","process","exit","catch","reason","console","error","chalk","red"]}
1
+ {"version":3,"sources":["../../../src/bin/package/relint.ts","../../../src/actions/package/lint.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport chalk from 'chalk'\n\nimport { packageLint } from '../../actions/index.ts'\n\npackageLint(false, false, true)\n .then((value) => {\n if (value) {\n process.exit(value)\n }\n })\n .catch((reason) => {\n console.error(chalk.red(reason))\n process.exit(-1)\n })\n","import { readdirSync } from 'node:fs'\nimport path from 'node:path'\nimport { cwd } from 'node:process'\nimport { pathToFileURL } from 'node:url'\n\nimport chalk from 'chalk'\nimport { ESLint } from 'eslint'\nimport { findUp } from 'find-up'\nimport picomatch from 'picomatch'\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(`\\n${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\nasync function getRootESLintConfig() {\n // Locate the root eslint.config.mjs\n const configPath = await findUp('eslint.config.mjs')\n\n if (!configPath) {\n throw new Error('eslint.config.mjs not found in the monorepo')\n }\n\n return pathToFileURL(configPath)\n}\n\nfunction getFiles(dir: string, ignoreFolders: string[]): string[] {\n const currentDirectory = cwd()\n const subDirectory = dir.split(currentDirectory)[1]\n if (ignoreFolders.includes(subDirectory)) return []\n return readdirSync(dir, { withFileTypes: true })\n .flatMap((dirent) => {\n const res = path.resolve(dir, dirent.name)\n const relativePath = subDirectory ? `${subDirectory}/${dirent.name}` : dirent.name\n\n const ignoreMatchers = ignoreFolders.map(pattern => picomatch(pattern))\n\n // Exclude ignored paths\n if (ignoreMatchers.some(isMatch => isMatch(relativePath))) return []\n\n return dirent.isDirectory()\n ? getFiles(res, ignoreFolders)\n : [res]\n })\n}\n\nexport const packageLint = async (fix = false, verbose = false, cache = true) => {\n const start = Date.now()\n const pkg = process.env.INIT_CWD\n const configPath = await getRootESLintConfig()\n const { default: eslintConfig } = await import(configPath.href)\n\n // List of folders to ignore\n const ignoreFolders = ['node_modules', 'dist', 'packages', '.git', 'build', '.yarn', '.vscode', '.github']\n\n const engine = new ESLint({\n baseConfig: [...eslintConfig], fix, warnIgnored: false, cache,\n })\n\n const files = getFiles(cwd(), ignoreFolders)\n if (verbose) {\n console.log(chalk.green(`Linting ${pkg} [files = ${files.length}]`))\n }\n const lintResults = await engine.lintFiles(files)\n\n dumpMessages(lintResults)\n\n if (fix) {\n await ESLint.outputFixes(lintResults)\n }\n console.log(chalk.green(`Linted ${files.length} files in ${Date.now() - start}ms`))\n return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)\n}\n"],"mappings":";;;;;AAEA,OAAOA,YAAW;;;ACFlB,SAASC,mBAAmB;AAC5B,OAAOC,UAAU;AACjB,SAASC,WAAW;AACpB,SAASC,qBAAqB;AAE9B,OAAOC,WAAW;AAClB,SAASC,cAAc;AACvB,SAASC,cAAc;AACvB,OAAOC,eAAe;AAEtB,IAAMC,eAAe,wBAACC,gBAAAA;AACpB,QAAMC,SAAyC;IAAC;IAAS;IAAU;;AACnE,QAAMC,WAAqB;IAAC;IAAQ;IAAW;;AAE/C,aAAWC,cAAcH,aAAa;AACpC,QAAIG,WAAWC,SAASC,SAAS,GAAG;AAClCC,cAAQC,IAAIC,MAAMC,KAAK;EAAKN,WAAWO,QAAQ,EAAE,CAAA;AACjD,iBAAWC,WAAWR,WAAWC,UAAU;AACzCE,gBAAQC,IACNC,MAAMC,KAAK,IAAKE,QAAQC,IAAI,IAAID,QAAQE,MAAM,EAAE,GAChDL,MAAMP,OAAOU,QAAQT,QAAQ,CAAC,EAAE,IAAKA,SAASS,QAAQT,QAAQ,CAAC,EAAE,GACjEM,MAAMM,MAAM,IAAKH,QAAQA,OAAO,EAAE,GA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;IACxBC,YAAY;SAAIJ;;IAAeX;IAAKgB,aAAa;IAAOd;EAC1D,CAAA;AAEA,QAAMe,QAAQ1C,SAASI,IAAAA,GAAOF,aAAAA;AAC9B,MAAIwB,SAAS;AACXzC,YAAQC,IAAIC,MAAMwD,MAAM,WAAWZ,GAAAA,aAAgBW,MAAM1D,MAAM,GAAG,CAAA;EACpE;AACA,QAAML,cAAc,MAAM2D,OAAOM,UAAUF,KAAAA;AAE3ChE,eAAaC,WAAAA;AAEb,MAAI8C,KAAK;AACP,UAAMc,OAAOM,YAAYlE,WAAAA;EAC3B;AACAM,UAAQC,IAAIC,MAAMwD,MAAM,UAAUD,MAAM1D,MAAM,aAAa6C,KAAKC,IAAG,IAAKF,KAAAA,IAAS,CAAA;AACjF,SAAOjD,YAAYmE,OAAO,CAACC,MAAMjE,eAAeiE,OAAOjE,WAAWkE,YAAY,CAAA;AAChF,GA1B2B;;;ADtD3BC,YAAY,OAAO,OAAO,IAAA,EACvBC,KAAK,CAACC,UAAAA;AACL,MAAIA,OAAO;AACTC,YAAQC,KAAKF,KAAAA;EACf;AACF,CAAA,EACCG,MAAM,CAACC,WAAAA;AACNC,UAAQC,MAAMC,OAAMC,IAAIJ,MAAAA,CAAAA;AACxBH,UAAQC,KAAK,EAAC;AAChB,CAAA;","names":["chalk","readdirSync","path","cwd","pathToFileURL","chalk","ESLint","findUp","picomatch","dumpMessages","lintResults","colors","severity","lintResult","messages","length","console","log","chalk","gray","filePath","message","line","column","white","ruleId","getRootESLintConfig","configPath","findUp","Error","pathToFileURL","getFiles","dir","ignoreFolders","currentDirectory","cwd","subDirectory","split","includes","readdirSync","withFileTypes","flatMap","dirent","res","path","resolve","name","relativePath","ignoreMatchers","map","pattern","picomatch","some","isMatch","isDirectory","packageLint","fix","verbose","cache","start","Date","now","pkg","process","env","INIT_CWD","default","eslintConfig","href","engine","ESLint","baseConfig","warnIgnored","files","green","lintFiles","outputFixes","reduce","prev","errorCount","packageLint","then","value","process","exit","catch","reason","console","error","chalk","red"]}
package/dist/bin/xy.mjs CHANGED
@@ -1182,7 +1182,8 @@ var knip = /* @__PURE__ */ __name(() => {
1182
1182
  "yarn",
1183
1183
  [
1184
1184
  "knip",
1185
- "--dependencies"
1185
+ "--dependencies",
1186
+ "--no-exit-code"
1186
1187
  ]
1187
1188
  ]
1188
1189
  ]);