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