@baic/yolk-cli 2.1.0-alpha.236 → 2.1.0-alpha.238

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/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/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 +1 @@
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};
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};
@@ -1 +1 @@
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();
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;
package/es/yolk.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #! /usr/bin/env node
2
- var C=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(o,t)=>(typeof require<"u"?require:o)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});import{execSync as A}from"node:child_process";import{chmodSync as U,copyFileSync as te,existsSync as l,readFileSync as q,statSync as oe,writeFileSync as T}from"node:fs";import x from"node:os";import{basename as E,dirname as M,join as a,relative as ie}from"node:path";import H from"lodash/floor";import B from"lodash/isString";import{globSync as ne}from"glob";import re from"inquirer";import*as P from"miniprogram-ci";import{mkdirpSync as R}from"mkdirp";import{program as v}from"../compiled/commander";import se from"../compiled/mustache";import O from"../package.json";import{breakExit as ae,ENCODING as k,error as I,execCommand as n,getPackageJSON as me,getProjectConfigJSON as ce,getYolkConfig as pe,info as s,ready as m,rimrafSync as X,warn as w}from"./_util";var d=process.cwd(),S="##### CREATED BY YOLK #####",z=(e,o,t)=>{re.prompt([{type:"list",name:"type",message:"选择模版",default:"web",choices:[{name:"web template(umi framework)",value:"umi-web"},{name:"web big screen template(umi framework)",value:"umi-web-screen"},{name:"mobile template(umi framework)",value:"umi-mobile"},{name:"mobile HBuilderX h5+app template(umi framework)",value:"umi-mobile-h5+app"},{name:"mobile HBuilderX uni-app template(umi framework)",value:"umi-mobile-uni-app"},{name:"mobile native template(umi framework)",value:"umi-mobile-native"},{name:"miniprogram template",value:"miniprogram"}]},{type:"input",name:"projectName",message:"项目名称",default:E(E(process.cwd()))},{type:"list",name:"packageManager",message:"选择包管理器(默认:pnpm,推荐:pnpm)",default:"default",choices:[{name:"默认安装",value:"default"},{name:"跳过安装",value:!1},{name:"pnpm install",value:"pnpm"},{name:"yarn install",value:"yarn"},{name:"npm install",value:"npm"}]}]).then(({type:i,projectName:c,packageManager:g})=>{let u={projectName:c,packageManager:g==="default"?"pnpm":g,yolkVersion:O.version};if(i==="umi-mobile-uni-app"){w("暂不支持");return}let r=o||a(__dirname,`../templates/${i}`);if(m(`复制模版 ${E(r)}`),ne("**/*",{cwd:r,dot:!0,ignore:["**/node_modules/**","**/.git/**","**/.DS_Store","**/.idea/**"]}).forEach(f=>{if(!r)return;let y=a(r,f);if(!oe(y).isDirectory())if(f.endsWith(".tpl")){let p=q(y,k),h=a(e,f.replace(/\.tpl$/,"")),b=se.render(p,u);R(M(h)),m(`创建 ${ie(e,h)}`),T(h,b,k)}else{m(`创建 ${f}`);let p=a(e,f);R(M(p)),te(y,p)}}),m("复制模版 success!"),t&&l(r)&&X(r)&&m(`缓存删除 success! ${E(r||"")}`),g)switch(m("初始化依赖包"),g){case"default":case"pnpm":n({command:"pnpm",args:["install"]});break;case"yarn":n({command:"yarn",args:["install"]});break;case"npm":n({command:"npm",args:["install"]});break;default:}m("可查阅<<https://303394539.github.io/yolk-docs/>>了解相关文档")})},le=(e,o)=>z(e,o,!0),N=()=>l(a(d,"project.config.json")),G=()=>{let e=l(a(d,"node_modules/.bin/max"));if(!e)try{e=l(C.resolve("@umijs/max"))}catch{}if(!e)try{e=/umi@4\.(\d+)\.(\d+)/.test(A("umi -v").toString())}catch{}if(!e){let o=a(d,"node_modules","umi","package.json");if(l(o))try{let t=JSON.parse(q(o,k))||{};e=t.version&&+t.version.split(".")[0]>3}catch{}}return e},Z=()=>{let e=a(d,"project.config.json");return l(e)?C(e).appid:""},D=()=>l(a(d,"project.tt.json"))&&Z().indexOf("tt")===0,_=()=>Z().indexOf("20")===0,de=()=>{let e=a(d,".git/"),o=a(d,".git/hooks"),t=a(o,"pre-commit"),i=l(e),c=l(t),g=c&&q(t,k).includes(S);if(i)if(c){if(!g){try{U(t,"777")}catch(r){I(`chmod ${t} failed: ${r.message}`)}let u=q(t).toString();T(t,[u,u.includes("#!/")?"":"#!/bin/sh",S,"npx yolk pre-commit","RESULT=$?","[ $RESULT -ne 0 ] && exit 1","exit 0",S].join(x.EOL),k),m("write pre-commit hook")}}else{R(o),T(t,["#!/bin/sh",S,"npx yolk pre-commit","RESULT=$?","[ $RESULT -ne 0 ] && exit 1","exit 0",S].join(x.EOL),k),m("create pre-commit hook");try{U(t,"777")}catch(u){I(`chmod ${t} failed: ${u.message}`)}m("write pre-commit hook")}},ge=async()=>{let e=pe(),o=e.strict!==!1,t=e.eslintIgnore,i=e.stylelintIgnore;w("统一代码规范,进行严格的语法检查。"),o&&(w("git commit 禁止 lint 的 ignore 行为"),i&&w(`通过 .yolkrc 配置 stylelintIgnore: ${i}。`),t&&w(`通过 .yolkrc 配置 eslintIgnore: ${t}。`)),n({command:"lint-staged",args:["-c",C.resolve("./lintstagedrc")]})},V=({mAppid:e,mProject:o,mPrivateKeyPath:t,mVersion:i,mDesc:c,mRobot:g,mQrcodeFormat:u,mQrcodeOutputDest:r,mPagePath:$,mSearchQuery:f})=>{let y=l(a(d,".git"))?A("git log -1 --pretty=format:%H").toString():"",p=ce(),h=e||p.appid,b=o||a(d,"dist"),j=t||a(d,`private.${h}.key`);if(l(b))if(l(j)){let F=me(),Q=i||F.version||p.version||"1.0.0",K=c||F.description||p.description,L=`${y?` commit: ${y};`:""}${K?` description: ${K};`:""}`;y&&s(`commit: ${y}`),s(`dist: ${b}`),s(`key: ${j}`),s(`appid: ${h}`),s(`version: ${Q}`),s(`desc: ${L}`);let ee=new P.Project({appid:h,type:"miniProgram",projectPath:b,privateKeyPath:j,ignores:["node_modules/**/*","**/*.txt","**/*.key","**/*.less","**/*.sass","**/*.scss","**/*.css","**/*.jsx","**/*.ts","**/*.tsx","**/*.md"]});return{appid:h,options:{project:ee,version:Q,desc:L,setting:{...p.setting,es6:!1,es7:!1,minifyJS:!1,minifyWXML:!1,minifyWXSS:!1,minify:!1},robot:g,qrcodeFormat:u,qrcodeOutputDest:r,pagePath:$,searchQuery:f}}}else throw Error(`没有找到上传密钥(${j})`);else throw Error(`没有找到dist目录(${b})`)},J=()=>{let e="";try{e=A(`npm view ${O.name} version`,{timeout:3e3}).toString().replace(/\n/g,"")}catch{}s(`yolk version: ${O.version}${e&&e!==O.version?`(last:${e})`:""}`),s(`node version: ${process.version}`),s(`platform: ${x.platform()}`),s(`memory: ${H(x.freemem()/1024/1024)} MB(${H(x.totalmem()/1024/1024)} MB)`)},W=e=>e.option("--appid, --mAppid <appid>","小程序appid").option("--project, --mProject <project>","小程序上传工程目录").option("--privateKeyPath, --mPrivateKeyPath <privateKeyPath>","小程序上传key文件,默认:{当前目录}/private.{appid}.key").option("--version, --mVersion <version>","小程序上传版本号").option("--desc, --mDesc <desc>","小程序上传描述").option("--robot, --mRobot <robot>","小程序上传ci机器人1~30").option("--qrcodeFormat, --mQrcodeFormat <qrcodeFormat>",'小程序预览返回二维码文件的格式 "image" 或 "base64", 默认值 "terminal" 供调试用').option("--qrcodeOutputDest, --mQrcodeOutputDest <qrcodeOutputDest>","小程序预览二维码文件保存路径").option("--pagePath, --mPagePath <pagePath>","小程序预览预览页面路径").option("--searchQuery, --mSearchQuery <searchQuery>","小程序预览预览页面路径启动参数"),ue=/(\w+)=('(.*)'|"(.*)"|(.*))/giu,Y=e=>{process.env.DID_YOU_KNOW="none",process.env.VITE_CJS_IGNORE_WARNING="true";let o=[];return e==null||e.forEach(t=>{if(ue.test(t)){let[i,c]=t.split("=");process.env[i]=c,s(`设置环境变量:${i}=${c}`)}else o.push(t)}),o},fe=()=>{de(),process.argv.length>2?(v.version(O.version,"-v,--version","输出版本号").usage("[command] [options]"),v.command("init").description("初始化项目").option("--clone <template>","如果需要,可通过git clone拉取模版,默认取cli默认模版").action(({clone:e},{args:o})=>{if(J(),m("yolk init 开始"),e){let t=".yolk",i=a(d,t);l(i)&&X(i)&&m(`缓存删除 success! ${i}`),n({command:"git",args:["clone","-b","master","--depth","1",e,t].concat(o)}),le(d,i)}else z(d)}),v.command("start").description("启动项目").option("--docs","文档模式").action(({docs:e},{args:o})=>{J();let t=Y(o);N()?D()?n({command:"taro",args:["build","--type","tt","--watch"].concat(t)}):_()?n({command:"taro",args:["build","--type","alipay","--watch"].concat(t)}):n({command:"taro",args:["build","--type","weapp","--watch"].concat(t)}):e?n({command:"dumi",args:["dev"].concat(t)}):G()?n({command:"max",args:["dev"].concat(t)}):n({command:"umi",args:["dev"].concat(t)})}),v.command("build").description("编译项目").option("--docs","文档模式").action(({docs:e},{args:o})=>{J();let t=Y(o);N()?D()?n({command:"taro",args:["build","--type","tt"].concat(t)}):_()?n({command:"taro",args:["build","--type","alipay"].concat(t)}):n({command:"taro",args:["build","--type","weapp"].concat(t)}):e?n({command:"dumi",args:["build"].concat(t)}):G()?n({command:"max",args:["setup"].concat(t),complete:()=>n({command:"max",args:["build"].concat(t)}),exit:!1}):n({command:"umi",args:["build"].concat(t)})}),v.command("pre-commit").description("执行commit hook").action(ge),W(v.command("miniprogram-upload").description("使用 miniprogram-ci 上传小程序")).action(e=>{if(N()){if(!D()){if(!_()){let{appid:o,options:{project:t,version:i,desc:c,setting:g,robot:u}}=V(e);s(`${o} 上传开始`),P.upload({project:t,version:i,desc:c,setting:g,robot:u,onProgressUpdate:r=>{if(B(r))s(`task: ${r}`);else{let{status:$,message:f}=r;s(`task(${$}): ${f}`)}}}).then(()=>{m(`${o} 上传完成`)})}}}else I("非小程序项目目录")}),W(v.command("miniprogram-preview").description("使用 miniprogram-ci 预览小程序")).action(e=>{if(N()){if(!D()){if(!_()){let{appid:o,options:{project:t,version:i,desc:c,setting:g,robot:u,qrcodeFormat:r,qrcodeOutputDest:$,pagePath:f,searchQuery:y}}=V(e);s(`${o} 上传预览开始`),P.preview({project:t,version:i,desc:c,setting:g,robot:u,qrcodeFormat:r,qrcodeOutputDest:$,pagePath:f,searchQuery:y,onProgressUpdate:p=>{if(B(p))s(`task: ${p}`);else{let{status:h,message:b}=p;s(`task(${h}): ${b}`)}}}).then(()=>{m(`${o} 上传预览完成`)})}}}else I("非小程序项目目录")}),v.command("exec").description("执行ts文件").argument("<path>","执行的ts文件").action(e=>{n({command:"tsx",args:[e]})}),v.parse(process.argv)):ae()};fe();
2
+ var w=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(o,t)=>(typeof require<"u"?require:o)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});import{execSync as F}from"node:child_process";import{chmodSync as ee,copyFileSync as te,existsSync as c,readFileSync as Q,statSync as oe,writeFileSync as q}from"node:fs";import D from"node:os";import{basename as j,dirname as M,join as s,relative as ie}from"node:path";import G from"lodash/floor";import H from"lodash/isString";import{globSync as ne}from"glob";import re from"inquirer";import*as S from"miniprogram-ci";import{mkdirpSync as J}from"mkdirp";import{program as h}from"../compiled/commander";import ae from"../compiled/mustache";import x from"../package.json";import{breakExit as se,cwd as d,ENCODING as k,error as A,execCommand as n,getPackageJSON as me,getProjectConfigJSON as ce,info as a,ready as l,rimrafSync as W,warn as X}from"./_util";var P="##### CREATED BY YOLK #####",Y=(e,o,t)=>{re.prompt([{type:"list",name:"type",message:"选择模版",default:"web",choices:[{name:"web template(umi framework)",value:"umi-web"},{name:"web big screen template(umi framework)",value:"umi-web-screen"},{name:"mobile template(umi framework)",value:"umi-mobile"},{name:"mobile HBuilderX h5+app template(umi framework)",value:"umi-mobile-h5+app"},{name:"mobile HBuilderX uni-app template(umi framework)",value:"umi-mobile-uni-app"},{name:"mobile native template(umi framework)",value:"umi-mobile-native"},{name:"miniprogram template",value:"miniprogram"}]},{type:"input",name:"projectName",message:"项目名称",default:j(j(process.cwd()))},{type:"list",name:"packageManager",message:"选择包管理器(默认:pnpm,推荐:pnpm)",default:"default",choices:[{name:"默认安装",value:"default"},{name:"跳过安装",value:!1},{name:"pnpm install",value:"pnpm"},{name:"yarn install",value:"yarn"},{name:"npm install",value:"npm"}]}]).then(({type:r,projectName:u,packageManager:g})=>{let m={projectName:u,packageManager:g==="default"?"pnpm":g,yolkVersion:x.version};if(r==="umi-mobile-uni-app"){X("暂不支持");return}let i=o||s(__dirname,`../templates/${r}`);if(l(`复制模版 ${j(i)}`),ne("**/*",{cwd:i,dot:!0,ignore:["**/node_modules/**","**/.git/**","**/.DS_Store","**/.idea/**"]}).forEach(f=>{if(!i)return;let y=s(i,f);if(!oe(y).isDirectory())if(f.endsWith(".tpl")){let p=Q(y,k),v=s(e,f.replace(/\.tpl$/,"")),b=ae.render(p,m);J(M(v)),l(`创建 ${ie(e,v)}`),q(v,b,k)}else{l(`创建 ${f}`);let p=s(e,f);J(M(p)),te(y,p)}}),l("复制模版 success!"),t&&c(i)&&W(i)&&l(`缓存删除 success! ${j(i||"")}`),g)switch(l("初始化依赖包"),g){case"default":case"pnpm":n({command:"pnpm",args:["install"]});break;case"yarn":n({command:"yarn",args:["install"]});break;case"npm":n({command:"npm",args:["install"]});break;default:}l("可查阅<<https://303394539.github.io/yolk-docs/>>了解相关文档")})},pe=(e,o)=>Y(e,o,!0),C=()=>c(s(d,"project.config.json")),U=()=>{let e=c(s(d,"node_modules/.bin/max"));if(!e)try{e=c(w.resolve("@umijs/max"))}catch{}if(!e)try{e=/umi@4\.(\d+)\.(\d+)/.test(F("umi -v").toString())}catch{}if(!e){let o=s(d,"node_modules","umi","package.json");if(c(o))try{let t=JSON.parse(Q(o,k))||{};e=t.version&&+t.version.split(".")[0]>3}catch{}}return e},z=()=>{let e=s(d,"project.config.json");return c(e)?w(e).appid:""},N=()=>c(s(d,"project.tt.json"))&&z().indexOf("tt")===0,E=()=>z().indexOf("20")===0,le=()=>{let e=s(d,".git/"),o=s(d,".git/hooks"),t=s(o,"pre-commit"),r=c(e),u=c(o),g=c(t);if(r){u||(J(o),l("create .git/hooks")),g||(q(t,"",k),l("create pre-commit"));try{ee(t,"777")}catch(i){A(`chmod ${t} failed: ${i.message}`)}let m=Q(t,k).toString();m.indexOf(P)>=0&&(m=`${m.substring(0,m.indexOf(P))}${m.substring(m.lastIndexOf(P)+P.length)}`),q(t,[m,P,"npx yolk pre-commit","RESULT=$?","[ $RESULT -ne 0 ] && exit 1","exit 0",P].filter(i=>!!i).join(D.EOL),k)}},de=async()=>{X("统一代码规范,进行严格的语法检查。"),n({command:"lint-staged",args:["-c",w.resolve("./lintstagedrc")]})},B=({mAppid:e,mProject:o,mPrivateKeyPath:t,mVersion:r,mDesc:u,mRobot:g,mQrcodeFormat:m,mQrcodeOutputDest:i,mPagePath:$,mSearchQuery:f})=>{let y=c(s(d,".git"))?F("git log -1 --pretty=format:%H").toString():"",p=ce(),v=e||p.appid,b=o||s(d,"dist"),O=t||s(d,`private.${v}.key`);if(c(b))if(c(O)){let T=me(),K=r||T.version||p.version||"1.0.0",R=u||T.description||p.description,I=`${y?` commit: ${y};`:""}${R?` description: ${R};`:""}`;y&&a(`commit: ${y}`),a(`dist: ${b}`),a(`key: ${O}`),a(`appid: ${v}`),a(`version: ${K}`),a(`desc: ${I}`);let Z=new S.Project({appid:v,type:"miniProgram",projectPath:b,privateKeyPath:O,ignores:["node_modules/**/*","**/*.txt","**/*.key","**/*.less","**/*.sass","**/*.scss","**/*.css","**/*.jsx","**/*.ts","**/*.tsx","**/*.md"]});return{appid:v,options:{project:Z,version:K,desc:I,setting:{...p.setting,es6:!1,es7:!1,minifyJS:!1,minifyWXML:!1,minifyWXSS:!1,minify:!1},robot:g,qrcodeFormat:m,qrcodeOutputDest:i,pagePath:$,searchQuery:f}}}else throw Error(`没有找到上传密钥(${O})`);else throw Error(`没有找到dist目录(${b})`)},_=()=>{let e="";try{e=F(`npm view ${x.name} version`,{timeout:3e3}).toString().replace(/\n/g,"")}catch{}a(`yolk version: ${x.version}${e&&e!==x.version?`(last:${e})`:""}`),a(`node version: ${process.version}`),a(`platform: ${D.platform()}`),a(`memory: ${G(D.freemem()/1024/1024)} MB(${G(D.totalmem()/1024/1024)} MB)`)},L=e=>e.option("--appid, --mAppid <appid>","小程序appid").option("--project, --mProject <project>","小程序上传工程目录").option("--privateKeyPath, --mPrivateKeyPath <privateKeyPath>","小程序上传key文件,默认:{当前目录}/private.{appid}.key").option("--version, --mVersion <version>","小程序上传版本号").option("--desc, --mDesc <desc>","小程序上传描述").option("--robot, --mRobot <robot>","小程序上传ci机器人1~30").option("--qrcodeFormat, --mQrcodeFormat <qrcodeFormat>",'小程序预览返回二维码文件的格式 "image" 或 "base64", 默认值 "terminal" 供调试用').option("--qrcodeOutputDest, --mQrcodeOutputDest <qrcodeOutputDest>","小程序预览二维码文件保存路径").option("--pagePath, --mPagePath <pagePath>","小程序预览预览页面路径").option("--searchQuery, --mSearchQuery <searchQuery>","小程序预览预览页面路径启动参数"),ue=/(\w+)=('(.*)'|"(.*)"|(.*))/giu,V=e=>{process.env.DID_YOU_KNOW="none",process.env.VITE_CJS_IGNORE_WARNING="true";let o=[];return e==null||e.forEach(t=>{if(ue.test(t)){let[r,u]=t.split("=");process.env[r]=u,a(`设置环境变量:${r}=${u}`)}else o.push(t)}),o},ge=()=>{le(),process.argv.length>2?(h.version(x.version,"-v,--version","输出版本号").usage("[command] [options]"),h.command("init").description("初始化项目").option("--clone <template>","如果需要,可通过git clone拉取模版,默认取cli默认模版").action(({clone:e},{args:o})=>{if(_(),l("yolk init 开始"),e){let t=".yolk",r=s(d,t);c(r)&&W(r)&&l(`缓存删除 success! ${r}`),n({command:"git",args:["clone","-b","master","--depth","1",e,t].concat(o)}),pe(d,r)}else Y(d)}),h.command("start").description("启动项目").option("--docs","文档模式").action(({docs:e},{args:o})=>{_();let t=V(o);C()?N()?n({command:"taro",args:["build","--type","tt","--watch"].concat(t)}):E()?n({command:"taro",args:["build","--type","alipay","--watch"].concat(t)}):n({command:"taro",args:["build","--type","weapp","--watch"].concat(t)}):e?n({command:"dumi",args:["dev"].concat(t)}):U()?n({command:"max",args:["dev"].concat(t)}):n({command:"umi",args:["dev"].concat(t)})}),h.command("build").description("编译项目").option("--docs","文档模式").action(({docs:e},{args:o})=>{_();let t=V(o);C()?N()?n({command:"taro",args:["build","--type","tt"].concat(t)}):E()?n({command:"taro",args:["build","--type","alipay"].concat(t)}):n({command:"taro",args:["build","--type","weapp"].concat(t)}):e?n({command:"dumi",args:["build"].concat(t)}):U()?n({command:"max",args:["setup"].concat(t),complete:()=>n({command:"max",args:["build"].concat(t)}),exit:!1}):n({command:"umi",args:["build"].concat(t)})}),h.command("pre-commit").description("执行commit hook").action(de),L(h.command("miniprogram-upload").description("使用 miniprogram-ci 上传小程序")).action(e=>{if(C()){if(!N()){if(!E()){let{appid:o,options:{project:t,version:r,desc:u,setting:g,robot:m}}=B(e);a(`${o} 上传开始`),S.upload({project:t,version:r,desc:u,setting:g,robot:m,onProgressUpdate:i=>{if(H(i))a(`task: ${i}`);else{let{status:$,message:f}=i;a(`task(${$}): ${f}`)}}}).then(()=>{l(`${o} 上传完成`)})}}}else A("非小程序项目目录")}),L(h.command("miniprogram-preview").description("使用 miniprogram-ci 预览小程序")).action(e=>{if(C()){if(!N()){if(!E()){let{appid:o,options:{project:t,version:r,desc:u,setting:g,robot:m,qrcodeFormat:i,qrcodeOutputDest:$,pagePath:f,searchQuery:y}}=B(e);a(`${o} 上传预览开始`),S.preview({project:t,version:r,desc:u,setting:g,robot:m,qrcodeFormat:i,qrcodeOutputDest:$,pagePath:f,searchQuery:y,onProgressUpdate:p=>{if(H(p))a(`task: ${p}`);else{let{status:v,message:b}=p;a(`task(${v}): ${b}`)}}}).then(()=>{l(`${o} 上传预览完成`)})}}}else A("非小程序项目目录")}),h.command("exec").description("执行ts文件").argument("<path>","执行的ts文件").action(e=>{n({command:"tsx",args:[e]})}),h.parse(process.argv)):se()};ge();export{le as initPreCommit};
package/lib/_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/lib/_util.js CHANGED
@@ -1 +1 @@
1
- var E=Object.create;var g=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var R=(t,e)=>{for(var o in e)g(t,o,{get:e[o],enumerable:!0})},u=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of I(e))!F.call(t,r)&&r!==o&&g(t,r,{get:()=>e[r],enumerable:!(n=J(e,r))||n.enumerable});return t};var m=(t,e,o)=>(o=t!=null?E(v(t)):{},u(e||!t||!t.__esModule?g(o,"default",{value:t,enumerable:!0}):o,t)),L=t=>u(g({},"__esModule",{value:!0}),t);var A={};R(A,{ENCODING:()=>y,breakExit:()=>w,completeExit:()=>b,error:()=>P,execCommand:()=>G,getBiomeConfigPath:()=>z,getConfigFilePath:()=>l,getEsLintConfigPath:()=>D,getPackageJSON:()=>B,getPrettierConfigPath:()=>W,getProjectConfigJSON:()=>q,getStyleLintConfigPath:()=>T,getYolkConfig:()=>O,info:()=>Y,ready:()=>j,rimrafSync:()=>$,warn:()=>C});module.exports=L(A);var d=require("node:child_process"),s=m(require("node:fs")),a=m(require("node:path")),c=m(require("chalk")),x=require("glob"),p=require("rimraf"),h=require("../compiled/commander"),i=process.cwd(),f=console,y="utf-8",C=t=>t&&f.log(c.default.yellow("warn -"),t),P=t=>t&&f.log(c.default.red("error -"),t),j=t=>t&&f.log(c.default.green("ready -"),t),Y=t=>t&&f.log(c.default.blue("info -"),t),N=()=>process.platform==="win32",_=t=>N()?`${t}.cmd`:t,$=t=>N()?(0,p.windowsSync)(t):(0,p.rimrafSync)(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:r=!0})=>{let S=(0,d.spawn)(_(t),e||[],{stdio:"inherit"}).on("close",k=>{k?(n&&n(),P("yolk close!"),process.exit(k)):(o&&o(),r&&b())});process.on("SIGINT",()=>{h.program.exitOverride(),S.kill(),w()})},O=()=>{let t=(0,x.globSync)("*.yolkrc*",{cwd:i,dot:!0});if(!t.length)return{};let e=a.default.join(i,t[0]);if(s.default.existsSync(e))try{return JSON.parse(s.default.readFileSync(e,y))||{}}catch(o){return o(o.message||".yolkrc转换错误"),{}}else return{}},q=()=>{let t=a.default.join(i,"project.config.json");if(s.default.existsSync(t))try{return JSON.parse(s.default.readFileSync(t,y))||{}}catch(e){return e(e.message||"project.config.json转换错误"),{}}else return{}},B=()=>{let t=a.default.join(i,"package.json");if(s.default.existsSync(t))try{return JSON.parse(s.default.readFileSync(t,y))||{}}catch(e){return e(e.message||"package.json转换错误"),{}}else return{}},l=t=>{let e=O(),o="";try{o=require.resolve(`@baic/${t}-config-yolk`)}catch{}let n=(0,x.globSync)(`*.${t}rc*`,{cwd:i,dot:!0}),r=n==null?void 0:n[0];return e.strict===!1&&r&&s.default.existsSync(r)?r:s.default.existsSync(o)?o:r},D=()=>l("eslint"),T=()=>l("stylelint"),W=()=>l("prettier"),z=()=>l("biome");0&&(module.exports={ENCODING,breakExit,completeExit,error,execCommand,getBiomeConfigPath,getConfigFilePath,getEsLintConfigPath,getPackageJSON,getPrettierConfigPath,getProjectConfigJSON,getStyleLintConfigPath,getYolkConfig,info,ready,rimrafSync,warn});
1
+ var J=Object.create;var l=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var L=(t,e)=>{for(var o in e)l(t,o,{get:e[o],enumerable:!0})},u=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of v(e))!F.call(t,r)&&r!==o&&l(t,r,{get:()=>e[r],enumerable:!(n=I(e,r))||n.enumerable});return t};var m=(t,e,o)=>(o=t!=null?J(E(t)):{},u(e||!t||!t.__esModule?l(o,"default",{value:t,enumerable:!0}):o,t)),Y=t=>u(l({},"__esModule",{value:!0}),t);var H={};L(H,{ENCODING:()=>y,breakExit:()=>w,completeExit:()=>b,cwd:()=>i,error:()=>C,execCommand:()=>q,getBiomeConfigPath:()=>A,getConfigFilePath:()=>a,getEsLintConfigPath:()=>T,getPackageJSON:()=>D,getPrettierConfigPath:()=>z,getProjectConfigJSON:()=>B,getStyleLintConfigPath:()=>W,getYolkConfig:()=>O,info:()=>j,ready:()=>_,rimrafSync:()=>G,warn:()=>P});module.exports=Y(H);var d=require("node:child_process"),s=m(require("node:fs")),g=m(require("node:path")),c=m(require("chalk")),x=require("glob"),p=require("rimraf"),h=require("../compiled/commander"),i=process.cwd(),f=console,y="utf-8",P=t=>t&&f.log(c.default.yellow("warn -"),t),C=t=>t&&f.log(c.default.red("error -"),t),_=t=>t&&f.log(c.default.green("ready -"),t),j=t=>t&&f.log(c.default.blue("info -"),t),N=()=>process.platform==="win32",$=t=>N()?`${t}.cmd`:t,G=t=>N()?(0,p.windowsSync)(t):(0,p.rimrafSync)(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:r=!0})=>{let S=(0,d.spawn)($(t),e||[],{stdio:"inherit"}).on("close",k=>{k?(n&&n(),C("yolk close!"),process.exit(k)):(o&&o(),r&&b())});process.on("SIGINT",()=>{h.program.exitOverride(),S.kill(),w()})},O=()=>{let t=(0,x.globSync)("*.yolkrc*",{cwd:i,dot:!0});if(!t.length)return{};let e=g.default.join(i,t[0]);if(s.default.existsSync(e))try{return JSON.parse(s.default.readFileSync(e,y))||{}}catch(o){return o(o.message||".yolkrc转换错误"),{}}else return{}},B=()=>{let t=g.default.join(i,"project.config.json");if(s.default.existsSync(t))try{return JSON.parse(s.default.readFileSync(t,y))||{}}catch(e){return e(e.message||"project.config.json转换错误"),{}}else return{}},D=()=>{let t=g.default.join(i,"package.json");if(s.default.existsSync(t))try{return JSON.parse(s.default.readFileSync(t,y))||{}}catch(e){return e(e.message||"package.json转换错误"),{}}else return{}},a=t=>{let e=O(),o="";try{o=require.resolve(`@baic/${t}-config-yolk`)}catch{}let n=(0,x.globSync)(`*.${t}rc*`,{cwd:i,dot:!0}),r=n==null?void 0:n[0];return e.strict===!1&&r&&s.default.existsSync(r)?r:s.default.existsSync(o)?o:r},T=()=>a("eslint"),W=()=>a("stylelint"),z=()=>a("prettier"),A=()=>a("biome");0&&(module.exports={ENCODING,breakExit,completeExit,cwd,error,execCommand,getBiomeConfigPath,getConfigFilePath,getEsLintConfigPath,getPackageJSON,getPrettierConfigPath,getProjectConfigJSON,getStyleLintConfigPath,getYolkConfig,info,ready,rimrafSync,warn});
@@ -1 +1 @@
1
- var{join:e}=require("node:path"),{getYolkConfig:l,getEsLintConfigPath:g,getStyleLintConfigPath:h,getPrettierConfigPath:p,getBiomeConfigPath:u}=require("./_util"),r=["**/node_modules/**","**/build/**","**/dist/**","**/lib/**","**/es/**","**/mock/**","**/test/**","**/public/**","**/assets/**","**/.umi/**","**/.umi-production/**","**/h5+app/**","**/*uni*/**","**/android/**","**/ios/**","**/*.ignore/**"],m=l(),a=m.strict!==!1,o=e(process.cwd(),"node_modules",".cache"),t=`prettier --write --cache --cache-strategy=content --cache-location=${e(o,".prettiercache")} --config ${p()} --no-error-on-unmatched-pattern`,c=`eslint --fix ${a?"--no-inline-config":""} --no-error-on-unmatched-pattern --cache --cache-strategy=content --cache-location=${e(o,".eslintcache")} --config ${g()} ${r.map(s=>`--ignore-pattern ${s}`).join(" ")}`,n=`stylelint --fix ${a?"--ignore-disables":""} --allow-empty-input --cache --cache-strategy=content --cache-location=${e(o,".stylelintcache")} --config ${h()} ${r.map(s=>`--ignore-pattern ${s}`).join(" ")}`,f=`biome check --write --unsafe --no-errors-on-unmatched --log-level=error --files-ignore-unknown=true --config-path=${u()}`,i={"*.{md,json,jsonc}":[t],"*.css":[t,`${n} --custom-syntax postcss`],"*.less":[t,`${n} --custom-syntax postcss-less`],"*.{sass,scss}":[t,`${n} --custom-syntax postcss-scss`],"*.{js,jsx,cjs,mjs}":[t,c],"*.{ts,tsx,cts,mts}":[`${t} --parser=typescript`,c]},$={...i,[`!(${Object.keys(i).join("|")})`]:[f]};module.exports=$;
1
+ var{join:e}=require("node:path"),{getBiomeConfigPath:p,getEsLintConfigPath:h,getPrettierConfigPath:u,getStyleLintConfigPath:$,getYolkConfig:m}=require("./_util"),l=["**/node_modules/**","**/build/**","**/dist/**","**/lib/**","**/es/**","**/mock/**","**/test/**","**/public/**","**/assets/**","**/.umi/**","**/.umi-production/**","**/h5+app/**","**/*uni*/**","**/android/**","**/ios/**","**/*.ignore/**"],{strict:g=!0,eslintIgnorePattern:c,stylelintIgnorePattern:i}=m(),o=e(process.cwd(),"node_modules",".cache"),t=`prettier --write --cache --cache-strategy=content --cache-location=${e(o,".prettiercache")} --config ${u()} --no-error-on-unmatched-pattern`,r=`eslint --fix ${g?"--no-inline-config":""} ${c?`--ignore-pattern ${c}`:""} --no-error-on-unmatched-pattern --cache --cache-strategy=content --cache-location=${e(o,".eslintcache")} --config ${h()} ${l.map(n=>`--ignore-pattern ${n}`).join(" ")}`,s=`stylelint --fix ${g?"--ignore-disables":""} ${i?`--ignore-pattern ${i}`:""} --allow-empty-input --cache --cache-strategy=content --cache-location=${e(o,".stylelintcache")} --config ${$()} ${l.map(n=>`--ignore-pattern ${n}`).join(" ")}`,d=`biome check --write --unsafe --no-errors-on-unmatched --log-level=error --files-ignore-unknown=true --config-path=${p()}`,a={"*.{md,json,jsonc}":[t],"*.css":[t,`${s} --custom-syntax postcss`],"*.less":[t,`${s} --custom-syntax postcss-less`],"*.{sass,scss}":[t,`${s} --custom-syntax postcss-scss`],"*.{js,jsx,cjs,mjs}":[t,r],"*.{ts,tsx,cts,mts}":[`${t} --parser=typescript`,r]};module.exports={...a,[`!(${Object.keys(a).join("|")})`]:[d]};
@@ -0,0 +1,2 @@
1
+ #! /usr/bin/env node
2
+ export {};
@@ -0,0 +1,2 @@
1
+ #! /usr/bin/env node
2
+ var i=require("./yolk");(0,i.initPreCommit)();
package/lib/yolk.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  #! /usr/bin/env node
2
- export {};
2
+ export declare const initPreCommit: () => void;
package/lib/yolk.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #! /usr/bin/env node
2
- var V=Object.create;var R=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var Z=(t,i,o,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of Y(i))!z.call(t,a)&&a!==o&&R(t,a,{get:()=>i[a],enumerable:!(s=W(i,a))||s.enumerable});return t};var h=(t,i,o)=>(o=t!=null?V(X(t)):{},Z(i||!t||!t.__esModule?R(o,"default",{value:t,enumerable:!0}):o,t));var E=require("node:child_process"),n=require("node:fs"),$=h(require("node:os")),r=require("node:path"),D=h(require("lodash/floor")),_=h(require("lodash/isString")),L=require("glob"),U=h(require("inquirer")),P=h(require("miniprogram-ci")),C=require("mkdirp"),y=require("../compiled/commander"),M=h(require("../compiled/mustache")),k=h(require("../package.json")),e=require("./_util"),p=process.cwd(),S="##### CREATED BY YOLK #####",H=(t,i,o)=>{U.default.prompt([{type:"list",name:"type",message:"选择模版",default:"web",choices:[{name:"web template(umi framework)",value:"umi-web"},{name:"web big screen template(umi framework)",value:"umi-web-screen"},{name:"mobile template(umi framework)",value:"umi-mobile"},{name:"mobile HBuilderX h5+app template(umi framework)",value:"umi-mobile-h5+app"},{name:"mobile HBuilderX uni-app template(umi framework)",value:"umi-mobile-uni-app"},{name:"mobile native template(umi framework)",value:"umi-mobile-native"},{name:"miniprogram template",value:"miniprogram"}]},{type:"input",name:"projectName",message:"项目名称",default:(0,r.basename)((0,r.basename)(process.cwd()))},{type:"list",name:"packageManager",message:"选择包管理器(默认:pnpm,推荐:pnpm)",default:"default",choices:[{name:"默认安装",value:"default"},{name:"跳过安装",value:!1},{name:"pnpm install",value:"pnpm"},{name:"yarn install",value:"yarn"},{name:"npm install",value:"npm"}]}]).then(({type:s,projectName:a,packageManager:l})=>{let d={projectName:a,packageManager:l==="default"?"pnpm":l,yolkVersion:k.default.version};if(s==="umi-mobile-uni-app"){(0,e.warn)("暂不支持");return}let m=i||(0,r.join)(__dirname,`../templates/${s}`);if((0,e.ready)(`复制模版 ${(0,r.basename)(m)}`),(0,L.globSync)("**/*",{cwd:m,dot:!0,ignore:["**/node_modules/**","**/.git/**","**/.DS_Store","**/.idea/**"]}).forEach(g=>{if(!m)return;let u=(0,r.join)(m,g);if(!(0,n.statSync)(u).isDirectory())if(g.endsWith(".tpl")){let c=(0,n.readFileSync)(u,e.ENCODING),f=(0,r.join)(t,g.replace(/\.tpl$/,"")),v=M.default.render(c,d);(0,C.mkdirpSync)((0,r.dirname)(f)),(0,e.ready)(`创建 ${(0,r.relative)(t,f)}`),(0,n.writeFileSync)(f,v,e.ENCODING)}else{(0,e.ready)(`创建 ${g}`);let c=(0,r.join)(t,g);(0,C.mkdirpSync)((0,r.dirname)(c)),(0,n.copyFileSync)(u,c)}}),(0,e.ready)("复制模版 success!"),o&&(0,n.existsSync)(m)&&(0,e.rimrafSync)(m)&&(0,e.ready)(`缓存删除 success! ${(0,r.basename)(m||"")}`),l)switch((0,e.ready)("初始化依赖包"),l){case"default":case"pnpm":(0,e.execCommand)({command:"pnpm",args:["install"]});break;case"yarn":(0,e.execCommand)({command:"yarn",args:["install"]});break;case"npm":(0,e.execCommand)({command:"npm",args:["install"]});break;default:}(0,e.ready)("可查阅<<https://303394539.github.io/yolk-docs/>>了解相关文档")})},ee=(t,i)=>H(t,i,!0),x=()=>(0,n.existsSync)((0,r.join)(p,"project.config.json")),A=()=>{let t=(0,n.existsSync)((0,r.join)(p,"node_modules/.bin/max"));if(!t)try{t=(0,n.existsSync)(require.resolve("@umijs/max"))}catch{}if(!t)try{t=/umi@4\.(\d+)\.(\d+)/.test((0,E.execSync)("umi -v").toString())}catch{}if(!t){let i=(0,r.join)(p,"node_modules","umi","package.json");if((0,n.existsSync)(i))try{let o=JSON.parse((0,n.readFileSync)(i,e.ENCODING))||{};t=o.version&&+o.version.split(".")[0]>3}catch{}}return t},B=()=>{let t=(0,r.join)(p,"project.config.json");return(0,n.existsSync)(t)?require(t).appid:""},O=()=>(0,n.existsSync)((0,r.join)(p,"project.tt.json"))&&B().indexOf("tt")===0,j=()=>B().indexOf("20")===0,te=()=>{let t=(0,r.join)(p,".git/"),i=(0,r.join)(p,".git/hooks"),o=(0,r.join)(i,"pre-commit"),s=(0,n.existsSync)(t),a=(0,n.existsSync)(o),l=a&&(0,n.readFileSync)(o,e.ENCODING).includes(S);if(s)if(a){if(!l){try{(0,n.chmodSync)(o,"777")}catch(m){(0,e.error)(`chmod ${o} failed: ${m.message}`)}let d=(0,n.readFileSync)(o).toString();(0,n.writeFileSync)(o,[d,d.includes("#!/")?"":"#!/bin/sh",S,"npx yolk pre-commit","RESULT=$?","[ $RESULT -ne 0 ] && exit 1","exit 0",S].join($.default.EOL),e.ENCODING),(0,e.ready)("write pre-commit hook")}}else{(0,C.mkdirpSync)(i),(0,n.writeFileSync)(o,["#!/bin/sh",S,"npx yolk pre-commit","RESULT=$?","[ $RESULT -ne 0 ] && exit 1","exit 0",S].join($.default.EOL),e.ENCODING),(0,e.ready)("create pre-commit hook");try{(0,n.chmodSync)(o,"777")}catch(d){(0,e.error)(`chmod ${o} failed: ${d.message}`)}(0,e.ready)("write pre-commit hook")}},oe=async()=>{let t=(0,e.getYolkConfig)(),i=t.strict!==!1,o=t.eslintIgnore,s=t.stylelintIgnore;(0,e.warn)("统一代码规范,进行严格的语法检查。"),i&&((0,e.warn)("git commit 禁止 lint 的 ignore 行为"),s&&(0,e.warn)(`通过 .yolkrc 配置 stylelintIgnore: ${s}。`),o&&(0,e.warn)(`通过 .yolkrc 配置 eslintIgnore: ${o}。`)),(0,e.execCommand)({command:"lint-staged",args:["-c",require.resolve("./lintstagedrc")]})},F=({mAppid:t,mProject:i,mPrivateKeyPath:o,mVersion:s,mDesc:a,mRobot:l,mQrcodeFormat:d,mQrcodeOutputDest:m,mPagePath:b,mSearchQuery:g})=>{let u=(0,n.existsSync)((0,r.join)(p,".git"))?(0,E.execSync)("git log -1 --pretty=format:%H").toString():"",c=(0,e.getProjectConfigJSON)(),f=t||c.appid,v=i||(0,r.join)(p,"dist"),w=o||(0,r.join)(p,`private.${f}.key`);if((0,n.existsSync)(v))if((0,n.existsSync)(w)){let q=(0,e.getPackageJSON)(),I=s||q.version||c.version||"1.0.0",J=a||q.description||c.description,T=`${u?` commit: ${u};`:""}${J?` description: ${J};`:""}`;u&&(0,e.info)(`commit: ${u}`),(0,e.info)(`dist: ${v}`),(0,e.info)(`key: ${w}`),(0,e.info)(`appid: ${f}`),(0,e.info)(`version: ${I}`),(0,e.info)(`desc: ${T}`);let G=new P.Project({appid:f,type:"miniProgram",projectPath:v,privateKeyPath:w,ignores:["node_modules/**/*","**/*.txt","**/*.key","**/*.less","**/*.sass","**/*.scss","**/*.css","**/*.jsx","**/*.ts","**/*.tsx","**/*.md"]});return{appid:f,options:{project:G,version:I,desc:T,setting:{...c.setting,es6:!1,es7:!1,minifyJS:!1,minifyWXML:!1,minifyWXSS:!1,minify:!1},robot:l,qrcodeFormat:d,qrcodeOutputDest:m,pagePath:b,searchQuery:g}}}else throw Error(`没有找到上传密钥(${w})`);else throw Error(`没有找到dist目录(${v})`)},N=()=>{let t="";try{t=(0,E.execSync)(`npm view ${k.default.name} version`,{timeout:3e3}).toString().replace(/\n/g,"")}catch{}(0,e.info)(`yolk version: ${k.default.version}${t&&t!==k.default.version?`(last:${t})`:""}`),(0,e.info)(`node version: ${process.version}`),(0,e.info)(`platform: ${$.default.platform()}`),(0,e.info)(`memory: ${(0,D.default)($.default.freemem()/1024/1024)} MB(${(0,D.default)($.default.totalmem()/1024/1024)} MB)`)},Q=t=>t.option("--appid, --mAppid <appid>","小程序appid").option("--project, --mProject <project>","小程序上传工程目录").option("--privateKeyPath, --mPrivateKeyPath <privateKeyPath>","小程序上传key文件,默认:{当前目录}/private.{appid}.key").option("--version, --mVersion <version>","小程序上传版本号").option("--desc, --mDesc <desc>","小程序上传描述").option("--robot, --mRobot <robot>","小程序上传ci机器人1~30").option("--qrcodeFormat, --mQrcodeFormat <qrcodeFormat>",'小程序预览返回二维码文件的格式 "image" 或 "base64", 默认值 "terminal" 供调试用').option("--qrcodeOutputDest, --mQrcodeOutputDest <qrcodeOutputDest>","小程序预览二维码文件保存路径").option("--pagePath, --mPagePath <pagePath>","小程序预览预览页面路径").option("--searchQuery, --mSearchQuery <searchQuery>","小程序预览预览页面路径启动参数"),ie=/(\w+)=('(.*)'|"(.*)"|(.*))/giu,K=t=>{process.env.DID_YOU_KNOW="none",process.env.VITE_CJS_IGNORE_WARNING="true";let i=[];return t==null||t.forEach(o=>{if(ie.test(o)){let[s,a]=o.split("=");process.env[s]=a,(0,e.info)(`设置环境变量:${s}=${a}`)}else i.push(o)}),i},ne=()=>{te(),process.argv.length>2?(y.program.version(k.default.version,"-v,--version","输出版本号").usage("[command] [options]"),y.program.command("init").description("初始化项目").option("--clone <template>","如果需要,可通过git clone拉取模版,默认取cli默认模版").action(({clone:t},{args:i})=>{if(N(),(0,e.ready)("yolk init 开始"),t){let o=".yolk",s=(0,r.join)(p,o);(0,n.existsSync)(s)&&(0,e.rimrafSync)(s)&&(0,e.ready)(`缓存删除 success! ${s}`),(0,e.execCommand)({command:"git",args:["clone","-b","master","--depth","1",t,o].concat(i)}),ee(p,s)}else H(p)}),y.program.command("start").description("启动项目").option("--docs","文档模式").action(({docs:t},{args:i})=>{N();let o=K(i);x()?O()?(0,e.execCommand)({command:"taro",args:["build","--type","tt","--watch"].concat(o)}):j()?(0,e.execCommand)({command:"taro",args:["build","--type","alipay","--watch"].concat(o)}):(0,e.execCommand)({command:"taro",args:["build","--type","weapp","--watch"].concat(o)}):t?(0,e.execCommand)({command:"dumi",args:["dev"].concat(o)}):A()?(0,e.execCommand)({command:"max",args:["dev"].concat(o)}):(0,e.execCommand)({command:"umi",args:["dev"].concat(o)})}),y.program.command("build").description("编译项目").option("--docs","文档模式").action(({docs:t},{args:i})=>{N();let o=K(i);x()?O()?(0,e.execCommand)({command:"taro",args:["build","--type","tt"].concat(o)}):j()?(0,e.execCommand)({command:"taro",args:["build","--type","alipay"].concat(o)}):(0,e.execCommand)({command:"taro",args:["build","--type","weapp"].concat(o)}):t?(0,e.execCommand)({command:"dumi",args:["build"].concat(o)}):A()?(0,e.execCommand)({command:"max",args:["setup"].concat(o),complete:()=>(0,e.execCommand)({command:"max",args:["build"].concat(o)}),exit:!1}):(0,e.execCommand)({command:"umi",args:["build"].concat(o)})}),y.program.command("pre-commit").description("执行commit hook").action(oe),Q(y.program.command("miniprogram-upload").description("使用 miniprogram-ci 上传小程序")).action(t=>{if(x()){if(!O()){if(!j()){let{appid:i,options:{project:o,version:s,desc:a,setting:l,robot:d}}=F(t);(0,e.info)(`${i} 上传开始`),P.upload({project:o,version:s,desc:a,setting:l,robot:d,onProgressUpdate:m=>{if((0,_.default)(m))(0,e.info)(`task: ${m}`);else{let{status:b,message:g}=m;(0,e.info)(`task(${b}): ${g}`)}}}).then(()=>{(0,e.ready)(`${i} 上传完成`)})}}}else(0,e.error)("非小程序项目目录")}),Q(y.program.command("miniprogram-preview").description("使用 miniprogram-ci 预览小程序")).action(t=>{if(x()){if(!O()){if(!j()){let{appid:i,options:{project:o,version:s,desc:a,setting:l,robot:d,qrcodeFormat:m,qrcodeOutputDest:b,pagePath:g,searchQuery:u}}=F(t);(0,e.info)(`${i} 上传预览开始`),P.preview({project:o,version:s,desc:a,setting:l,robot:d,qrcodeFormat:m,qrcodeOutputDest:b,pagePath:g,searchQuery:u,onProgressUpdate:c=>{if((0,_.default)(c))(0,e.info)(`task: ${c}`);else{let{status:f,message:v}=c;(0,e.info)(`task(${f}): ${v}`)}}}).then(()=>{(0,e.ready)(`${i} 上传预览完成`)})}}}else(0,e.error)("非小程序项目目录")}),y.program.command("exec").description("执行ts文件").argument("<path>","执行的ts文件").action(t=>{(0,e.execCommand)({command:"tsx",args:[t]})}),y.program.parse(process.argv)):(0,e.breakExit)()};ne();
2
+ var W=Object.create;var x=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,Z=Object.prototype.hasOwnProperty;var ee=(t,i)=>{for(var o in i)x(t,o,{get:i[o],enumerable:!0})},Q=(t,i,o,a)=>{if(i&&typeof i=="object"||typeof i=="function")for(let m of Y(i))!Z.call(t,m)&&m!==o&&x(t,m,{get:()=>i[m],enumerable:!(a=X(i,m))||a.enumerable});return t};var y=(t,i,o)=>(o=t!=null?W(z(t)):{},Q(i||!t||!t.__esModule?x(o,"default",{value:t,enumerable:!0}):o,t)),te=t=>Q(x({},"__esModule",{value:!0}),t);var ae={};ee(ae,{initPreCommit:()=>L});module.exports=te(ae);var N=require("node:child_process"),n=require("node:fs"),k=y(require("node:os")),r=require("node:path"),D=y(require("lodash/floor")),_=y(require("lodash/isString")),M=require("glob"),G=y(require("inquirer")),P=y(require("miniprogram-ci")),C=require("mkdirp"),f=require("../compiled/commander"),H=y(require("../compiled/mustache")),$=y(require("../package.json")),e=require("./_util"),b="##### CREATED BY YOLK #####",U=(t,i,o)=>{G.default.prompt([{type:"list",name:"type",message:"选择模版",default:"web",choices:[{name:"web template(umi framework)",value:"umi-web"},{name:"web big screen template(umi framework)",value:"umi-web-screen"},{name:"mobile template(umi framework)",value:"umi-mobile"},{name:"mobile HBuilderX h5+app template(umi framework)",value:"umi-mobile-h5+app"},{name:"mobile HBuilderX uni-app template(umi framework)",value:"umi-mobile-uni-app"},{name:"mobile native template(umi framework)",value:"umi-mobile-native"},{name:"miniprogram template",value:"miniprogram"}]},{type:"input",name:"projectName",message:"项目名称",default:(0,r.basename)((0,r.basename)(process.cwd()))},{type:"list",name:"packageManager",message:"选择包管理器(默认:pnpm,推荐:pnpm)",default:"default",choices:[{name:"默认安装",value:"default"},{name:"跳过安装",value:!1},{name:"pnpm install",value:"pnpm"},{name:"yarn install",value:"yarn"},{name:"npm install",value:"npm"}]}]).then(({type:a,projectName:m,packageManager:l})=>{let c={projectName:m,packageManager:l==="default"?"pnpm":l,yolkVersion:$.default.version};if(a==="umi-mobile-uni-app"){(0,e.warn)("暂不支持");return}let s=i||(0,r.join)(__dirname,`../templates/${a}`);if((0,e.ready)(`复制模版 ${(0,r.basename)(s)}`),(0,M.globSync)("**/*",{cwd:s,dot:!0,ignore:["**/node_modules/**","**/.git/**","**/.DS_Store","**/.idea/**"]}).forEach(d=>{if(!s)return;let u=(0,r.join)(s,d);if(!(0,n.statSync)(u).isDirectory())if(d.endsWith(".tpl")){let p=(0,n.readFileSync)(u,e.ENCODING),g=(0,r.join)(t,d.replace(/\.tpl$/,"")),v=H.default.render(p,c);(0,C.mkdirpSync)((0,r.dirname)(g)),(0,e.ready)(`创建 ${(0,r.relative)(t,g)}`),(0,n.writeFileSync)(g,v,e.ENCODING)}else{(0,e.ready)(`创建 ${d}`);let p=(0,r.join)(t,d);(0,C.mkdirpSync)((0,r.dirname)(p)),(0,n.copyFileSync)(u,p)}}),(0,e.ready)("复制模版 success!"),o&&(0,n.existsSync)(s)&&(0,e.rimrafSync)(s)&&(0,e.ready)(`缓存删除 success! ${(0,r.basename)(s||"")}`),l)switch((0,e.ready)("初始化依赖包"),l){case"default":case"pnpm":(0,e.execCommand)({command:"pnpm",args:["install"]});break;case"yarn":(0,e.execCommand)({command:"yarn",args:["install"]});break;case"npm":(0,e.execCommand)({command:"npm",args:["install"]});break;default:}(0,e.ready)("可查阅<<https://303394539.github.io/yolk-docs/>>了解相关文档")})},oe=(t,i)=>U(t,i,!0),O=()=>(0,n.existsSync)((0,r.join)(e.cwd,"project.config.json")),T=()=>{let t=(0,n.existsSync)((0,r.join)(e.cwd,"node_modules/.bin/max"));if(!t)try{t=(0,n.existsSync)(require.resolve("@umijs/max"))}catch{}if(!t)try{t=/umi@4\.(\d+)\.(\d+)/.test((0,N.execSync)("umi -v").toString())}catch{}if(!t){let i=(0,r.join)(e.cwd,"node_modules","umi","package.json");if((0,n.existsSync)(i))try{let o=JSON.parse((0,n.readFileSync)(i,e.ENCODING))||{};t=o.version&&+o.version.split(".")[0]>3}catch{}}return t},B=()=>{let t=(0,r.join)(e.cwd,"project.config.json");return(0,n.existsSync)(t)?require(t).appid:""},w=()=>(0,n.existsSync)((0,r.join)(e.cwd,"project.tt.json"))&&B().indexOf("tt")===0,j=()=>B().indexOf("20")===0,L=()=>{let t=(0,r.join)(e.cwd,".git/"),i=(0,r.join)(e.cwd,".git/hooks"),o=(0,r.join)(i,"pre-commit"),a=(0,n.existsSync)(t),m=(0,n.existsSync)(i),l=(0,n.existsSync)(o);if(a){m||((0,C.mkdirpSync)(i),(0,e.ready)("create .git/hooks")),l||((0,n.writeFileSync)(o,"",e.ENCODING),(0,e.ready)("create pre-commit"));try{(0,n.chmodSync)(o,"777")}catch(s){(0,e.error)(`chmod ${o} failed: ${s.message}`)}let c=(0,n.readFileSync)(o,e.ENCODING).toString();c.indexOf(b)>=0&&(c=`${c.substring(0,c.indexOf(b))}${c.substring(c.lastIndexOf(b)+b.length)}`),(0,n.writeFileSync)(o,[c,b,"npx yolk pre-commit","RESULT=$?","[ $RESULT -ne 0 ] && exit 1","exit 0",b].filter(s=>!!s).join(k.default.EOL),e.ENCODING)}},ie=async()=>{(0,e.warn)("统一代码规范,进行严格的语法检查。"),(0,e.execCommand)({command:"lint-staged",args:["-c",require.resolve("./lintstagedrc")]})},K=({mAppid:t,mProject:i,mPrivateKeyPath:o,mVersion:a,mDesc:m,mRobot:l,mQrcodeFormat:c,mQrcodeOutputDest:s,mPagePath:h,mSearchQuery:d})=>{let u=(0,n.existsSync)((0,r.join)(e.cwd,".git"))?(0,N.execSync)("git log -1 --pretty=format:%H").toString():"",p=(0,e.getProjectConfigJSON)(),g=t||p.appid,v=i||(0,r.join)(e.cwd,"dist"),S=o||(0,r.join)(e.cwd,`private.${g}.key`);if((0,n.existsSync)(v))if((0,n.existsSync)(S)){let q=(0,e.getPackageJSON)(),J=a||q.version||p.version||"1.0.0",A=m||q.description||p.description,F=`${u?` commit: ${u};`:""}${A?` description: ${A};`:""}`;u&&(0,e.info)(`commit: ${u}`),(0,e.info)(`dist: ${v}`),(0,e.info)(`key: ${S}`),(0,e.info)(`appid: ${g}`),(0,e.info)(`version: ${J}`),(0,e.info)(`desc: ${F}`);let V=new P.Project({appid:g,type:"miniProgram",projectPath:v,privateKeyPath:S,ignores:["node_modules/**/*","**/*.txt","**/*.key","**/*.less","**/*.sass","**/*.scss","**/*.css","**/*.jsx","**/*.ts","**/*.tsx","**/*.md"]});return{appid:g,options:{project:V,version:J,desc:F,setting:{...p.setting,es6:!1,es7:!1,minifyJS:!1,minifyWXML:!1,minifyWXSS:!1,minify:!1},robot:l,qrcodeFormat:c,qrcodeOutputDest:s,pagePath:h,searchQuery:d}}}else throw Error(`没有找到上传密钥(${S})`);else throw Error(`没有找到dist目录(${v})`)},E=()=>{let t="";try{t=(0,N.execSync)(`npm view ${$.default.name} version`,{timeout:3e3}).toString().replace(/\n/g,"")}catch{}(0,e.info)(`yolk version: ${$.default.version}${t&&t!==$.default.version?`(last:${t})`:""}`),(0,e.info)(`node version: ${process.version}`),(0,e.info)(`platform: ${k.default.platform()}`),(0,e.info)(`memory: ${(0,D.default)(k.default.freemem()/1024/1024)} MB(${(0,D.default)(k.default.totalmem()/1024/1024)} MB)`)},R=t=>t.option("--appid, --mAppid <appid>","小程序appid").option("--project, --mProject <project>","小程序上传工程目录").option("--privateKeyPath, --mPrivateKeyPath <privateKeyPath>","小程序上传key文件,默认:{当前目录}/private.{appid}.key").option("--version, --mVersion <version>","小程序上传版本号").option("--desc, --mDesc <desc>","小程序上传描述").option("--robot, --mRobot <robot>","小程序上传ci机器人1~30").option("--qrcodeFormat, --mQrcodeFormat <qrcodeFormat>",'小程序预览返回二维码文件的格式 "image" 或 "base64", 默认值 "terminal" 供调试用').option("--qrcodeOutputDest, --mQrcodeOutputDest <qrcodeOutputDest>","小程序预览二维码文件保存路径").option("--pagePath, --mPagePath <pagePath>","小程序预览预览页面路径").option("--searchQuery, --mSearchQuery <searchQuery>","小程序预览预览页面路径启动参数"),ne=/(\w+)=('(.*)'|"(.*)"|(.*))/giu,I=t=>{process.env.DID_YOU_KNOW="none",process.env.VITE_CJS_IGNORE_WARNING="true";let i=[];return t==null||t.forEach(o=>{if(ne.test(o)){let[a,m]=o.split("=");process.env[a]=m,(0,e.info)(`设置环境变量:${a}=${m}`)}else i.push(o)}),i},re=()=>{L(),process.argv.length>2?(f.program.version($.default.version,"-v,--version","输出版本号").usage("[command] [options]"),f.program.command("init").description("初始化项目").option("--clone <template>","如果需要,可通过git clone拉取模版,默认取cli默认模版").action(({clone:t},{args:i})=>{if(E(),(0,e.ready)("yolk init 开始"),t){let o=".yolk",a=(0,r.join)(e.cwd,o);(0,n.existsSync)(a)&&(0,e.rimrafSync)(a)&&(0,e.ready)(`缓存删除 success! ${a}`),(0,e.execCommand)({command:"git",args:["clone","-b","master","--depth","1",t,o].concat(i)}),oe(e.cwd,a)}else U(e.cwd)}),f.program.command("start").description("启动项目").option("--docs","文档模式").action(({docs:t},{args:i})=>{E();let o=I(i);O()?w()?(0,e.execCommand)({command:"taro",args:["build","--type","tt","--watch"].concat(o)}):j()?(0,e.execCommand)({command:"taro",args:["build","--type","alipay","--watch"].concat(o)}):(0,e.execCommand)({command:"taro",args:["build","--type","weapp","--watch"].concat(o)}):t?(0,e.execCommand)({command:"dumi",args:["dev"].concat(o)}):T()?(0,e.execCommand)({command:"max",args:["dev"].concat(o)}):(0,e.execCommand)({command:"umi",args:["dev"].concat(o)})}),f.program.command("build").description("编译项目").option("--docs","文档模式").action(({docs:t},{args:i})=>{E();let o=I(i);O()?w()?(0,e.execCommand)({command:"taro",args:["build","--type","tt"].concat(o)}):j()?(0,e.execCommand)({command:"taro",args:["build","--type","alipay"].concat(o)}):(0,e.execCommand)({command:"taro",args:["build","--type","weapp"].concat(o)}):t?(0,e.execCommand)({command:"dumi",args:["build"].concat(o)}):T()?(0,e.execCommand)({command:"max",args:["setup"].concat(o),complete:()=>(0,e.execCommand)({command:"max",args:["build"].concat(o)}),exit:!1}):(0,e.execCommand)({command:"umi",args:["build"].concat(o)})}),f.program.command("pre-commit").description("执行commit hook").action(ie),R(f.program.command("miniprogram-upload").description("使用 miniprogram-ci 上传小程序")).action(t=>{if(O()){if(!w()){if(!j()){let{appid:i,options:{project:o,version:a,desc:m,setting:l,robot:c}}=K(t);(0,e.info)(`${i} 上传开始`),P.upload({project:o,version:a,desc:m,setting:l,robot:c,onProgressUpdate:s=>{if((0,_.default)(s))(0,e.info)(`task: ${s}`);else{let{status:h,message:d}=s;(0,e.info)(`task(${h}): ${d}`)}}}).then(()=>{(0,e.ready)(`${i} 上传完成`)})}}}else(0,e.error)("非小程序项目目录")}),R(f.program.command("miniprogram-preview").description("使用 miniprogram-ci 预览小程序")).action(t=>{if(O()){if(!w()){if(!j()){let{appid:i,options:{project:o,version:a,desc:m,setting:l,robot:c,qrcodeFormat:s,qrcodeOutputDest:h,pagePath:d,searchQuery:u}}=K(t);(0,e.info)(`${i} 上传预览开始`),P.preview({project:o,version:a,desc:m,setting:l,robot:c,qrcodeFormat:s,qrcodeOutputDest:h,pagePath:d,searchQuery:u,onProgressUpdate:p=>{if((0,_.default)(p))(0,e.info)(`task: ${p}`);else{let{status:g,message:v}=p;(0,e.info)(`task(${g}): ${v}`)}}}).then(()=>{(0,e.ready)(`${i} 上传预览完成`)})}}}else(0,e.error)("非小程序项目目录")}),f.program.command("exec").description("执行ts文件").argument("<path>","执行的ts文件").action(t=>{(0,e.execCommand)({command:"tsx",args:[t]})}),f.program.parse(process.argv)):(0,e.breakExit)()};re();0&&(module.exports={initPreCommit});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baic/yolk-cli",
3
- "version": "2.1.0-alpha.236",
3
+ "version": "2.1.0-alpha.238",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/303394539/yolk.git"
@@ -25,22 +25,19 @@
25
25
  "prebundle": "father prebundle"
