@aklinker1/check 1.3.0 → 1.3.1
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/index.mjs +21 -6
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,23 +1,38 @@
|
|
|
1
1
|
import { ALL_TOOLS } from "./tools/index.mjs";
|
|
2
2
|
import { p } from "@antfu/utils";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
bold,
|
|
5
|
+
cyan,
|
|
6
|
+
debug as debugLog,
|
|
7
|
+
dim,
|
|
8
|
+
humanMs,
|
|
9
|
+
isDebug,
|
|
10
|
+
red,
|
|
11
|
+
yellow
|
|
12
|
+
} from "./utils.mjs";
|
|
4
13
|
import { createTaskList } from "./tasklist/index.mjs";
|
|
5
14
|
import { relative, resolve, sep } from "node:path";
|
|
6
15
|
import { isCI } from "ci-info";
|
|
7
16
|
export async function check(options = {}) {
|
|
8
17
|
const {
|
|
9
|
-
debug
|
|
18
|
+
debug,
|
|
10
19
|
fix = !isCI,
|
|
11
20
|
root = process.cwd(),
|
|
12
21
|
binDir = "node_modules/.bin"
|
|
13
22
|
} = options;
|
|
14
|
-
if (
|
|
23
|
+
if (debug) {
|
|
15
24
|
process.env.DEBUG = "true";
|
|
16
25
|
}
|
|
17
26
|
console.log();
|
|
27
|
+
debugLog("Options:" + JSON.stringify(options));
|
|
28
|
+
debugLog("Resolved options:" + JSON.stringify({ debug, fix, root, binDir }));
|
|
18
29
|
const tools = await findInstalledTools({ root, binDir });
|
|
19
30
|
if (tools.length === 0) {
|
|
20
|
-
|
|
31
|
+
if (isDebug()) {
|
|
32
|
+
console.log("No tools detected!");
|
|
33
|
+
} else {
|
|
34
|
+
console.log("No tools detected! Run with --debug for more info");
|
|
35
|
+
}
|
|
21
36
|
console.log();
|
|
22
37
|
process.exit(1);
|
|
23
38
|
}
|
|
@@ -94,9 +109,9 @@ async function findInstalledTools(opts) {
|
|
|
94
109
|
if (isDebug()) {
|
|
95
110
|
const getTools = (isInstalled) => status.filter((item) => item.isInstalled === isInstalled).map((item) => item.tool.name).join(", ");
|
|
96
111
|
const installed = getTools(true);
|
|
97
|
-
|
|
112
|
+
debugLog(`Installed: ${installed || "(none)"}`);
|
|
98
113
|
const skipped = getTools(false);
|
|
99
|
-
|
|
114
|
+
debugLog(`Skipping: ${skipped || "(none)"} `);
|
|
100
115
|
}
|
|
101
116
|
return status.filter(({ isInstalled }) => isInstalled).map((item) => item.tool);
|
|
102
117
|
}
|