@baic/yolk-cli 2.1.0-alpha.235 → 2.1.0-alpha.236
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 +1 -1
- package/es/_util.js +1 -105
- package/es/index.js +1 -11
- package/es/lintstagedrc.js +1 -61
- package/es/yolk.js +1 -479
- package/lib/_util.js +1 -132
- package/lib/index.js +1 -4
- package/lib/lintstagedrc.js +1 -49
- package/lib/yolk.js +1 -458
- package/package.json +7 -9
- package/templates/miniprogram/README.md.tpl +5 -5
- package/templates/miniprogram/global.d.ts +1 -1
- package/templates/miniprogram/package.json.tpl +6 -0
- package/templates/miniprogram/tsconfig.json +1 -1
- package/templates/umi-mobile/README.md.tpl +5 -5
- package/templates/umi-mobile/package.json.tpl +6 -0
- package/templates/umi-mobile-h5+app/README.md.tpl +5 -5
- package/templates/umi-mobile-h5+app/package.json.tpl +6 -0
- package/templates/umi-mobile-native/README.md.tpl +5 -5
- package/templates/umi-mobile-native/package.json.tpl +6 -0
- package/templates/umi-mobile-uni-app/README.md.tpl +5 -5
- package/templates/umi-mobile-uni-app/package.json.tpl +6 -0
- package/templates/umi-web/README.md.tpl +5 -5
- package/templates/umi-web/package.json.tpl +6 -0
- package/templates/umi-web-screen/README.md.tpl +5 -5
- package/templates/umi-web-screen/package.json.tpl +6 -0
package/README.md
CHANGED
package/es/_util.js
CHANGED
|
@@ -1,105 +1 @@
|
|
|
1
|
-
var m
|
|
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
|
-
};
|
|
1
|
+
var m=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});import{spawn as k}from"node:child_process";import r from"node:fs";import a from"node:path";import c from"chalk";import{globSync as x}from"glob";import{rimrafSync as u,windowsSync as d}from"rimraf";import{program as h}from"../compiled/commander";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=()=>{j("yolk complete!"),process.exit(0)},w=()=>{C("yolk break!"),process.exit(0)},G=({command:t,args:e,complete:o,close:n,exit:s=!0})=>{let f=k(N(t),e||[],{stdio:"inherit"}).on("close",y=>{y?(n&&n(),P("yolk close!"),process.exit(y)):(o&&o(),s&&b())});process.on("SIGINT",()=>{h.exitOverride(),f.kill(),w()})},O=()=>{let t=x("*.yolkrc*",{cwd:i,dot:!0});if(!t.length)return{};let e=a.join(i,t[0]);if(r.existsSync(e))try{return JSON.parse(r.readFileSync(e,p))||{}}catch(o){return o(o.message||".yolkrc转换错误"),{}}else return{}},q=()=>{let t=a.join(i,"project.config.json");if(r.existsSync(t))try{return JSON.parse(r.readFileSync(t,p))||{}}catch(e){return e(e.message||"project.config.json转换错误"),{}}else return{}},B=()=>{let t=a.join(i,"package.json");if(r.existsSync(t))try{return JSON.parse(r.readFileSync(t,p))||{}}catch(e){return e(e.message||"package.json转换错误"),{}}else return{}},g=t=>{let e=O(),o="";try{o=m.resolve(`@baic/${t}-config-yolk`)}catch{}let n=x(`*.${t}rc*`,{cwd:i,dot:!0}),s=n==null?void 0:n[0];return e.strict===!1&&s&&r.existsSync(s)?s:r.existsSync(o)?o:s},D=()=>g("eslint"),T=()=>g("stylelint"),W=()=>g("prettier"),z=()=>g("biome");export{p as ENCODING,w as breakExit,b as completeExit,P as error,G as execCommand,z as getBiomeConfigPath,g as getConfigFilePath,D as getEsLintConfigPath,B as getPackageJSON,W as getPrettierConfigPath,q as getProjectConfigJSON,T as getStyleLintConfigPath,O as getYolkConfig,_ as info,j as ready,$ as rimrafSync,C as warn};
|
package/es/index.js
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
|
-
var r
|
|
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");
|
|
2
|
+
var r=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(i,n)=>(typeof require<"u"?require:i)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});r("../compiled/v8-compile-cache");r("./yolk");
|
package/es/lintstagedrc.js
CHANGED
|
@@ -1,61 +1 @@
|
|
|
1
|
-
var i
|
|
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();
|
|
1
|
+
var i=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,p)=>(typeof require<"u"?require:e)[p]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var u=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var b=u((P,h)=>{var{join:n}=i("node:path"),{getYolkConfig:m,getEsLintConfigPath:f,getStyleLintConfigPath:$,getPrettierConfigPath:d,getBiomeConfigPath:y}=i("./_util"),l=["**/node_modules/**","**/build/**","**/dist/**","**/lib/**","**/es/**","**/mock/**","**/test/**","**/public/**","**/assets/**","**/.umi/**","**/.umi-production/**","**/h5+app/**","**/*uni*/**","**/android/**","**/ios/**","**/*.ignore/**"],j=m(),g=j.strict!==!1,c=n(process.cwd(),"node_modules",".cache"),s=`prettier --write --cache --cache-strategy=content --cache-location=${n(c,".prettiercache")} --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(c,".eslintcache")} --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(c,".stylelintcache")} --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={"*.{md,json,jsonc}":[s],"*.css":[s,`${o} --custom-syntax postcss`],"*.less":[s,`${o} --custom-syntax postcss-less`],"*.{sass,scss}":[s,`${o} --custom-syntax postcss-scss`],"*.{js,jsx,cjs,mjs}":[s,r],"*.{ts,tsx,cts,mts}":[`${s} --parser=typescript`,r]},x={...a,[`!(${Object.keys(a).join("|")})`]:[C]};h.exports=x});export default b();
|