yann-vis-cli 1.10.1 → 1.10.2
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/dist/pack/index.js +1 -1
- package/package.json +4 -1
- package/dist/auth/logon.js +0 -2
- package/dist/create/module/index.js +0 -2
- package/dist/create/package/index.js +0 -2
- package/dist/create/tool/index.js +0 -2
- package/dist/pack/diff.js +0 -2
- package/dist/pack/new.js +0 -2
- package/dist/package.json +0 -15
package/dist/pack/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("path"),t=require("yann-fs").default,{to:s}=require("await-to-js"),{getPackageInfo:r,scanFileFindChart:i,getPackageName:
|
|
1
|
+
"use strict";const e=require("path"),t=require("yann-fs").default,{to:s}=require("await-to-js"),{getPackageInfo:r,scanFileFindChart:i,getPackageName:n,buildPathHandler:o,exit:a,versionHandle:c,compareVersion:l,runAsyncCmd:p,log:d}=require("../utils"),u=require("p-limit"),m=require("dayjs"),w="src/components",f="src/charts",v=async s=>{try{const r=await t.readdir(s,{withFileTypes:!0});for(const i of r){const r=e.join(s,i.name);i.isDirectory()?await v(r):i.isFile()&&i.name.endsWith(".gz")&&await t.unlink(r)}}catch(e){throw console.error(`处理目录 ${s} 时出错:`,e.message),e}},h=async(i,a,p,u,m)=>{if(i.startsWith("."))return;const h=e.resolve(a,i),[$,g]=await t.readJson(e.resolve(h,"package.json"));if($||!g)return;const[x,y]=await t.readJson(e.resolve(h,"public","base.json"));if(x||!y)return;const{isDev:F}=y;if(F)return;if(!m.includes(i)){if(!await t.exists(e.resolve(p,f,i,"index.ts")))return;return void u.add(i)}const P=await c(h);if("string"==typeof P)return;const{name:C,outDir:E}=r(P),j=`V${C}`;d.info(`开始打图表包,图表名:“${i}”,版本号:“v${P.version}”.`),await o(h);const D=e.resolve(p,f,i),L=e.resolve(D,P.version);await t.remove(L);const O=e.resolve(L,"es");await t.copy(e.resolve(h,E,"es"),O),await v(L),await t.writeFile(e.resolve(L,"index.ts"),`import Component from "./es/index";\nexport const ${j} = Component;`),await(async(r,i)=>{try{const n=await t.readdir(i,{withFileTypes:!0}),o=[];for(const e of n)e.isFile()&&e.name.endsWith(".css")&&o.push(e.name);if(o.length>0){const i=e.resolve(r,"index.ts"),[n,a]=await s(t.readFile(i,"utf-8"));if(n||!a)return;let c="";for(const e of o)c+=`import './es/${e}'\n`;c+=a,await t.writeFile(i,c)}}catch(e){throw console.error(`处理目录 ${dir} 时出错:`,e.message),e}})(L,O);const k=e.resolve(D,"index.ts");await t.ensureFile(k),u.add(i);const[q,J]=await s(t.readFile(k,"utf-8"));if(q)return;const T=`V${n(i)}`,b=`import { ${j} } from './${P.version}/index'\nexport { ${j} }\n`;if(J.includes("export")){const e=/\.\/([\d.]+)\/index/g,s=[];let r;for(;null!==(r=e.exec(J));)s.push(r[1]);if(s.includes(P.version))return;const i=`${b}\n${J}`,n=s.sort((e,t)=>l(t,e))[0];if(l(n,P.version)>0)return void await t.writeFile(k,i);const o=new RegExp(`(export\\s*\\{)\\s*(\\w+)(\\s+)(as)(\\s+)(${T})(\\s*)(\\})`,"g"),a=i.replace(o,(e,t,s,r,i,n,o,a,c)=>`${t}${j}${r}${i}${n}${o}${a}${c}`);await t.writeFile(k,a)}else await t.appendFile(k,`${b}\nexport { ${j} as ${T} }`);await t.remove(e.resolve(h,E));const A=e.resolve(p,w,i);if(await t.exists(e.resolve(A,"index.ts")))return;await Promise.all([t.ensureFile(e.resolve(A,"index.ts")),t.ensureFile(e.resolve(A,"index.vue"))]);const H=[];H.push(t.writeFile(e.resolve(A,"index.ts"),`export { default as PgChart${T} } from './index.vue'`)),H.push(t.writeFile(e.resolve(A,"index.vue"),`<template>\n <v-chart :chart="${T}" v-bind="$attrs" :data="data" :styled="styled" :option="option" :events="events" @message="emit('message', $event)"></v-chart>\n</template>\n<script setup lang="ts">\nimport { VChart } from '@/core'\nimport { ${T} } from "@/charts/${i}";\nimport { useAttrs, defineEmits, defineProps, defineOptions } from "vue";\nimport type { ChartPropsType, ChartEvents, EmitMessage, ScreenLayerOption } from "@/types";\n\nconst $attrs = useAttrs();\nconst props = defineProps<{\n styled?: ChartPropsType<typeof ${T},'style'>\n option?: Partial<ScreenLayerOption>\n data?: ChartPropsType<typeof ${T},'data'>\n events?: ChartEvents[]\n}>();\nconst emit = defineEmits<{\n (e: "message", option: EmitMessage): void;\n}>();\n \ndefineOptions({\n name: 'pg-chart-v-${i}',\n inheritAttrs: false\n})\n<\/script>`)),await Promise.all(H)};async function $(e){const[s,r]=await t.readJson(e);return s?(d.err(s?.message),!1):("sideEffects"in r&&(delete r.sideEffects,await t.outputJson(e,r,{spaces:2,EOL:"\n"})),!0)}module.exports=async function(){const r=Date.now(),n=await i();if(!n)return a("非图表库");const c=e.resolve(n.root,"../pangu-chart"),l=e.resolve(n.root,"packages"),v=e.resolve(l,"components"),[g,x]=await s(t.readdir(v));if(g)return a(g?.message);const y=new Set,F=u(3);let P=x||[];const C=new Set(process.argv.slice(3));if(await t.exists(e.resolve(c,f,"index.ts")))if(C.has("-c"))await Promise.all([t.remove(e.resolve(c,f)),t.remove(e.resolve(c,w))]);else{const e=C.has("-e");if(C.delete("-e"),C.size){const t=[...C];P=e?x.filter(e=>!t.includes(e)):t}}await Promise.allSettled(x.map(e=>F(()=>h(e,v,c,y,P))));const E=[],j=[...y].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()));for(const e of j)E.push(`export * from './${e}'\n`);const D=E.join("");await Promise.all([t.writeFile(e.resolve(c,f,"index.ts"),D),t.writeFile(e.resolve(c,w,"index.ts"),D)]),await async function(s,r){d.info("开始打图表主题包.");const i=e.resolve(s,"utils","theme");await o(i);const n=e.resolve(r,"src/theme");await t.remove(n),await t.copy(e.resolve(i,"dist"),n),await t.remove(e.resolve(i,"dist"))}(l,c);const L=`图表库打包完成:${m().format("YYYY-MM-DD HH:mm")},总耗时: ${(Date.now()-r)/1e3}s.`;d.success(L),console.log(),d.info("开始打pangu-v-chart.");const O=e.resolve(c,"package.json");await $(O),await o(c),d.success("pangu-v-chart打包完成,正在准备执行CHANGELOG和发布"),await p("npm",["run","release"],{cwd:c,stdio:"inherit"});const[k,q]=await t.readJson(O);if(k)return void d.err(k?.message);q.sideEffects=!1,await t.outputJson(O,q,{spaces:2,EOL:"\n"});const J=await Promise.race([p("npm",["publish"],{cwd:c,stdio:"inherit"}),new Promise(e=>setTimeout(()=>e({success:!1,message:"执行超时"}),6e4))]);J.success?d.success("发布成功"):d.err(J.message),await $(O),d.success("pangu-v-chart 全部执行完成.")};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yann-vis-cli",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.2",
|
|
4
4
|
"description": "vis-cli",
|
|
5
5
|
"bin": {
|
|
6
6
|
"pvis": "bin/index.js",
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
"author": "Yann",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"main": "./dist/index.js",
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"registry": "https://registry.npmjs.org/"
|
|
23
|
+
},
|
|
21
24
|
"dependencies": {
|
|
22
25
|
"await-to-js": "^3.0.0",
|
|
23
26
|
"axios": "^1.13.2",
|
package/dist/auth/logon.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// yann-vis-cli v1.1.11 by Yann
|
|
2
|
-
"use strict";const{requestToken:e,get_cli_config:t}=require("../utils");module.exports={get_token_two:async()=>{const[s]=await t();s.user&&s.password&&await e(s.user,s.password);const[o]=await t();return o.token||(console.log(),await require("./index")()),!0}};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// yann-vis-cli v1.1.11 by Yann
|
|
2
|
-
"use strict";const{updatePackageJson:e,outputVueName:n,get_cli_config:t}=require("../../utils"),a=require("yann-fs").default,s=require("path");module.exports=async function(o,u){const i="@fea/"+o,[r]=await t();await e(u,{name:i,author:r.user,devDependencies:{"@fea/utils":"workspace:*"}}),await a.outputJson(s.resolve(u,"public","base.json"),{name:o,label:"",desc:"Custom Module",version:"1.0.0",author:r.user},{spaces:2,EOL:"\n"});const c=`\n// 路由配置 要求包名作为根路由 以免和其他模块路由冲突\n// 配置方式按照vue-router规范,会动态插入到主模块,路由切换要求使用name进行切换,path可能会更改\n// 一级菜单的meta里面有isFull字段判断是否是全屏渲染,默认false\nexport const routes = [\n {\n path: '/${o}',\n name: '${o}',\n component: () => import('./src/views/index.vue'),\n meta: {\n title: '${o}'\n }\n }\n]\n\nexport default {\n routes\n}\n`;await a.writeFile(s.resolve(u,"index.js"),c),await n(s.resolve(u,"src","views","index.vue"),o)};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// yann-vis-cli v1.1.11 by Yann
|
|
2
|
-
"use strict";const{updatePackageJson:e,getPackageName:a,outputVueName:t,get_cli_config:n}=require("../../utils"),s=require("yann-fs").default,o=require("path");module.exports=async function(u,i){const r="@fea/"+u,[c]=await n();await e(i,{name:r,author:c.user,devDependencies:{"@fea/utils":"workspace:*"}}),await s.outputJson(o.resolve(i,"public","base.json"),{name:u,label:"",desc:"Custom Package",version:"1.0.0",author:c.user},{spaces:2,EOL:"\n"});const l=`\n import { withInstall } from '@fea/utils/vue';\n\n export const ${a(u)} = withInstall(PackageComponent);\n export default {\n component:${a(u)}\n };\n `;await s.appendFile(o.resolve(i,"index.js"),l),await t(o.resolve(i,"src","index.vue"),u)};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// yann-vis-cli v1.1.11 by Yann
|
|
2
|
-
"use strict";const{updatePackageJson:e,get_cli_config:a}=require("../../utils"),s=require("yann-fs").default,t=require("path");module.exports=async function(o,u){const n="@fea/"+o,[i]=await a();await e(u,{name:n,author:i.user,devDependencies:{"@fea/utils":"workspace:*"}}),await s.outputJson(t.resolve(u,"public","base.json"),{name:o,label:"",desc:"Custom Tool",version:"1.0.0",author:i.user},{spaces:2,EOL:"\n"})};
|
package/dist/pack/diff.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// yann-vis-cli v1.5.1 by Yann
|
|
2
|
-
"use strict";const n=require("path"),e=require("yann-fs").default,{to:a}=require("await-to-js"),{spawnHandle:t,scanFileFindChart:s,getPackageName:o}=require("../utils"),r=new Map,i=require("semver"),c=n=>{n&&Object.keys(n).length>0&&Object.entries(n).forEach((([n,e])=>{if(!n.includes("@chart/utils"))if(r.has(n)){const a=r.get(n),t=i.coerce(a),s=i.coerce(e);i.lt(t.version,s.version)&&r.set(n,e)}else r.set(n,e)}))};module.exports=async function(){const i=await s();if(i){const[s,p]=await e.readJson(n.resolve(i.root,"package.json"));r.clear(),p&&c(p.dependencies);const l=n.resolve(i.root,"packages"),u=n.resolve(l,"components"),[d,f]=await a(e.readdir(u));if(f){const a=[],s=["Core"],p=[];await Promise.all(f.map((t=>(async(a,t,s,r,i)=>{if(0!==a.indexOf(".")){const p=n.resolve(t,a);if(await e.isDir(p)){const[t,l]=await e.readJson(n.resolve(p,"package.json"));if(l){const[t,u]=await e.pathExists(n.resolve(p,"index.js"));if(u){const[t,u]=await e.readJson(n.resolve(p,"public","base.json")),{version:d,isDev:f,isVip:m}=u||{version:"1.0.0"};if(f||m)return;c(l.dependencies);const h=o(a);r.push(h),s.push(`import _${h} from './components/${a}'`),i.push(`export const ${h} = { ..._${h}, version: 'v${d}' }`)}}}}})(t,u,a,s,p)))),await e.outputFile(n.resolve(l,"index.js"),a.join("\n")),p.unshift("\n"),await e.appendFile(n.resolve(l,"index.js"),p.join("\n"));const d=n.resolve(i.root,"packages/public","package.json"),[m,h]=await e.readJson(d);h.dependencies={...Object.fromEntries(r)},await e.outputJson(d,h,{spaces:2,EOL:"\n"}),await(async n=>{await t(/^win/.test(process.platform)?"pnpm.cmd":"pnpm",["build"],{cwd:n})})(l);const v=`\n# pangu-roof-chart\n\n盘古前端图表库\n\n### 打包方式\n\n打开终端执行,进入pangu-roof-chart目录下,执行命令\n\n\`\`\`bash\npv pack\n\`\`\`\n\n会在packages目录下生成 pgChart 的打包目录\n\n### 使用方式\n\n将pgChart目录迁移至任意项目的scr目录内,就可以导入使用了\n\n完整组件列表\n\`\`\`js\nimport {\n ${s.join(",\n ")}\n} from '@pangu/chart'\n\`\`\`\n\n\n使用方式\n\`\`\`js\n<script setup>\n import { Core } from '@pangu/chart';\n import '@pangu/chart/style.css';\n import { ref } from 'vue';\n\n const type = ref('Anbar');\n const chartData = ref({\n data: {\n columns: ['name', 'value'],\n data: [\n ['hz', 11],\n ['sh', 18],\n ['bj', 25]\n ]\n }\n });\n<\/script>\n\n<template>\n <Core :type="type" :data="chartData" />\n</template>\n\`\`\`\n\n `;await e.outputFile(n.resolve(i.root,"README.md"),v)}}};
|
package/dist/pack/new.js
DELETED
package/dist/package.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "demo_chart",
|
|
3
|
-
"description": "Custom Chart",
|
|
4
|
-
"private": true,
|
|
5
|
-
"version": "1.0.0",
|
|
6
|
-
"main": "./index.js",
|
|
7
|
-
"module": "./index.js",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"build": "vcc build",
|
|
10
|
-
"dev": "vcc dev"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {},
|
|
13
|
-
"devDependencies": {},
|
|
14
|
-
"author": ""
|
|
15
|
-
}
|