@baic/yolk-cli 2.1.0-alpha.235 → 2.1.0-alpha.237

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.
Files changed (49) hide show
  1. package/LICENSE +18 -17
  2. package/README.md +1 -1
  3. package/es/_util.d.ts +3 -2
  4. package/es/_util.js +1 -105
  5. package/es/index.js +1 -11
  6. package/es/lintstagedrc.js +1 -61
  7. package/es/postinstall.d.ts +2 -0
  8. package/es/postinstall.js +2 -0
  9. package/es/yolk.d.ts +1 -1
  10. package/es/yolk.js +1 -479
  11. package/lib/_util.d.ts +3 -2
  12. package/lib/_util.js +1 -132
  13. package/lib/index.js +1 -4
  14. package/lib/lintstagedrc.js +1 -49
  15. package/lib/postinstall.d.ts +2 -0
  16. package/lib/postinstall.js +2 -0
  17. package/lib/yolk.d.ts +1 -1
  18. package/lib/yolk.js +1 -458
  19. package/package.json +11 -14
  20. package/templates/miniprogram/.gitignore.tpl +2 -2
  21. package/templates/miniprogram/LICENSE +18 -17
  22. package/templates/miniprogram/README.md.tpl +5 -5
  23. package/templates/miniprogram/global.d.ts +1 -1
  24. package/templates/miniprogram/package.json.tpl +4 -0
  25. package/templates/miniprogram/tsconfig.json +1 -1
  26. package/templates/umi-mobile/.gitignore.tpl +4 -4
  27. package/templates/umi-mobile/LICENSE +18 -17
  28. package/templates/umi-mobile/README.md.tpl +5 -5
  29. package/templates/umi-mobile/package.json.tpl +6 -0
  30. package/templates/umi-mobile-h5+app/.gitignore.tpl +4 -4
  31. package/templates/umi-mobile-h5+app/LICENSE +18 -17
  32. package/templates/umi-mobile-h5+app/README.md.tpl +5 -5
  33. package/templates/umi-mobile-h5+app/package.json.tpl +6 -0
  34. package/templates/umi-mobile-native/.gitignore.tpl +4 -4
  35. package/templates/umi-mobile-native/LICENSE +18 -17
  36. package/templates/umi-mobile-native/README.md.tpl +5 -5
  37. package/templates/umi-mobile-native/package.json.tpl +6 -0
  38. package/templates/umi-mobile-uni-app/.gitignore.tpl +4 -4
  39. package/templates/umi-mobile-uni-app/LICENSE +18 -17
  40. package/templates/umi-mobile-uni-app/README.md.tpl +5 -5
  41. package/templates/umi-mobile-uni-app/package.json.tpl +6 -0
  42. package/templates/umi-web/.gitignore.tpl +4 -4
  43. package/templates/umi-web/LICENSE +18 -17
  44. package/templates/umi-web/README.md.tpl +5 -5
  45. package/templates/umi-web/package.json.tpl +6 -0
  46. package/templates/umi-web-screen/.gitignore.tpl +4 -4
  47. package/templates/umi-web-screen/LICENSE +18 -17
  48. package/templates/umi-web-screen/README.md.tpl +5 -5
  49. package/templates/umi-web-screen/package.json.tpl +6 -0
package/LICENSE CHANGED
@@ -1,21 +1,22 @@
1
- MIT License
1
+ MIT LICENSE
2
2
 
3
- Copyright (c) 2024 Baic
3
+ Copyright (c) 2024 Baic<303394539@qq.com>
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
11
12
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
14
15
 
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @baic/yolk-cli
2
2
 
3
- ## 安装脚手架
3
+ ## 脚手架
4
4
 