26
26
  },
27
27
  "dependencies": {
28
- "@baic/biome-config-yolk": "^2.1.0-alpha.236",
29
- "@baic/eslint-config-yolk": "^2.1.0-alpha.236",
30
- "@baic/prettier-config-yolk": "^2.1.0-alpha.236",
31
- "@baic/stylelint-config-yolk": "^2.1.0-alpha.236",
28
+ "@baic/biome-config-yolk": "^2.1.0-alpha.238",
29
+ "@baic/eslint-config-yolk": "^2.1.0-alpha.238",
30
+ "@baic/prettier-config-yolk": "^2.1.0-alpha.238",
31
+ "@baic/stylelint-config-yolk": "^2.1.0-alpha.238",
32
32
  "@democrance/imagemin-lint-staged": "3.0.x",
33
- "@types/inquirer": "8.x",
34
- "@types/lint-staged": "13.3.x",
35
33
  "@types/lodash": "4.x",
36
34
  "chalk": "4.x",
37
35
  "eslint": "8.x",
38
36
  "glob": "10.4.x",
39
37
  "inquirer": "8.x",
40
- "licia": "1.41.x",
41
38
  "lint-staged": "15.2.x",
42
39
  "lodash": "4.x",
43
- "miniprogram-ci": "2.0.x",
40
+ "miniprogram-ci": "1.9.x",
44
41
  "mkdirp": "3.0.x",
45
42
  "postcss": "8.4.x",
46
43
  "postcss-less": "6.0.x",
@@ -48,9 +45,11 @@
48
45
  "prettier": "2.x",
49
46
  "rimraf": "5.0.x",
50
47
  "stylelint": "14.x",
51
- "tsx": "3.x"
48
+ "tsx": "4.x"
52
49
  },
