@xylabs/ts-scripts-yarn3 6.1.2 → 6.1.3
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.
- package/dist/actions/index.mjs +5 -2
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/index.mjs +5 -2
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/lint.mjs +5 -2
- package/dist/actions/package/lint.mjs.map +1 -1
- package/dist/bin/package/fix.mjs +5 -2
- package/dist/bin/package/fix.mjs.map +1 -1
- package/dist/bin/package/lint.mjs +5 -2
- package/dist/bin/package/lint.mjs.map +1 -1
- package/dist/bin/package/relint.mjs +5 -2
- package/dist/bin/package/relint.mjs.map +1 -1
- package/dist/index.mjs +5 -2
- package/dist/index.mjs.map +1 -1
- package/dist/types/actions/package/lint.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -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
|
|
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 const start = Date.now()\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 const filesCountColor = files.length < 100 ? 'green' : files.length < 1000 ? 'yellow' : 'red'\n const lintTime = Date.now() - start\n const lintTimeColor = lintTime < 1000 ? 'green' : lintTime < 3000 ? 'yellow' : 'red'\n console.log(chalk.white(`Linted ${chalk[filesCountColor](files.length)} files in ${chalk[lintTimeColor](lintTime)}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,GAClCH,MAAMC,KAAK,IAAKE,QAAQI,MAAM,EAAE,CAAA;MAEpC;IACF;EACF;AACF,GAjBqB;AAmBrB,eAAeC,sBAAAA;AAEb,QAAMC,aAAa,MAAMC,OAAO,mBAAA;AAEhC,MAAI,CAACD,YAAY;AACf,UAAM,IAAIE,MAAM,6CAAA;EAClB;AAEA,SAAOC,cAAcH,UAAAA;AACvB;AATeD;AAWf,SAASK,SAASC,KAAaC,eAAuB;AACpD,QAAMC,mBAAmBC,IAAAA;AACzB,QAAMC,eAAeJ,IAAIK,MAAMH,gBAAAA,EAAkB,CAAA;AACjD,MAA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kBAAkBJ,MAAM1D,SAAS,MAAM,UAAU0D,MAAM1D,SAAS,MAAO,WAAW;AACxF,QAAM+D,WAAWX,KAAKC,IAAG,IAAKF;AAC9B,QAAMa,gBAAgBD,WAAW,MAAO,UAAUA,WAAW,MAAO,WAAW;AAC/E9D,UAAQC,IAAIC,MAAMM,MAAM,UAAUN,MAAM2D,eAAAA,EAAiBJ,MAAM1D,MAAM,CAAA,aAAcG,MAAM6D,aAAAA,EAAeD,QAAAA,CAAAA,IAAa,CAAA;AACrH,SAAOpE,YAAYsE,OAAO,CAACC,MAAMpE,eAAeoE,OAAOpE,WAAWqE,YAAY,CAAA;AAChF,GA9B2B;;;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","start","Date","now","engine","ESLint","baseConfig","warnIgnored","files","green","lintFiles","outputFixes","filesCountColor","lintTime","lintTimeColor","reduce","prev","errorCount","packageLint","then","value","process","exit","catch","reason","console","error","chalk","red"]}
|
package/dist/index.mjs
CHANGED
|
@@ -2197,10 +2197,10 @@ function getFiles(dir, ignoreFolders) {
|
|
|
2197
2197
|
}
|
|
2198
2198
|
__name(getFiles, "getFiles");
|
|
2199
2199
|
var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, cache = true) => {
|
|
2200
|
-
const start = Date.now();
|
|
2201
2200
|
const pkg = process.env.INIT_CWD;
|
|
2202
2201
|
const configPath = await getRootESLintConfig();
|
|
2203
2202
|
const { default: eslintConfig } = await import(configPath.href);
|
|
2203
|
+
const start = Date.now();
|
|
2204
2204
|
const ignoreFolders = [
|
|
2205
2205
|
"node_modules",
|
|
2206
2206
|
"dist",
|
|
@@ -2228,7 +2228,10 @@ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, c
|
|
|
2228
2228
|
if (fix2) {
|
|
2229
2229
|
await ESLint2.outputFixes(lintResults);
|
|
2230
2230
|
}
|
|
2231
|
-
|
|
2231
|
+
const filesCountColor = files.length < 100 ? "green" : files.length < 1e3 ? "yellow" : "red";
|
|
2232
|
+
const lintTime = Date.now() - start;
|
|
2233
|
+
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2234
|
+
console.log(chalk29.white(`Linted ${chalk29[filesCountColor](files.length)} files in ${chalk29[lintTimeColor](lintTime)}ms`));
|
|
2232
2235
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2233
2236
|
}, "packageLint");
|
|
2234
2237
|
|