aislop 0.2.0 → 0.3.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/README.md +88 -38
- package/dist/cli.js +797 -187
- package/dist/{engine-info-DpU0WTTj.js → engine-info-CXT2Q_Jy.js} +1 -1
- package/dist/{expo-doctor-CGXGLgMJ.js → expo-doctor-Cm5892Y8.js} +76 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2921 -2453
- package/dist/{json-UG8l_sLC.js → json-C52xnH_4.js} +1 -1
- package/package.json +1 -1
- package/dist/expo-doctor-vDz4kh9-.js +0 -127
- package/dist/subprocess-99puEEGl.js +0 -59
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Application version — injected at build time by tsdown from package.json.
|
|
4
4
|
* The fallback should always match the "version" field in package.json.
|
|
5
5
|
*/
|
|
6
|
-
const APP_VERSION = "0.
|
|
6
|
+
const APP_VERSION = "0.3.0";
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/output/engine-info.ts
|
|
@@ -1,9 +1,83 @@
|
|
|
1
|
-
import { n as runSubprocess } from "./subprocess-99puEEGl.js";
|
|
2
1
|
import { createRequire } from "node:module";
|
|
3
2
|
import fs from "node:fs";
|
|
4
3
|
import path from "node:path";
|
|
4
|
+
import { spawn } from "node:child_process";
|
|
5
5
|
|
|
6
|
+
//#region \0rolldown/runtime.js
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __exportAll = (all, no_symbols) => {
|
|
9
|
+
let target = {};
|
|
10
|
+
for (var name in all) {
|
|
11
|
+
__defProp(target, name, {
|
|
12
|
+
get: all[name],
|
|
13
|
+
enumerable: true
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
if (!no_symbols) {
|
|
17
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
|
+
}
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/utils/subprocess.ts
|
|
24
|
+
const runSubprocess = (command, args, options = {}) => {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
const child = spawn(command, args, {
|
|
27
|
+
cwd: options.cwd,
|
|
28
|
+
env: {
|
|
29
|
+
...process.env,
|
|
30
|
+
...options.env
|
|
31
|
+
},
|
|
32
|
+
stdio: [
|
|
33
|
+
"ignore",
|
|
34
|
+
"pipe",
|
|
35
|
+
"pipe"
|
|
36
|
+
],
|
|
37
|
+
windowsHide: true
|
|
38
|
+
});
|
|
39
|
+
const stdoutBuffers = [];
|
|
40
|
+
const stderrBuffers = [];
|
|
41
|
+
child.stdout?.on("data", (buffer) => stdoutBuffers.push(buffer));
|
|
42
|
+
child.stderr?.on("data", (buffer) => stderrBuffers.push(buffer));
|
|
43
|
+
let settled = false;
|
|
44
|
+
let timer;
|
|
45
|
+
const finalize = (callback) => {
|
|
46
|
+
if (settled) return;
|
|
47
|
+
settled = true;
|
|
48
|
+
if (timer) clearTimeout(timer);
|
|
49
|
+
callback();
|
|
50
|
+
};
|
|
51
|
+
if (options.timeout && options.timeout > 0) {
|
|
52
|
+
timer = setTimeout(() => {
|
|
53
|
+
child.kill("SIGTERM");
|
|
54
|
+
setTimeout(() => child.kill("SIGKILL"), 1e3).unref();
|
|
55
|
+
finalize(() => reject(/* @__PURE__ */ new Error(`Command timed out after ${options.timeout}ms: ${command}`)));
|
|
56
|
+
}, options.timeout);
|
|
57
|
+
timer.unref();
|
|
58
|
+
}
|
|
59
|
+
child.once("error", (error) => finalize(() => reject(/* @__PURE__ */ new Error(`Failed to run ${command}: ${error.message}`))));
|
|
60
|
+
child.once("close", (code) => {
|
|
61
|
+
finalize(() => resolve({
|
|
62
|
+
stdout: Buffer.concat(stdoutBuffers).toString("utf-8").trim(),
|
|
63
|
+
stderr: Buffer.concat(stderrBuffers).toString("utf-8").trim(),
|
|
64
|
+
exitCode: code
|
|
65
|
+
}));
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
const isToolInstalled = async (tool) => {
|
|
70
|
+
try {
|
|
71
|
+
const result = await runSubprocess("which", [tool]);
|
|
72
|
+
return result.exitCode === 0 && result.stdout.length > 0;
|
|
73
|
+
} catch {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
6
79
|
//#region src/engines/lint/expo-doctor.ts
|
|
80
|
+
var expo_doctor_exports = /* @__PURE__ */ __exportAll({ runExpoDoctor: () => runExpoDoctor });
|
|
7
81
|
const esmRequire = createRequire(import.meta.url);
|
|
8
82
|
const ISSUE_PREFIX = "✖ ";
|
|
9
83
|
const resolveExpoDoctorScript = () => {
|
|
@@ -123,4 +197,4 @@ const runExpoDoctor = async (context) => {
|
|
|
123
197
|
};
|
|
124
198
|
|
|
125
199
|
//#endregion
|
|
126
|
-
export { runExpoDoctor };
|
|
200
|
+
export { runSubprocess as i, runExpoDoctor as n, isToolInstalled as r, expo_doctor_exports as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ declare const loadConfig: (directory: string) => AislopConfig;
|
|
|
50
50
|
//#region src/commands/fix.d.ts
|
|
51
51
|
interface FixOptions {
|
|
52
52
|
verbose: boolean;
|
|
53
|
+
force?: boolean;
|
|
53
54
|
showHeader?: boolean;
|
|
54
55
|
}
|
|
55
56
|
declare const fixCommand: (directory: string, config: AislopConfig, options?: FixOptions) => Promise<void>;
|