@dypnb/dev-tools 1.0.15 → 1.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/README.md ADDED
@@ -0,0 +1,147 @@
1
+ # 开发时的提效工具
2
+
3
+ ## changelog
4
+ * 1.0.17 swagger 注释增加类型
5
+ * 1.0.16 修复 swagger 生成文件名错误问题
6
+
7
+ ## 说明
8
+ 包含 4 个工具:
9
+ * gen-page 生成 vue 模板
10
+ * gen-swagger 根据 swagger 文档生成 vue 代码
11
+ * publish-server 打包后将 dist 打包资源部署到服务器
12
+ * wx-server-notice 企业微信信息通知
13
+
14
+ ## 使用方法
15
+
16
+ ### 下载
17
+ ```sh
18
+ npm install -S @dypnb/dev-tools
19
+ ```
20
+
21
+ ### 配置文件, 根目录下新建 dyp.config.js
22
+ ```javaScript
23
+ // template.js
24
+ const cedata = {
25
+ dome: (parame) => {
26
+ console.log('object :>>我是方法 ', parame);
27
+ },
28
+ vueTemplate: compoenntName => {
29
+ return `<template>
30
+ <div class="${compoenntName}">
31
+ ${compoenntName}组件
32
+ </div>
33
+ </template>
34
+ <script>
35
+ export default {
36
+ name: '${compoenntName}'
37
+ };
38
+ </script>
39
+ <style lang="stylus" scoped>
40
+ .${compoenntName} {
41
+ };
42
+ </style>`
43
+ },
44
+ entryTemplate: compoenntName => {
45
+ return `import ${compoenntName} from './main.vue'
46
+ export default [{
47
+ path: "/${compoenntName}",
48
+ name: "${compoenntName}",
49
+ component: ${compoenntName}
50
+ }]`
51
+ },
52
+
53
+ }
54
+
55
+ export default {
56
+ // 静态资源上传服务器配置
57
+ uploadServeConfig: {
58
+ // 项目基本信息
59
+ projectInfo: {
60
+ name: "测试项目名",
61
+ },
62
+ // 本地文件打包后文件夹
63
+ locaPath: '/dist/',
64
+ protocol: "http",
65
+ // 服务端静态资源存放地址
66
+ staticPath: {
67
+ dev: 'dev-tools',
68
+ pro: 'dev-tools',
69
+ },
70
+ serverOption: {
71
+ host: ["x.x.x.x", "x.x.x.x"],
72
+ port: "22", // 端口一般默认22
73
+ username: "root", // 用户名
74
+ password: "xxxxxxx", // 密码
75
+ pathNmae: '/usr/local/dome/', // 上传到服务器的位置
76
+ },
77
+ },
78
+ // 微信消息通知配置
79
+ wxServerConfig: {
80
+ WX_COMPANY_ID: "xxxxxxx", // 企业ID
81
+ WX_APP_ID: "xxxxxx", // 应用ID
82
+ WX_APP_SECRET: "xxxxxxx", // 应用 Secret
83
+ },
84
+ // swagger 生成 vue 配置
85
+ swaggerConfig: {
86
+ // swagger 文档域名
87
+ path: 'http://xx.xx.xx/dev-iotmodel-api',
88
+ // swagger url 路径
89
+ staticPath: '/v3/api-docs',
90
+ // 输出文件路径
91
+ outputDir: '/src/api'
92
+ },
93
+ // 生成 Vue 页面配置
94
+ genPageConfig: {
95
+ // 是否命令行创建
96
+ isEnter: false,
97
+ // 文件名
98
+ name: 'dome',
99
+ // 默认 view 目录下生成,如果需要指定父目录则写入 fatherFileName
100
+ path: '',
101
+ // 子文件配置
102
+ child: [
103
+ {
104
+ name: 'index.vue',
105
+ template: cedata.vueTemplate,
106
+ templateConfig: {
107
+ // 文件标题,替换模板
108
+ title: '',
109
+ },
110
+ },
111
+ {
112
+ name: 'constants.js',
113
+ template: cedata.vueTemplate,
114
+ templateConfig: {
115
+ // 文件标题,替换模板
116
+ title: '',
117
+ },
118
+ },
119
+ ]
120
+ }
121
+ }
122
+ ```
123
+ ### package.json 配置
124
+ ```json
125
+ "scripts": {
126
+ "genApi": "dyp-genSwagger",
127
+ "genPage": "dyp-genPage",
128
+ "publish": "vue-cli-service build && dyp-publish && wx-server-notice"
129
+ }
130
+ ```
131
+
132
+ ### 具体使用
133
+
134
+ * 生成 vue 模板
135
+ ```sh
136
+ npm run genPage
137
+ ```
138
+
139
+ * 生成 swagger vue 文件
140
+ ```sh
141
+ npm run genApi
142
+ ```
143
+
144
+ * 打包发布并企业微信通知
145
+ ```sh
146
+ npm run publish
147
+ ```