53
50
  "devDependencies": {
51
+ "@types/inquirer": "8.x",
52
+ "@types/lint-staged": "13.3.x",
54
53
  "@types/mustache": "4.2.x",
55
54
  "commander": "12.1.x",
56
55
  "mustache": "4.2.x",
@@ -62,5 +61,5 @@
62
61
  "publishConfig": {
63
62
  "access": "public"
64
63
  },
65
- "gitHead": "15b391f63f392f7e0ecdb6c96d8d14d51cee0058"
64
+ "gitHead": "11b6d5a4db0c1f95b6a141aecfda760e9c492dc4"
66
65
  }
@@ -1,7 +1,7 @@
1
1
  # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
2
 
3
3
  # dependencies
4
- /node_modules
4
+ node_modules/
5
5
  npm-debug.log*
6
6
  npm-error.log*
7
7
  yarn-debug.log*
@@ -12,7 +12,7 @@ yarn-error.log*
12
12
 
13
13
  # production
14
14
  /build
15
- dist/
15
+ /dist
16
16
 
17
17
  # misc
18
18
  .DS_Store
@@ -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.
@@ -18,11 +18,9 @@
18
18
  "dependencies": {
19
19
  "@baic/preset-yolk-taro-miniprogram": "~{{ yolkVersion }}"
20
20
  },
