@xylabs/ts-scripts-yarn3 5.1.7 → 5.1.8
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 +26 -21
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/package/index.mjs +26 -21
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/lint.mjs +26 -21
- package/dist/actions/package/lint.mjs.map +1 -1
- package/dist/bin/package/fix.mjs +26 -21
- package/dist/bin/package/fix.mjs.map +1 -1
- package/dist/bin/package/lint.mjs +26 -21
- package/dist/bin/package/lint.mjs.map +1 -1
- package/dist/index.mjs +26 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -4
- package/src/actions/package/lint.ts +26 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/ts-scripts-yarn3",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.8",
|
|
4
4
|
"description": "TypeScript project scripts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xylabs",
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
"@swc/core": "^1.11.5",
|
|
94
94
|
"@types/node": "^22.13.5",
|
|
95
95
|
"@types/yargs": "^17.0.33",
|
|
96
|
-
"@xylabs/tsconfig": "^5.1.
|
|
97
|
-
"@xylabs/tsconfig-dom": "^5.1.
|
|
96
|
+
"@xylabs/tsconfig": "^5.1.8",
|
|
97
|
+
"@xylabs/tsconfig-dom": "^5.1.8",
|
|
98
98
|
"async-mutex": "^0.5.0",
|
|
99
99
|
"chalk": "^5.4.1",
|
|
100
100
|
"cosmiconfig": "^9.0.0",
|
|
@@ -113,6 +113,7 @@
|
|
|
113
113
|
"npm-package-json-lint": "^8.0.0",
|
|
114
114
|
"npm-package-json-lint-config-default": "^7.0.1",
|
|
115
115
|
"parse-git-config": "^3.0.0",
|
|
116
|
+
"picomatch": "^4.0.2",
|
|
116
117
|
"publint": "^0.3.7",
|
|
117
118
|
"reflect-metadata": "^0.2.2",
|
|
118
119
|
"rollup": "^4.34.8",
|
|
@@ -134,7 +135,8 @@
|
|
|
134
135
|
"@types/eslint": "^9.6.1",
|
|
135
136
|
"@types/license-checker": "^25.0.6",
|
|
136
137
|
"@types/parse-git-config": "^3.0.4",
|
|
137
|
-
"@
|
|
138
|
+
"@types/picomatch": "^3.0.2",
|
|
139
|
+
"@xylabs/tsconfig": "^5.1.8",
|
|
138
140
|
"publint": "^0.3.7",
|
|
139
141
|
"rimraf": "^6.0.1",
|
|
140
142
|
"typescript": "^5.7.3"
|
|
@@ -6,6 +6,7 @@ import { pathToFileURL } from 'node:url'
|
|
|
6
6
|
import chalk from 'chalk'
|
|
7
7
|
import { ESLint } from 'eslint'
|
|
8
8
|
import { findUp } from 'find-up'
|
|
9
|
+
import picomatch from 'picomatch'
|
|
9
10
|
|
|
10
11
|
const dumpMessages = (lintResults: ESLint.LintResult[]) => {
|
|
11
12
|
const colors: ('white' | 'red' | 'yellow')[] = ['white', 'yellow', 'red']
|
|
@@ -37,33 +38,38 @@ async function getRootESLintConfig() {
|
|
|
37
38
|
return pathToFileURL(configPath)
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
41
|
+
function getFiles(dir: string, ignoreFolders: string[]): string[] {
|
|
42
|
+
const currentDirectory = cwd()
|
|
43
|
+
return readdirSync(dir, { withFileTypes: true })
|
|
44
|
+
.flatMap((dirent) => {
|
|
45
|
+
const res = path.resolve(dir, dirent.name)
|
|
46
|
+
const subDirectory = dir.split(currentDirectory)[1]
|
|
47
|
+
const relativePath = subDirectory ? `${subDirectory}/${dirent.name}` : dirent.name
|
|
43
48
|
|
|
44
|
-
|
|
45
|
-
const ignoreFolders = new Set(['node_modules', 'dist', 'packages'])
|
|
49
|
+
const ignoreMatchers = ignoreFolders.map(pattern => picomatch(pattern))
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
.flatMap((dirent) => {
|
|
50
|
-
const res = path.resolve(dir, dirent.name)
|
|
51
|
+
// Exclude ignored paths
|
|
52
|
+
if (ignoreMatchers.some(isMatch => isMatch(relativePath))) return []
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
return dirent.isDirectory()
|
|
55
|
+
? getFiles(res, ignoreFolders)
|
|
56
|
+
: [res]
|
|
57
|
+
})
|
|
58
|
+
}
|
|
54
59
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
})
|
|
59
|
-
}
|
|
60
|
+
export const packageLint = async (fix = false) => {
|
|
61
|
+
const configPath = await getRootESLintConfig()
|
|
62
|
+
const { default: eslintConfig } = await import(configPath.href)
|
|
60
63
|
|
|
61
|
-
|
|
64
|
+
// List of folders to ignore
|
|
65
|
+
const ignoreFolders = ['node_modules', 'dist', 'packages', '.git', 'build']
|
|
62
66
|
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
const engine = new ESLint({
|
|
68
|
+
baseConfig: [...eslintConfig], fix, warnIgnored: false,
|
|
69
|
+
})
|
|
65
70
|
|
|
66
|
-
const
|
|
71
|
+
const files = getFiles(cwd(), ignoreFolders)
|
|
72
|
+
const lintResults = await engine.lintFiles(files)
|
|
67
73
|
|
|
68
74
|
dumpMessages(lintResults)
|
|
69
75
|
|