@aklinker1/check 2.1.1 → 2.2.0
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/cli.js +2 -2
- package/dist/index.js +1 -1
- package/dist/{src-D3TrACF9.js → src-DLILuPNJ.js} +39 -71
- package/package.json +3 -2
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { i as ALL_TOOLS, t as check } from "./src-
|
|
1
|
+
import { i as ALL_TOOLS, t as check } from "./src-DLILuPNJ.js";
|
|
2
2
|
import { isCI } from "ci-info";
|
|
3
3
|
|
|
4
4
|
//#region package.json
|
|
5
|
-
var version = "2.
|
|
5
|
+
var version = "2.2.0";
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/cli.ts
|
package/dist/index.js
CHANGED
|
@@ -5,9 +5,9 @@ import { join, relative, resolve, sep } from "node:path";
|
|
|
5
5
|
import { readFile } from "node:fs/promises";
|
|
6
6
|
|
|
7
7
|
//#region src/utils.ts
|
|
8
|
-
function exec(cmd,
|
|
8
|
+
function exec(cmd, opts) {
|
|
9
9
|
return new Promise((resolve$1, reject) => {
|
|
10
|
-
const child = spawn(cmd,
|
|
10
|
+
const child = spawn(cmd, {
|
|
11
11
|
...opts,
|
|
12
12
|
shell: true
|
|
13
13
|
});
|
|
@@ -31,12 +31,11 @@ function exec(cmd, args, opts) {
|
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
async function execAndParse(
|
|
35
|
-
const res = await exec(
|
|
34
|
+
async function execAndParse(cmd, cwd, parser) {
|
|
35
|
+
const res = await exec(cmd, { cwd });
|
|
36
36
|
if (res.exitCode == null) throw Error("Exit code was null");
|
|
37
37
|
if (isDebug()) console.debug({
|
|
38
|
-
|
|
39
|
-
args,
|
|
38
|
+
cmd,
|
|
40
39
|
cwd,
|
|
41
40
|
...res
|
|
42
41
|
});
|
|
@@ -67,22 +66,13 @@ function debug(message) {
|
|
|
67
66
|
//#endregion
|
|
68
67
|
//#region src/tools/eslint.ts
|
|
69
68
|
const eslint = ({ root }) => {
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
".",
|
|
73
|
-
"--ext",
|
|
74
|
-
".js,.ts,.jsx,.tsx,.mjs,.mts,.cjs,.cts,.vue",
|
|
75
|
-
"--format",
|
|
76
|
-
"compact",
|
|
77
|
-
"--max-warnings",
|
|
78
|
-
"0"
|
|
79
|
-
];
|
|
80
|
-
const fixArgs = [...checkArgs, "--fix"];
|
|
69
|
+
const checkCmd = `eslint . --ext .js,.ts,.jsx,.tsx,.mjs,.mts,.cjs,.cts,.vue --format compact --max-warnings 0`;
|
|
70
|
+
const fixCmd = `${checkCmd} --fix`;
|
|
81
71
|
return {
|
|
82
72
|
name: "ESLint",
|
|
83
73
|
packageName: "eslint",
|
|
84
|
-
check: () => execAndParse(
|
|
85
|
-
fix: () => execAndParse(
|
|
74
|
+
check: () => execAndParse(checkCmd, root, parseOutput$5),
|
|
75
|
+
fix: () => execAndParse(fixCmd, root, parseOutput$5)
|
|
86
76
|
};
|
|
87
77
|
};
|
|
88
78
|
const parseOutput$5 = ({ stdout, stderr }) => {
|
|
@@ -105,21 +95,13 @@ const parseOutput$5 = ({ stdout, stderr }) => {
|
|
|
105
95
|
//#endregion
|
|
106
96
|
//#region src/tools/markdownlint.ts
|
|
107
97
|
const markdownlint = ({ root }) => {
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
".",
|
|
111
|
-
"--json",
|
|
112
|
-
"--ignore='**/dist/**'",
|
|
113
|
-
"--ignore='**/node_modules/**'",
|
|
114
|
-
"--ignore='**/.output/**'",
|
|
115
|
-
"--ignore='**/coverage/**'"
|
|
116
|
-
];
|
|
117
|
-
const fixArgs = [...checkArgs, "--fix"];
|
|
98
|
+
const checkCmd = "markdownlint . --json --ignore='**/dist/**' --ignore='**/node_modules/**' --ignore='**/.output/**' --ignore='**/coverage/**'";
|
|
99
|
+
const fixCmd = `${checkCmd} --fix`;
|
|
118
100
|
return {
|
|
119
101
|
name: "Markdownlint",
|
|
120
102
|
packageName: "markdownlint-cli",
|
|
121
|
-
check: () => execAndParse(
|
|
122
|
-
fix: () => execAndParse(
|
|
103
|
+
check: () => execAndParse(checkCmd, root, parseOutput$4),
|
|
104
|
+
fix: () => execAndParse(fixCmd, root, parseOutput$4)
|
|
123
105
|
};
|
|
124
106
|
};
|
|
125
107
|
const parseOutput$4 = ({ stderr: _stderr }) => {
|
|
@@ -140,22 +122,13 @@ const parseOutput$4 = ({ stderr: _stderr }) => {
|
|
|
140
122
|
//#endregion
|
|
141
123
|
//#region src/tools/oxlint.ts
|
|
142
124
|
const oxlint = ({ root }) => {
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
"--format=unix",
|
|
146
|
-
"--deny-warnings",
|
|
147
|
-
"--ignore-path=.oxlintignore",
|
|
148
|
-
"--ignore-pattern='**/dist/**'",
|
|
149
|
-
"--ignore-pattern='**/node_modules/**'",
|
|
150
|
-
"--ignore-pattern='**/.output/**'",
|
|
151
|
-
"--ignore-pattern='**/coverage/**'"
|
|
152
|
-
];
|
|
153
|
-
const fixArgs = [...checkArgs, "--fix"];
|
|
125
|
+
const checkCmd = "oxlint . --format=unix --deny-warnings --ignore-path=.oxlintignore --ignore-pattern='**/dist/**' --ignore-pattern='**/node_modules/**' --ignore-pattern='**/.output/**' --ignore-pattern='**/coverage/**'";
|
|
126
|
+
const fixCmd = `${checkCmd} --fix`;
|
|
154
127
|
return {
|
|
155
128
|
name: "Oxlint",
|
|
156
129
|
packageName: "oxlint",
|
|
157
|
-
check: () => execAndParse(
|
|
158
|
-
fix: () => execAndParse(
|
|
130
|
+
check: () => execAndParse(checkCmd, root, parseOutput$3),
|
|
131
|
+
fix: () => execAndParse(fixCmd, root, parseOutput$3)
|
|
159
132
|
};
|
|
160
133
|
};
|
|
161
134
|
const parseOutput$3 = ({ stdout }) => {
|
|
@@ -183,14 +156,13 @@ const parseOutput$3 = ({ stdout }) => {
|
|
|
183
156
|
//#endregion
|
|
184
157
|
//#region src/tools/prettier.ts
|
|
185
158
|
const prettier = ({ root }) => {
|
|
186
|
-
const
|
|
187
|
-
const
|
|
188
|
-
const fixArgs = [".", "-w"];
|
|
159
|
+
const checkCmd = "prettier . --list-different";
|
|
160
|
+
const fixCmd = "prettier . -w";
|
|
189
161
|
return {
|
|
190
162
|
name: "Prettier",
|
|
191
163
|
packageName: "prettier",
|
|
192
|
-
check: () => execAndParse(
|
|
193
|
-
fix: () => execAndParse(
|
|
164
|
+
check: () => execAndParse(checkCmd, root, parseOutput$2),
|
|
165
|
+
fix: () => execAndParse(fixCmd, root, parseOutput$2)
|
|
194
166
|
};
|
|
195
167
|
};
|
|
196
168
|
const parseOutput$2 = ({ stdout, stderr }) => {
|
|
@@ -217,12 +189,11 @@ const parseOutput$2 = ({ stdout, stderr }) => {
|
|
|
217
189
|
//#endregion
|
|
218
190
|
//#region src/tools/publint.ts
|
|
219
191
|
const publint = ({ root }) => {
|
|
220
|
-
const
|
|
221
|
-
const args = [];
|
|
192
|
+
const cmd = "publint";
|
|
222
193
|
return {
|
|
223
194
|
name: "Publint",
|
|
224
195
|
packageName: "publint",
|
|
225
|
-
check: () => execAndParse(
|
|
196
|
+
check: () => execAndParse(cmd, root, parseOutput$1)
|
|
226
197
|
};
|
|
227
198
|
};
|
|
228
199
|
const parseOutput$1 = ({ stdout }) => {
|
|
@@ -248,31 +219,28 @@ const parseOutput$1 = ({ stdout }) => {
|
|
|
248
219
|
const typescript = async ({ root, packageJson }) => {
|
|
249
220
|
const tsc = {
|
|
250
221
|
name: "TypeScript",
|
|
251
|
-
|
|
252
|
-
packageName: "typescript"
|
|
253
|
-
args: [
|
|
254
|
-
"--noEmit",
|
|
255
|
-
"--pretty",
|
|
256
|
-
"false"
|
|
257
|
-
]
|
|
222
|
+
cmd: "tsc --noEmit --pretty false",
|
|
223
|
+
packageName: "typescript"
|
|
258
224
|
};
|
|
259
225
|
const vueTsc = {
|
|
260
226
|
name: "TypeScript (Vue)",
|
|
261
|
-
|
|
262
|
-
packageName: "vue-tsc"
|
|
263
|
-
args: [
|
|
264
|
-
"--noEmit",
|
|
265
|
-
"--pretty",
|
|
266
|
-
"false"
|
|
267
|
-
]
|
|
227
|
+
cmd: "vue-tsc --noEmit --pretty false",
|
|
228
|
+
packageName: "vue-tsc"
|
|
268
229
|
};
|
|
269
|
-
const
|
|
230
|
+
const tsgo = {
|
|
231
|
+
name: "TypeScript (Go)",
|
|
232
|
+
cmd: "tsgo --noEmit --pretty false",
|
|
233
|
+
packageName: "@typescript/native-preview"
|
|
234
|
+
};
|
|
235
|
+
const isVueTsc = packageJson.devDependencies?.[vueTsc.packageName] !== void 0;
|
|
236
|
+
const isTsgo = packageJson.devDependencies?.[tsgo.packageName] !== void 0;
|
|
270
237
|
debug("TypeScript: Is vue-tsc installed? " + isVueTsc);
|
|
271
|
-
|
|
238
|
+
debug("TypeScript: Is tsgo installed? " + isTsgo);
|
|
239
|
+
const mod = isVueTsc ? vueTsc : isTsgo ? tsgo : tsc;
|
|
272
240
|
return {
|
|
273
|
-
name:
|
|
274
|
-
packageName:
|
|
275
|
-
check: async () => execAndParse(
|
|
241
|
+
name: mod.name,
|
|
242
|
+
packageName: mod.packageName,
|
|
243
|
+
check: async () => execAndParse(mod.cmd, root, parseOutput)
|
|
276
244
|
};
|
|
277
245
|
};
|
|
278
246
|
const parseOutput = ({ stdout }) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aklinker1/check",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"packageManager": "bun@1.3.
|
|
3
|
+
"version": "2.2.0",
|
|
4
|
+
"packageManager": "bun@1.3.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "tsdown src/index.ts src/cli.ts",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/bun": "latest",
|
|
17
|
+
"@typescript/native-preview": "^7.0.0-dev.20251114.1",
|
|
17
18
|
"oxlint": "^1.22.0",
|
|
18
19
|
"publint": "^0.3.14",
|
|
19
20
|
"tsdown": "^0.15.9",
|