@tanyueran/cli 0.0.2 → 0.0.17

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/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t,a=require("commander"),s=require("prompts"),o=require("node:path"),l=require("fs-extra"),n=require("handlebars");!function(e){e.ViteVueTs="vite-vue-ts",e.WebpackVueTs="webpack-vue-ts"}(e||(e={})),function(e){e.VueTsPageTemplate="vue-ts-page-template",e.VueTsDetailTemplate="vue-ts-detail-template",e.VueTsEmpty="vue-ts-empty"}(t||(t={}));const r=[{label:"vite + vue + ts项目",value:e.ViteVueTs,path:"../packages/template/project/vue/vite-vue-ts"},{label:"webpack + vue + ts项目",value:e.WebpackVueTs,path:"../packages/template/project/vue/webpack-vue-ts"}],c=[{label:"vue-ts的页面模板",value:t.VueTsPageTemplate,path:"../template/module/vue/vue-ts-page-template"},{label:"vue-ts的详情模板",value:t.VueTsDetailTemplate,path:"../template/module/vue/vue-ts-detail-template"},{label:"vue-ts的空模板",value:t.VueTsEmpty,path:"../template/module/vue/vue-ts-empty"}];const p=require("node:path");function i(e){const{targetPath:t,sourcePath:a,templateData:s}=e;if(l.statSync(a).isDirectory()){l.readdirSync(a).forEach(e=>{i({targetPath:p.join(t,e),sourcePath:p.join(a,e),templateData:s})})}else if(a.endsWith(".hbs")){const e=l.readFileSync(a),o=n.compile(e.toString())(s);l.writeFileSync(t.replace(".hbs",""),o)}else l.copyFileSync(a,t)}function m(e){const{targetPath:t,sourcePath:a}=e;if(!l.statSync(a).isDirectory())throw new Error("源文件路劲必须是一个目录");l.existsSync(t)&&l.removeSync(t),l.mkdirSync(t,{recursive:!0}),i(e)}n.registerHelper("toPascalCase",function(e){return function(e){return e&&"string"==typeof e?e.split(/[\s-_]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(""):e}(e)});const u=require("picocolors"),v=new a.Command;v.name("tx cli").description("一个简单CLI 工具").version("0.0.1"),v.option("-m, --module-name <moduleName>","模块名称").option("-p, --project-name <projectName>","项目名称"),v.command("create").description("创建项目").action(async()=>{let e=v.opts().projectName;if(!e){const t=await s([{type:"text",name:"name",message:"请输入模块名"}]);e=t.name?t.name:"test-project-name"}const t=await s([{type:"select",name:"template",message:"请选择模板",choices:r.map(e=>({title:e.label,value:e.value}))}]);console.log(u.green()),console.log(u.green(t.template)),console.log(u.red("项目模板正在建设中,请稍后"))}),v.command("add").description("添加模块").action(async()=>{let e=v.opts().moduleName;if(!e){const t=await s([{type:"text",name:"name",message:"请输入模块名"}]);e=t.name?t.name:"test-module-name"}const t=await s([{type:"select",name:"template",message:"请选择模板",choices:c.map(e=>({title:e.label,value:e.value}))}]);console.log(u.green("模板名称:"+e)),console.log(u.green("选择模板:"+t.template));const a=c.find(e=>e.value===t.template);m({targetPath:o.resolve(process.cwd(),e),sourcePath:o.resolve(__dirname,a.path),templateData:{name:e}})}),exports.start=function(){v.parse(process.argv)};
1
+ "use strict";var e,t,a=require("commander"),s=require("prompts"),o=require("node:path"),n=require("fs-extra"),r=require("handlebars");!function(e){e.ViteVueTs="vite-vue-ts",e.WebpackVueTs="webpack-vue-ts"}(e||(e={})),function(e){e.VueTsPageTemplate="vue-ts-page-template",e.VueTsDetailTemplate="vue-ts-detail-template",e.VueTsEmpty="vue-ts-empty"}(t||(t={}));const c=[{label:"vite + vue + ts项目",value:e.ViteVueTs,path:"../packages/template/project/vue/vite-vue-ts"},{label:"webpack + vue + ts项目",value:e.WebpackVueTs,path:"../packages/template/project/vue/webpack-vue-ts"}],i=[{label:"vue-ts的空模板",value:t.VueTsEmpty,path:"../template/module/vue/vue-ts-empty"}];const l=require("node:path");function p(e){const{targetPath:t,sourcePath:a,templateData:s}=e;if(n.statSync(a).isDirectory()){n.readdirSync(a).forEach(e=>{p({targetPath:l.join(t,e),sourcePath:l.join(a,e),templateData:s})})}else if(a.endsWith(".hbs")){const e=n.readFileSync(a),o=r.compile(e.toString())(s);n.writeFileSync(t.replace(".hbs",""),o)}else n.copyFileSync(a,t)}function m(e){const{targetPath:t,sourcePath:a}=e;if(!n.statSync(a).isDirectory())throw new Error("源文件路劲必须是一个目录");n.existsSync(t)&&n.removeSync(t),n.mkdirSync(t,{recursive:!0}),p(e)}r.registerHelper("toPascalCase",function(e){return function(e){return e&&"string"==typeof e?e.split(/[\s-_]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(""):e}(e)});const u=require("picocolors"),v=new a.Command;v.name("tx cli").description("一个简单CLI 工具").version("0.0.17"),v.option("-m, --module-name <moduleName>","模块名称").option("-p, --project-name <projectName>","项目名称"),v.command("create").description("创建项目").action(async()=>{let e=v.opts().projectName;if(!e){const t=await s([{type:"text",name:"name",message:"请输入模块名"}]);e=t.name?t.name:"test-project-name"}const t=await s([{type:"select",name:"template",message:"请选择模板",choices:c.map(e=>({title:e.label,value:e.value}))}]);console.log(u.green()),console.log(u.green(t.template)),console.log(u.red("项目模板正在建设中,请稍后"))}),v.command("add").description("添加模块").action(async()=>{let e=v.opts().moduleName;if(!e){const t=await s([{type:"text",name:"name",message:"请输入模块名"}]);e=t.name?t.name:"test-module-name"}const t=await s([{type:"select",name:"template",message:"请选择模板",choices:i.map(e=>({title:e.label,value:e.value}))}]);console.log(u.green("模板名称:"+e)),console.log(u.green("选择模板:"+t.template));const a=i.find(e=>e.value===t.template);m({targetPath:o.resolve(process.cwd(),e),sourcePath:o.resolve(__dirname,a.path),templateData:{name:e}})}),exports.start=function(){v.parse(process.argv)};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanyueran/cli",
3
- "version": "0.0.2",
3
+ "version": "0.0.17",
4
4
  "description": "一个cli工具",
5
5
  "main": "index.ts",
6
6
  "bin": {
@@ -14,7 +14,8 @@
14
14
  ],
15
15
  "scripts": {
16
16
  "dev": "pnpm run build && ./bin/tx-cli",
17
- "build": "rollup --config rollup.config.js"
17
+ "build": "rollup --config rollup.config.js",
18
+ "publish-pkg": "node ./script/publish.cjs"
18
19
  },
19
20
  "keywords": [
20
21
  "cli"
@@ -22,14 +23,6 @@
22
23
  "author": "tanyueran",
23
24
  "license": "ISC",
24
25
  "packageManager": "pnpm@10.5.2",
25
- "peerDependencies": {
26
- "commander": "12.1.0",
27
- "fs-extra": "11.1.1",
28
- "handlebars": "4.7.7",
29
- "picocolors": "1.1.1",
30
- "prompts": "2.4.2",
31
- "table": "6.8.1"
32
- },
33
26
  "dependencies": {
34
27
  "commander": "12.1.0",
35
28
  "fs-extra": "11.1.1",
@@ -48,6 +41,7 @@
48
41
  "rollup-plugin-terser": "^7.0.2",
49
42
  "ts-node": "10.9.1",
50
43
  "tslib": "^2.8.1",
51
- "typescript": "5.2.2"
44
+ "typescript": "5.2.2",
45
+ "simple-git": "3.28.0"
52
46
  }
53
47
  }
@@ -1,25 +0,0 @@
1
- <template>
2
- <div></div>
3
- </template>
4
-
5
- <script setup lang="ts">
6
- import { ref } from "vue";
7
-
8
- // #region Prop
9
- //#endregion
10
-
11
- // #region 变量
12
- //#endregion
13
-
14
- // #region 计算属性
15
- //#endregion
16
-
17
- // #region 监听器
18
- //#endregion
19
-
20
- // #region 方法
21
- //#endregion
22
-
23
- // #region 生命周期
24
- //#endregion
25
- </script>
@@ -1,25 +0,0 @@
1
- <template>
2
- <div></div>
3
- </template>
4
-
5
- <script setup lang="ts">
6
- import { ref } from "vue";
7
-
8
- // #region Prop
9
- //#endregion
10
-
11
- // #region 变量
12
- //#endregion
13
-
14
- // #region 计算属性
15
- //#endregion
16
-
17
- // #region 监听器
18
- //#endregion
19
-
20
- // #region 方法
21
- //#endregion
22
-
23
- // #region 生命周期
24
- //#endregion
25
- </script>