21
- "resolutions": {
22
- "@types/react": "18.x",
23
- "@types/react-dom": "18.x",
24
- "react": "18.x",
25
- "react-dom": "18.x"
21
+ "devDependencies": {
22
+ "@types/react": "17.x",
23
+ "react": "17.x",
26
24
  },
27
25
  "pnpm": {
28
26
  "peerDependencyRules": {
@@ -15,10 +15,10 @@ yarn-error.log*
15
15
  .DS_Store
16
16
 
17
17
  # umi
18
- /src/.umi
19
- /src/.umi-production
20
- /src/.umi-test
21
- /.env.local
18
+ .umi
19
+ .umi-production
20
+ .umi-test
21
+ .env.local
22
22
  coverage
23
23
  .eslintcache
24
24
  .stylelintcache
@@ -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.
@@ -15,10 +15,10 @@ yarn-error.log*
15
15
  .DS_Store
16
16
 
17
17
  # umi
18
- /src/.umi
19
- /src/.umi-production
20
- /src/.umi-test
21
- /.env.local
18
+ .umi
19
+ .umi-production
20
+ .umi-test
21
+ .env.local
22
22
  coverage
23
23
  .eslintcache
24
24
  .stylelintcache
@@ -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.
@@ -15,10 +15,10 @@ yarn-error.log*
15
15
  .DS_Store
16
16
 
17
17
  # umi
18
- /src/.umi
19
- /src/.umi-production
20
- /src/.umi-test
21
- /.env.local
18
+ .umi
19
+ .umi-production
20
+ .umi-test
21
+ .env.local
22
22
  coverage
23
23
  .eslintcache
24
24
  .stylelintcache
@@ -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.
@@ -15,10 +15,10 @@ yarn-error.log*
15
15
  .DS_Store
16
16
 
17
17
  # umi
18
- /src/.umi
19
- /src/.umi-production
20
- /src/.umi-test
21
- /.env.local
18
+ .umi
19
+ .umi-production
20
+ .umi-test
21
+ .env.local
22
22
  coverage
23
23
  .eslintcache
24
24
  .stylelintcache
@@ -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.
@@ -15,10 +15,10 @@ yarn-error.log*
15
15
  .DS_Store
16
16
 
17
17
  # umi
18
- /src/.umi
19
- /src/.umi-production
20
- /src/.umi-test
21
- /.env.local
18
+ .umi
19
+ .umi-production
20
+ .umi-test
21
+ .env.local
22
22
  coverage
23
23
  .eslintcache
24
24
  .stylelintcache
@@ -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.
@@ -15,10 +15,10 @@ yarn-error.log*
15
15
  .DS_Store
16
16
 
17
17
  # umi
18
- /src/.umi
19
- /src/.umi-production
20
- /src/.umi-test
21
- /.env.local
18
+ .umi
19
+ .umi-production
20
+ .umi-test
21
+ .env.local
22
22
  coverage
23
23
  .eslintcache
24
24
  .stylelintcache
@@ -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.