@baic/yolk-cli 2.1.0-alpha.233 → 2.1.0-alpha.235
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/es/_util.js +105 -1
- package/es/index.js +11 -1
- package/es/lintstagedrc.js +61 -0
- package/es/yolk.js +479 -1
- package/lib/_util.js +132 -1
- package/lib/index.js +4 -1
- package/lib/lintstagedrc.js +49 -0
- package/lib/yolk.js +458 -1
- package/package.json +24 -23
- package/templates/miniprogram/.gitignore.tpl +0 -3
- package/templates/umi-mobile/.gitignore.tpl +0 -3
- package/templates/umi-mobile-h5+app/.gitignore.tpl +0 -3
- package/templates/umi-mobile-native/.gitignore.tpl +0 -3
- package/templates/umi-mobile-uni-app/.gitignore.tpl +0 -3
- package/templates/umi-web/.gitignore.tpl +0 -3
- package/templates/umi-web-screen/.gitignore.tpl +0 -3
- package/es/.lintstagedrc.js +0 -76
- package/es/.prettierrc.js +0 -24
- package/lib/.lintstagedrc.js +0 -76
- package/lib/.prettierrc.js +0 -24
package/es/_util.js
CHANGED
|
@@ -1 +1,105 @@
|
|
|
1
|
-
|
|
1
|
+
var m = /* @__PURE__ */ ((t) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(t, {
|
|
2
|
+
get: (e, o) => (typeof require < "u" ? require : e)[o]
|
|
3
|
+
}) : t)(function(t) {
|
|
4
|
+
if (typeof require < "u")
|
|
5
|
+
return require.apply(this, arguments);
|
|
6
|
+
throw new Error('Dynamic require of "' + t + '" is not supported');
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
// src/_util.ts
|
|
10
|
+
import { spawn as k } from "node:child_process";
|
|
11
|
+
import r from "node:fs";
|
|
12
|
+
import a from "node:path";
|
|
13
|
+
import c from "chalk";
|
|
14
|
+
import { globSync as x } from "glob";
|
|
15
|
+
import {
|
|
16
|
+
rimrafSync as u,
|
|
17
|
+
windowsSync as d
|
|
18
|
+
} from "rimraf";
|
|
19
|
+
import { program as h } from "../compiled/commander";
|
|
20
|
+
var i = process.cwd(), l = console, p = "utf-8", C = (t) => t && l.log(c.yellow("warn -"), t), P = (t) => t && l.log(c.red("error -"), t), j = (t) => t && l.log(c.green("ready -"), t), _ = (t) => t && l.log(c.blue("info -"), t), S = () => process.platform === "win32", N = (t) => S() ? `${t}.cmd` : t, $ = (t) => S() ? d(t) : u(t), b = () => {
|
|
21
|
+
j("yolk complete!"), process.exit(0);
|
|
22
|
+
}, w = () => {
|
|
23
|
+
C("yolk break!"), process.exit(0);
|
|
24
|
+
}, G = ({
|
|
25
|
+
command: t,
|
|
26
|
+
args: e,
|
|
27
|
+
complete: o,
|
|
28
|
+
close: n,
|
|
29
|
+
exit: s = !0
|
|
30
|
+
}) => {
|
|
31
|
+
let f = k(N(t), e || [], {
|
|
32
|
+
stdio: "inherit"
|
|
33
|
+
}).on("close", (y) => {
|
|
34
|
+
y ? (n && n(), P("yolk close!"), process.exit(y)) : (o && o(), s && b());
|
|
35
|
+
});
|
|
36
|
+
process.on("SIGINT", () => {
|
|
37
|
+
h.exitOverride(), f.kill(), w();
|
|
38
|
+
});
|
|
39
|
+
}, O = () => {
|
|
40
|
+
let t = x("*.yolkrc*", {
|
|
41
|
+
cwd: i,
|
|
42
|
+
dot: !0
|
|
43
|
+
});
|
|
44
|
+
if (!t.length)
|
|
45
|
+
return {};
|
|
46
|
+
let e = a.join(i, t[0]);
|
|
47
|
+
if (r.existsSync(e))
|
|
48
|
+
try {
|
|
49
|
+
return JSON.parse(r.readFileSync(e, p)) || {};
|
|
50
|
+
} catch (o) {
|
|
51
|
+
return o(o.message || ".yolkrc转换错误"), {};
|
|
52
|
+
}
|
|
53
|
+
else
|
|
54
|
+
return {};
|
|
55
|
+
}, q = () => {
|
|
56
|
+
let t = a.join(i, "project.config.json");
|
|
57
|
+
if (r.existsSync(t))
|
|
58
|
+
try {
|
|
59
|
+
return JSON.parse(r.readFileSync(t, p)) || {};
|
|
60
|
+
} catch (e) {
|
|
61
|
+
return e(e.message || "project.config.json转换错误"), {};
|
|
62
|
+
}
|
|
63
|
+
else
|
|
64
|
+
return {};
|
|
65
|
+
}, B = () => {
|
|
66
|
+
let t = a.join(i, "package.json");
|
|
67
|
+
if (r.existsSync(t))
|
|
68
|
+
try {
|
|
69
|
+
return JSON.parse(r.readFileSync(t, p)) || {};
|
|
70
|
+
} catch (e) {
|
|
71
|
+
return e(e.message || "package.json转换错误"), {};
|
|
72
|
+
}
|
|
73
|
+
else
|
|
74
|
+
return {};
|
|
75
|
+
}, g = (t) => {
|
|
76
|
+
let e = O(), o = "";
|
|
77
|
+
try {
|
|
78
|
+
o = m.resolve(`@baic/${t}-config-yolk`);
|
|
79
|
+
} catch {
|
|
80
|
+
}
|
|
81
|
+
let n = x(`*.${t}rc*`, {
|
|
82
|
+
cwd: i,
|
|
83
|
+
dot: !0
|
|
84
|
+
}), s = n == null ? void 0 : n[0];
|
|
85
|
+
return e.strict === !1 && s && r.existsSync(s) ? s : r.existsSync(o) ? o : s;
|
|
86
|
+
}, D = () => g("eslint"), T = () => g("stylelint"), W = () => g("prettier"), z = () => g("biome");
|
|
87
|
+
export {
|
|
88
|
+
p as ENCODING,
|
|
89
|
+
w as breakExit,
|
|
90
|
+
b as completeExit,
|
|
91
|
+
P as error,
|
|
92
|
+
G as execCommand,
|
|
93
|
+
z as getBiomeConfigPath,
|
|
94
|
+
g as getConfigFilePath,
|
|
95
|
+
D as getEsLintConfigPath,
|
|
96
|
+
B as getPackageJSON,
|
|
97
|
+
W as getPrettierConfigPath,
|
|
98
|
+
q as getProjectConfigJSON,
|
|
99
|
+
T as getStyleLintConfigPath,
|
|
100
|
+
O as getYolkConfig,
|
|
101
|
+
_ as info,
|
|
102
|
+
j as ready,
|
|
103
|
+
$ as rimrafSync,
|
|
104
|
+
C as warn
|
|
105
|
+
};
|
package/es/index.js
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
|
-
require
|
|
2
|
+
var r = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, {
|
|
3
|
+
get: (i, n) => (typeof require < "u" ? require : i)[n]
|
|
4
|
+
}) : e)(function(e) {
|
|
5
|
+
if (typeof require < "u")
|
|
6
|
+
return require.apply(this, arguments);
|
|
7
|
+
throw new Error('Dynamic require of "' + e + '" is not supported');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// src/index.ts
|
|
11
|
+
r("../compiled/v8-compile-cache");
|
|
12
|
+
r("./yolk");
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var i = /* @__PURE__ */ ((t) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(t, {
|
|
2
|
+
get: (e, p) => (typeof require < "u" ? require : e)[p]
|
|
3
|
+
}) : t)(function(t) {
|
|
4
|
+
if (typeof require < "u")
|
|
5
|
+
return require.apply(this, arguments);
|
|
6
|
+
throw new Error('Dynamic require of "' + t + '" is not supported');
|
|
7
|
+
});
|
|
8
|
+
var u = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports);
|
|
9
|
+
|
|
10
|
+
// src/lintstagedrc.js
|
|
11
|
+
var b = u((P, h) => {
|
|
12
|
+
var { join: n } = i("node:path"), {
|
|
13
|
+
getYolkConfig: m,
|
|
14
|
+
getEsLintConfigPath: f,
|
|
15
|
+
getStyleLintConfigPath: $,
|
|
16
|
+
getPrettierConfigPath: d,
|
|
17
|
+
getBiomeConfigPath: y
|
|
18
|
+
} = i("./_util"), l = [
|
|
19
|
+
"**/node_modules/**",
|
|
20
|
+
"**/build/**",
|
|
21
|
+
"**/dist/**",
|
|
22
|
+
"**/lib/**",
|
|
23
|
+
"**/es/**",
|
|
24
|
+
"**/mock/**",
|
|
25
|
+
"**/test/**",
|
|
26
|
+
"**/public/**",
|
|
27
|
+
"**/assets/**",
|
|
28
|
+
"**/.umi/**",
|
|
29
|
+
"**/.umi-production/**",
|
|
30
|
+
"**/h5+app/**",
|
|
31
|
+
"**/*uni*/**",
|
|
32
|
+
"**/android/**",
|
|
33
|
+
"**/ios/**",
|
|
34
|
+
"**/*.ignore/**"
|
|
35
|
+
], j = m(), g = j.strict !== !1, c = n(process.cwd(), "node_modules", ".cache"), s = `prettier --write --cache --cache-strategy=content --cache-location=${n(
|
|
36
|
+
c,
|
|
37
|
+
".prettiercache"
|
|
38
|
+
)} --config ${d()} --no-error-on-unmatched-pattern`, r = `eslint --fix ${g ? "--no-inline-config" : ""} --no-error-on-unmatched-pattern --cache --cache-strategy=content --cache-location=${n(
|
|
39
|
+
c,
|
|
40
|
+
".eslintcache"
|
|
41
|
+
)} --config ${f()} ${l.map((t) => `--ignore-pattern ${t}`).join(" ")}`, o = `stylelint --fix ${g ? "--ignore-disables" : ""} --allow-empty-input --cache --cache-strategy=content --cache-location=${n(
|
|
42
|
+
c,
|
|
43
|
+
".stylelintcache"
|
|
44
|
+
)} --config ${$()} ${l.map((t) => `--ignore-pattern ${t}`).join(" ")}`, C = `biome check --write --unsafe --no-errors-on-unmatched --log-level=error --files-ignore-unknown=true --config-path=${y()}`, a = {
|
|
45
|
+
"*.{md,json,jsonc}": [s],
|
|
46
|
+
// '*.{png,jpeg,jpg,gif,svg}': ['imagemin-lint-staged'],
|
|
47
|
+
"*.css": [s, `${o} --custom-syntax postcss`],
|
|
48
|
+
"*.less": [s, `${o} --custom-syntax postcss-less`],
|
|
49
|
+
"*.{sass,scss}": [
|
|
50
|
+
s,
|
|
51
|
+
`${o} --custom-syntax postcss-scss`
|
|
52
|
+
],
|
|
53
|
+
"*.{js,jsx,cjs,mjs}": [s, r],
|
|
54
|
+
"*.{ts,tsx,cts,mts}": [`${s} --parser=typescript`, r]
|
|
55
|
+
}, x = {
|
|
56
|
+
...a,
|
|
57
|
+
[`!(${Object.keys(a).join("|")})`]: [C]
|
|
58
|
+
};
|
|
59
|
+
h.exports = x;
|
|
60
|
+
});
|
|
61
|
+
export default b();
|