5
5
  ```shell
6
6
  $ npm install -g @baic/yolk-cli
package/es/_util.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  export type YolkConfig = {
2
2
  strict?: boolean;
3
- eslintIgnore?: string | string[] | RegExp | RegExp[];
4
- stylelintIgnore?: string | string[] | RegExp | RegExp[];
3
+ eslintIgnorePattern?: string;
4
+ stylelintIgnorePattern?: string;
5
5
  };
6
+ export declare const cwd: string;
6
7
  export declare const ENCODING = "utf-8";
7
8
  export declare const warn: (text?: string) => void | "" | undefined;
8
9
  export declare const error: (text?: string) => void | "" | undefined;
package/es/_util.js CHANGED
@@ -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
- };
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 g 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(),a=console,p="utf-8",P=t=>t&&a.log(c.yellow("warn -"),t),C=t=>t&&a.log(c.red("error -"),t),$=t=>t&&a.log(c.green("ready -"),t),j=t=>t&&a.log(c.blue("info -"),t),S=()=>process.platform==="win32",N=t=>S()?`${t}.cmd`:t,G=t=>S()?d(t):u(t),b=()=>{j("yolk complete!"),process.exit(0)},w=()=>{P("yolk break!"),process.exit(0)},q=({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(),C("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=g.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{}},B=()=>{let t=g.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{}},D=()=>{let t=g.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{}},l=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},T=()=>l("eslint"),W=()=>l("stylelint"),z=()=>l("prettier"),A=()=>l("biome");export{p as ENCODING,w as breakExit,b as completeExit,i as cwd,C as error,q as execCommand,A as getBiomeConfigPath,l as getConfigFilePath,T as getEsLintConfigPath,D as getPackageJSON,z as getPrettierConfigPath,B as getProjectConfigJSON,W as getStyleLintConfigPath,O as getYolkConfig,j as info,$ as ready,G as rimrafSync,P as warn};
package/es/index.js CHANGED
@@ -1,12 +1,2 @@
1
1
  #! /usr/bin/env node
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");
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");
@@ -1,61 +1 @@
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();
1
+ var i=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,$)=>(typeof require<"u"?require:e)[$]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var m=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var P=m((I,u)=>{var{join:s}=i("node:path"),{getBiomeConfigPath:d,getEsLintConfigPath:f,getPrettierConfigPath:y,getStyleLintConfigPath:j,getYolkConfig:C}=i("./_util"),p=["**/node_modules/**","**/build/**","**/dist/**","**/lib/**","**/es/**","**/mock/**","**/test/**","**/public/**","**/assets/**","**/.umi/**","**/.umi-production/**","**/h5+app/**","**/*uni*/**","**/android/**","**/ios/**","**/*.ignore/**"],{strict:h=!0,eslintIgnorePattern:r,stylelintIgnorePattern:a}=C(),c=s(process.cwd(),"node_modules",".cache"),n=`prettier --write --cache --cache-strategy=content --cache-location=${s(c,".prettiercache")} --config ${y()} --no-error-on-unmatched-pattern`,l=`eslint --fix ${h?"--no-inline-config":""} ${r?`--ignore-pattern ${r}`:""} --no-error-on-unmatched-pattern --cache --cache-strategy=content --cache-location=${s(c,".eslintcache")} --config ${f()} ${p.map(t=>`--ignore-pattern ${t}`).join(" ")}`,o=`stylelint --fix ${h?"--ignore-disables":""} ${a?`--ignore-pattern ${a}`:""} --allow-empty-input --cache --cache-strategy=content --cache-location=${s(c,".stylelintcache")} --config ${j()} ${p.map(t=>`--ignore-pattern ${t}`).join(" ")}`,x=`biome check --write --unsafe --no-errors-on-unmatched --log-level=error --files-ignore-unknown=true --config-path=${d()}`,g={"*.{md,json,jsonc}":[n],"*.css":[n,`${o} --custom-syntax postcss`],"*.less":[n,`${o} --custom-syntax postcss-less`],"*.{sass,scss}":[n,`${o} --custom-syntax postcss-scss`],"*.{js,jsx,cjs,mjs}":[n,l],"*.{ts,tsx,cts,mts}":[`${n} --parser=typescript`,l]};u.exports={...g,[`!(${Object.keys(g).join("|")})`]:[x]}});export default P();
@@ -0,0 +1,2 @@
1
+ #! /usr/bin/env node
2
+ export {};
@@ -0,0 +1,2 @@
1
+ #! /usr/bin/env node
2
+ import{initPreCommit as i}from"./yolk";i();
package/es/yolk.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  #! /usr/bin/env node
2
- export {};
2
+ export declare const initPreCommit: () => void;