deeke-script-app 1.7.0 → 1.7.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/.vscode/settings.json +1 -0
- package/@deekeScript/@type/Class/Global.d.ts +1 -1
- package/@deekeScript/@type/Class/Rect.d.ts +16 -16
- package/@deekeScript/@type/Class/UiSelector.d.ts +201 -201
- package/@deekeScript/@type/Class/WebSocket.d.ts +49 -49
- package/@deekeScript/@type/interface/Access.d.ts +104 -104
- package/@deekeScript/@type/interface/App.d.ts +101 -101
- package/@deekeScript/@type/interface/DeekeScriptJson.d.ts +13 -13
- package/@deekeScript/@type/interface/Device.d.ts +88 -88
- package/@deekeScript/@type/interface/Encrypt.d.ts +58 -58
- package/@deekeScript/@type/interface/Engines.d.ts +39 -39
- package/@deekeScript/@type/interface/Files.d.ts +283 -283
- package/@deekeScript/@type/interface/FloatDialogs.d.ts +41 -41
- package/@deekeScript/@type/interface/ForegroundServiceBridge.d.ts +31 -31
- package/@deekeScript/@type/interface/Hid.d.ts +342 -342
- package/@deekeScript/@type/interface/Http.d.ts +94 -43
- package/@deekeScript/@type/interface/Images.d.ts +71 -71
- package/@deekeScript/@type/interface/Java.d.ts +7 -7
- package/@deekeScript/@type/interface/KeyBoards.d.ts +27 -27
- package/@deekeScript/@type/interface/Log.d.ts +16 -16
- package/@deekeScript/@type/interface/MediaStore.d.ts +146 -146
- package/@deekeScript/@type/interface/NotificationBridge.d.ts +28 -28
- package/@deekeScript/@type/interface/SocketIOClient.d.ts +76 -76
- package/@deekeScript/@type/interface/Storage.d.ts +119 -119
- package/@deekeScript/@type/interface/System.d.ts +114 -114
- package/@deekeScript/@type/interface/UiObject.d.ts +197 -197
- package/README.md +67 -67
- package/deekeScript.json +670 -669
- package/deekeScript.schema.json +492 -0
- package/deekeScriptZipBuild +48 -48
- package/gulpfile +17 -17
- package/images/test/statistics.png +0 -0
- package/init +32 -32
- package/jsconfig.json +11 -11
- package/package.json +44 -43
- package/script/statistics/statistics.js +120 -120
- package/script/task.html +4 -4
- package/src/statistics/statistics.js +120 -120
- package/src/task/douyin_zan.js +89 -89
- package/src/task/dy.js +14 -14
- package/src/task/dyApp.js +7 -7
- package/src/task/tool.js +19 -19
- package/src/task.html +4 -4
- package/test.json +67 -0
- package/uglify-config.json +15 -15
- package/update-types.js +118 -0
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "DeekeScript 配置文件",
|
|
4
|
+
"description": "DeekeScript Android 项目配置文件,用于动态渲染页面",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["name", "versionCode", "versionName", "icon", "host", "switchSetting", "groups", "bottomMenus", "settingLists", "apis"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "App安装成功之后,在手机上的名称"
|
|
11
|
+
},
|
|
12
|
+
"versionCode": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "版本号(软件自动升级凭证,当前版本号大于或者等于后台上传的版本号,则无法升级)"
|
|
15
|
+
},
|
|
16
|
+
"versionName": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "版本名称,尽量和版本号统一(版本号100,则配置为1.0.0)"
|
|
19
|
+
},
|
|
20
|
+
"icon": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"description": "图标建议采用200*200像素的,清晰度大的"
|
|
23
|
+
},
|
|
24
|
+
"head": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "App中用户设置页面的头像,无设置页可以不填"
|
|
27
|
+
},
|
|
28
|
+
"settingTopBg": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "设置页面顶部背景图"
|
|
31
|
+
},
|
|
32
|
+
"debug": {
|
|
33
|
+
"type": "boolean",
|
|
34
|
+
"description": "默认为true(不需要激活码也可以启动脚本),如果需要激活才能使用APP,请设置为false",
|
|
35
|
+
"default": true
|
|
36
|
+
},
|
|
37
|
+
"host": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"description": "接口请求域名",
|
|
40
|
+
"format": "uri"
|
|
41
|
+
},
|
|
42
|
+
"switchSetting": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"description": "功能开关设置",
|
|
45
|
+
"required": ["alipay"],
|
|
46
|
+
"properties": {
|
|
47
|
+
"alipay": {
|
|
48
|
+
"type": "boolean",
|
|
49
|
+
"description": "支持支付宝支付"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"groups": {
|
|
54
|
+
"type": "array",
|
|
55
|
+
"description": "主界面的功能组,每组都会包含若干个功能",
|
|
56
|
+
"items": {
|
|
57
|
+
"type": "object",
|
|
58
|
+
"required": ["title", "methods"],
|
|
59
|
+
"properties": {
|
|
60
|
+
"title": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"description": "App主界面的功能名称"
|
|
63
|
+
},
|
|
64
|
+
"titleHidden": {
|
|
65
|
+
"type": "boolean",
|
|
66
|
+
"description": "App主界面功能组标题是否隐藏,默认不隐藏",
|
|
67
|
+
"default": false
|
|
68
|
+
},
|
|
69
|
+
"hidden": {
|
|
70
|
+
"type": "boolean",
|
|
71
|
+
"description": "是否隐藏当前功能组,默认不隐藏",
|
|
72
|
+
"default": false
|
|
73
|
+
},
|
|
74
|
+
"methods": {
|
|
75
|
+
"type": "array",
|
|
76
|
+
"description": "当前功能组下的功能列表",
|
|
77
|
+
"items": {
|
|
78
|
+
"$ref": "#/definitions/method"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"bottomMenus": {
|
|
85
|
+
"type": "array",
|
|
86
|
+
"description": "App中底部菜单,可以使用系统内置的,也可以自定义",
|
|
87
|
+
"items": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"required": ["title", "icon", "type"],
|
|
90
|
+
"properties": {
|
|
91
|
+
"title": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"description": "菜单标题,可使用 {NAME} 占位符"
|
|
94
|
+
},
|
|
95
|
+
"icon": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"description": "菜单图标路径"
|
|
98
|
+
},
|
|
99
|
+
"banner": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"description": "横幅图片路径"
|
|
102
|
+
},
|
|
103
|
+
"type": {
|
|
104
|
+
"type": "string",
|
|
105
|
+
"description": "菜单类型",
|
|
106
|
+
"enum": ["home", "speech", "setting"]
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"settingLists": {
|
|
112
|
+
"type": "array",
|
|
113
|
+
"description": "App中设置页的列表项,可以使用系统内置的,也可以自定义",
|
|
114
|
+
"items": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"required": ["title", "icon", "type"],
|
|
117
|
+
"properties": {
|
|
118
|
+
"title": {
|
|
119
|
+
"type": "string",
|
|
120
|
+
"description": "设置项标题"
|
|
121
|
+
},
|
|
122
|
+
"icon": {
|
|
123
|
+
"type": "string",
|
|
124
|
+
"description": "设置项图标路径"
|
|
125
|
+
},
|
|
126
|
+
"type": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"description": "设置项类型",
|
|
129
|
+
"enum": ["customerService", "notice", "settingService", "statistics", "uploadLog", "updateApp", "clear", "qiwei"]
|
|
130
|
+
},
|
|
131
|
+
"description": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"description": "设置项描述"
|
|
134
|
+
},
|
|
135
|
+
"file": {
|
|
136
|
+
"type": "string",
|
|
137
|
+
"description": "文件路径(用于 notice 类型)"
|
|
138
|
+
},
|
|
139
|
+
"url": {
|
|
140
|
+
"type": "string",
|
|
141
|
+
"description": "接口URL"
|
|
142
|
+
},
|
|
143
|
+
"jsFile": {
|
|
144
|
+
"type": "string",
|
|
145
|
+
"description": "JavaScript文件路径"
|
|
146
|
+
},
|
|
147
|
+
"hidden": {
|
|
148
|
+
"type": "boolean",
|
|
149
|
+
"description": "是否隐藏",
|
|
150
|
+
"default": false
|
|
151
|
+
},
|
|
152
|
+
"settingPage": {
|
|
153
|
+
"$ref": "#/definitions/settingPage"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"apis": {
|
|
159
|
+
"type": "array",
|
|
160
|
+
"description": "设置相关api,比如激活码api,验证激活码是否有效api等",
|
|
161
|
+
"items": {
|
|
162
|
+
"type": "object",
|
|
163
|
+
"required": ["type", "url"],
|
|
164
|
+
"properties": {
|
|
165
|
+
"type": {
|
|
166
|
+
"type": "string",
|
|
167
|
+
"description": "API类型",
|
|
168
|
+
"enum": ["bind", "checkBind", "aiSpeechToken", "config", "getToken", "createOrder"]
|
|
169
|
+
},
|
|
170
|
+
"url": {
|
|
171
|
+
"type": "string",
|
|
172
|
+
"description": "API接口路径"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"definitions": {
|
|
179
|
+
"method": {
|
|
180
|
+
"type": "object",
|
|
181
|
+
"required": ["title", "icon"],
|
|
182
|
+
"properties": {
|
|
183
|
+
"title": {
|
|
184
|
+
"type": "string",
|
|
185
|
+
"description": "App主界面的功能名称"
|
|
186
|
+
},
|
|
187
|
+
"icon": {
|
|
188
|
+
"type": "string",
|
|
189
|
+
"description": "App主界面的功能图标"
|
|
190
|
+
},
|
|
191
|
+
"jsFile": {
|
|
192
|
+
"type": "string",
|
|
193
|
+
"description": "功能实际执行的代码所在文件"
|
|
194
|
+
},
|
|
195
|
+
"settingPage": {
|
|
196
|
+
"$ref": "#/definitions/settingPage"
|
|
197
|
+
},
|
|
198
|
+
"hidden": {
|
|
199
|
+
"type": "boolean",
|
|
200
|
+
"description": "属性值,当为true的时候,则界面上不再显示此功能模块",
|
|
201
|
+
"default": false
|
|
202
|
+
},
|
|
203
|
+
"runType": {
|
|
204
|
+
"type": "string",
|
|
205
|
+
"description": "如果为floatSwitch则需要手动点击右侧悬浮窗执行",
|
|
206
|
+
"enum": ["floatSwitch"]
|
|
207
|
+
},
|
|
208
|
+
"packageName": {
|
|
209
|
+
"type": "string",
|
|
210
|
+
"description": "包名,和runType配合使用"
|
|
211
|
+
},
|
|
212
|
+
"columns": {
|
|
213
|
+
"type": "number",
|
|
214
|
+
"description": "每行被等分为24,8则表示当前groups一行放3个功能图标"
|
|
215
|
+
},
|
|
216
|
+
"autoOpen": {
|
|
217
|
+
"type": "boolean",
|
|
218
|
+
"description": "是否自动打开界面(需要和packageName配合使用)"
|
|
219
|
+
},
|
|
220
|
+
"activity": {
|
|
221
|
+
"type": "object",
|
|
222
|
+
"description": "活动配置",
|
|
223
|
+
"properties": {
|
|
224
|
+
"notice": {
|
|
225
|
+
"type": "string",
|
|
226
|
+
"description": "活动提示"
|
|
227
|
+
},
|
|
228
|
+
"title": {
|
|
229
|
+
"type": "string",
|
|
230
|
+
"description": "活动标题"
|
|
231
|
+
},
|
|
232
|
+
"minVersion": {
|
|
233
|
+
"type": "number",
|
|
234
|
+
"description": "最小版本号"
|
|
235
|
+
},
|
|
236
|
+
"groups": {
|
|
237
|
+
"type": "array",
|
|
238
|
+
"description": "活动功能组",
|
|
239
|
+
"items": {
|
|
240
|
+
"type": "object",
|
|
241
|
+
"properties": {
|
|
242
|
+
"title": {
|
|
243
|
+
"type": "string"
|
|
244
|
+
},
|
|
245
|
+
"titleHidden": {
|
|
246
|
+
"type": "boolean"
|
|
247
|
+
},
|
|
248
|
+
"methods": {
|
|
249
|
+
"type": "array",
|
|
250
|
+
"items": {
|
|
251
|
+
"$ref": "#/definitions/method"
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
"settingPage": {
|
|
262
|
+
"type": "object",
|
|
263
|
+
"required": ["params"],
|
|
264
|
+
"properties": {
|
|
265
|
+
"params": {
|
|
266
|
+
"type": "array",
|
|
267
|
+
"description": "需要用户设置的参数",
|
|
268
|
+
"items": {
|
|
269
|
+
"$ref": "#/definitions/param"
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
"param": {
|
|
275
|
+
"type": "object",
|
|
276
|
+
"required": ["type"],
|
|
277
|
+
"properties": {
|
|
278
|
+
"type": {
|
|
279
|
+
"type": "string",
|
|
280
|
+
"description": "参数类型",
|
|
281
|
+
"enum": [
|
|
282
|
+
"text",
|
|
283
|
+
"number",
|
|
284
|
+
"numberRange",
|
|
285
|
+
"textArea",
|
|
286
|
+
"switch",
|
|
287
|
+
"radio",
|
|
288
|
+
"checkbox",
|
|
289
|
+
"checkboxGroup",
|
|
290
|
+
"select",
|
|
291
|
+
"date",
|
|
292
|
+
"time",
|
|
293
|
+
"datetime",
|
|
294
|
+
"color",
|
|
295
|
+
"file",
|
|
296
|
+
"image",
|
|
297
|
+
"notice"
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
"label": {
|
|
301
|
+
"type": "string",
|
|
302
|
+
"description": "标签文本"
|
|
303
|
+
},
|
|
304
|
+
"name": {
|
|
305
|
+
"type": "string",
|
|
306
|
+
"description": "参数名称(用于存储和获取值)"
|
|
307
|
+
},
|
|
308
|
+
"value": {
|
|
309
|
+
"description": "默认值(类型根据type而定)"
|
|
310
|
+
},
|
|
311
|
+
"hint": {
|
|
312
|
+
"type": "string",
|
|
313
|
+
"description": "提示文本"
|
|
314
|
+
},
|
|
315
|
+
"notice": {
|
|
316
|
+
"type": "string",
|
|
317
|
+
"description": "通知文本"
|
|
318
|
+
},
|
|
319
|
+
"title": {
|
|
320
|
+
"type": "string",
|
|
321
|
+
"description": "标题(用于notice类型)"
|
|
322
|
+
},
|
|
323
|
+
"min": {
|
|
324
|
+
"type": "number",
|
|
325
|
+
"description": "最小值(用于numberRange类型)"
|
|
326
|
+
},
|
|
327
|
+
"max": {
|
|
328
|
+
"type": "number",
|
|
329
|
+
"description": "最大值(用于numberRange类型)"
|
|
330
|
+
},
|
|
331
|
+
"step": {
|
|
332
|
+
"type": "number",
|
|
333
|
+
"description": "步长(用于numberRange类型)"
|
|
334
|
+
},
|
|
335
|
+
"options": {
|
|
336
|
+
"type": "array",
|
|
337
|
+
"description": "选项列表(用于radio、select类型)",
|
|
338
|
+
"items": {
|
|
339
|
+
"type": "object",
|
|
340
|
+
"properties": {
|
|
341
|
+
"label": {
|
|
342
|
+
"type": "string"
|
|
343
|
+
},
|
|
344
|
+
"value": {
|
|
345
|
+
"type": "string"
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
"dataFrom": {
|
|
351
|
+
"type": "string",
|
|
352
|
+
"description": "数据来源(如:role)"
|
|
353
|
+
},
|
|
354
|
+
"children": {
|
|
355
|
+
"type": "array",
|
|
356
|
+
"description": "子选项(用于checkboxGroup类型)",
|
|
357
|
+
"items": {
|
|
358
|
+
"type": "string"
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
"values": {
|
|
362
|
+
"type": "array",
|
|
363
|
+
"description": "值列表(用于checkboxGroup类型)",
|
|
364
|
+
"items": {
|
|
365
|
+
"type": "string"
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
"columnCount": {
|
|
369
|
+
"type": "number",
|
|
370
|
+
"description": "列数(用于checkboxGroup类型)"
|
|
371
|
+
},
|
|
372
|
+
"lines": {
|
|
373
|
+
"type": "number",
|
|
374
|
+
"description": "行数(用于textArea类型)"
|
|
375
|
+
},
|
|
376
|
+
"textColor": {
|
|
377
|
+
"type": "string",
|
|
378
|
+
"description": "文本颜色(用于notice类型)",
|
|
379
|
+
"pattern": "^#[0-9A-Fa-f]{6}$"
|
|
380
|
+
},
|
|
381
|
+
"textSize": {
|
|
382
|
+
"type": "number",
|
|
383
|
+
"description": "文本大小(用于notice类型)"
|
|
384
|
+
},
|
|
385
|
+
"hidden": {
|
|
386
|
+
"type": "boolean",
|
|
387
|
+
"description": "是否隐藏",
|
|
388
|
+
"default": false
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
"allOf": [
|
|
392
|
+
{
|
|
393
|
+
"if": {
|
|
394
|
+
"properties": {
|
|
395
|
+
"type": {
|
|
396
|
+
"const": "numberRange"
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
"then": {
|
|
401
|
+
"required": ["label", "name", "min", "max", "value"]
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"if": {
|
|
406
|
+
"properties": {
|
|
407
|
+
"type": {
|
|
408
|
+
"const": "textArea"
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
"then": {
|
|
413
|
+
"required": ["label", "name"]
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
"if": {
|
|
418
|
+
"properties": {
|
|
419
|
+
"type": {
|
|
420
|
+
"const": "checkboxGroup"
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
"then": {
|
|
425
|
+
"required": ["label", "name", "children", "values"]
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"if": {
|
|
430
|
+
"properties": {
|
|
431
|
+
"type": {
|
|
432
|
+
"const": "switch"
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
"then": {
|
|
437
|
+
"required": ["label", "name"]
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
"if": {
|
|
442
|
+
"properties": {
|
|
443
|
+
"type": {
|
|
444
|
+
"const": "radio"
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
},
|
|
448
|
+
"then": {
|
|
449
|
+
"required": ["label", "name"]
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
"if": {
|
|
454
|
+
"properties": {
|
|
455
|
+
"type": {
|
|
456
|
+
"const": "text"
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
"then": {
|
|
461
|
+
"required": ["label", "name"]
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
"if": {
|
|
466
|
+
"properties": {
|
|
467
|
+
"type": {
|
|
468
|
+
"const": "number"
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
"then": {
|
|
473
|
+
"required": ["label", "name"]
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
"if": {
|
|
478
|
+
"properties": {
|
|
479
|
+
"type": {
|
|
480
|
+
"const": "notice"
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
"then": {
|
|
485
|
+
"required": ["title"]
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
]
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
package/deekeScriptZipBuild
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
const path = require('path'); // CommonJS 方式引入 path:ml-citation{ref="1,2" data="citationList"}
|
|
2
|
-
const fs = require('fs'); // 引入 fs 模块:ml-citation{ref="5" data="citationList"}
|
|
3
|
-
const AdmZip = require('adm-zip'); // 引入 adm-zip 库:ml-citation{ref="3,4" data="citationList"}
|
|
4
|
-
|
|
5
|
-
// 获取上层目录路径
|
|
6
|
-
// const parentDir = path.join(__dirname, '..');
|
|
7
|
-
const parentDir = __dirname;
|
|
8
|
-
console.log('开始执行打包');
|
|
9
|
-
|
|
10
|
-
fs.unlink(path.join(parentDir, 'deekeScript.zip'), (err) => {
|
|
11
|
-
if (err) {
|
|
12
|
-
//没有文件
|
|
13
|
-
} else {
|
|
14
|
-
//console.log('deekeScript.zip文件已删除');
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// 创建 zip 实例
|
|
19
|
-
const zip = new AdmZip();
|
|
20
|
-
|
|
21
|
-
// 递归添加文件并排除目录
|
|
22
|
-
function addFilesToZip(directory) {
|
|
23
|
-
const files = fs.readdirSync(directory);
|
|
24
|
-
|
|
25
|
-
files.forEach(file => {
|
|
26
|
-
const fullPath = path.join(directory, file);
|
|
27
|
-
const relativePath = path.relative(parentDir, fullPath);
|
|
28
|
-
|
|
29
|
-
// 排除 DeekeScript 和 node_modules 目录
|
|
30
|
-
if (relativePath.startsWith('src') || relativePath.startsWith('.vscode') || relativePath.startsWith('.git') || relativePath.startsWith('@deekeScript') || relativePath.startsWith('node_modules')) {
|
|
31
|
-
console.log('排除目录:' + relativePath);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// 处理子目录或文件
|
|
36
|
-
if (fs.statSync(fullPath).isDirectory()) {
|
|
37
|
-
addFilesToZip(fullPath); // 递归处理子目录
|
|
38
|
-
} else {
|
|
39
|
-
zip.addLocalFile(fullPath, path.dirname(relativePath));
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// 执行压缩
|
|
45
|
-
addFilesToZip(parentDir);
|
|
46
|
-
zip.writeZip(path.join(parentDir, 'deekeScript.zip'));
|
|
47
|
-
|
|
48
|
-
console.log('打包完成');
|
|
1
|
+
const path = require('path'); // CommonJS 方式引入 path:ml-citation{ref="1,2" data="citationList"}
|
|
2
|
+
const fs = require('fs'); // 引入 fs 模块:ml-citation{ref="5" data="citationList"}
|
|
3
|
+
const AdmZip = require('adm-zip'); // 引入 adm-zip 库:ml-citation{ref="3,4" data="citationList"}
|
|
4
|
+
|
|
5
|
+
// 获取上层目录路径
|
|
6
|
+
// const parentDir = path.join(__dirname, '..');
|
|
7
|
+
const parentDir = __dirname;
|
|
8
|
+
console.log('开始执行打包');
|
|
9
|
+
|
|
10
|
+
fs.unlink(path.join(parentDir, 'deekeScript.zip'), (err) => {
|
|
11
|
+
if (err) {
|
|
12
|
+
//没有文件
|
|
13
|
+
} else {
|
|
14
|
+
//console.log('deekeScript.zip文件已删除');
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// 创建 zip 实例
|
|
19
|
+
const zip = new AdmZip();
|
|
20
|
+
|
|
21
|
+
// 递归添加文件并排除目录
|
|
22
|
+
function addFilesToZip(directory) {
|
|
23
|
+
const files = fs.readdirSync(directory);
|
|
24
|
+
|
|
25
|
+
files.forEach(file => {
|
|
26
|
+
const fullPath = path.join(directory, file);
|
|
27
|
+
const relativePath = path.relative(parentDir, fullPath);
|
|
28
|
+
|
|
29
|
+
// 排除 DeekeScript 和 node_modules 目录
|
|
30
|
+
if (relativePath.startsWith('src') || relativePath.startsWith('.vscode') || relativePath.startsWith('.git') || relativePath.startsWith('@deekeScript') || relativePath.startsWith('node_modules')) {
|
|
31
|
+
console.log('排除目录:' + relativePath);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 处理子目录或文件
|
|
36
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
37
|
+
addFilesToZip(fullPath); // 递归处理子目录
|
|
38
|
+
} else {
|
|
39
|
+
zip.addLocalFile(fullPath, path.dirname(relativePath));
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// 执行压缩
|
|
45
|
+
addFilesToZip(parentDir);
|
|
46
|
+
zip.writeZip(path.join(parentDir, 'deekeScript.zip'));
|
|
47
|
+
|
|
48
|
+
console.log('打包完成');
|
package/gulpfile
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
const uglifyConfig = require('./uglify-config.json');
|
|
2
|
-
const gulp = require('gulp');
|
|
3
|
-
const uglify = require('gulp-uglify');
|
|
4
|
-
|
|
5
|
-
function compressJS() {
|
|
6
|
-
let config = ['script/**/*.js'];//需要混淆的文件
|
|
7
|
-
//不需要混淆
|
|
8
|
-
let exclude = [
|
|
9
|
-
"!script/statistics/*.js"
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
config = [...config, ...exclude];
|
|
13
|
-
return gulp.src(config).pipe(uglify(uglifyConfig)) // 应用 JSON 配置
|
|
14
|
-
.pipe(gulp.dest('script'));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
compressJS();
|
|
1
|
+
const uglifyConfig = require('./uglify-config.json');
|
|
2
|
+
const gulp = require('gulp');
|
|
3
|
+
const uglify = require('gulp-uglify');
|
|
4
|
+
|
|
5
|
+
function compressJS() {
|
|
6
|
+
let config = ['script/**/*.js'];//需要混淆的文件
|
|
7
|
+
//不需要混淆
|
|
8
|
+
let exclude = [
|
|
9
|
+
"!script/statistics/*.js"
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
config = [...config, ...exclude];
|
|
13
|
+
return gulp.src(config).pipe(uglify(uglifyConfig)) // 应用 JSON 配置
|
|
14
|
+
.pipe(gulp.dest('script'));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
compressJS();
|
|
Binary file
|
package/init
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
function generateFiles(answers) {
|
|
5
|
-
const projectPath = path.dirname(path.dirname(__dirname)); // 输出:/Users/username/project
|
|
6
|
-
const files = fs.readdirSync(projectPath);
|
|
7
|
-
|
|
8
|
-
if (files.includes('init.lock')) {
|
|
9
|
-
return ;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const entries = fs.readdirSync(__dirname, { withFileTypes: true });
|
|
13
|
-
const excludeFiles = ['node_modules']; // 需排除的文件名列表
|
|
14
|
-
|
|
15
|
-
const filteredEntries = entries.filter(entry =>
|
|
16
|
-
!excludeFiles.includes(entry.name)
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
filteredEntries.forEach(entry => {
|
|
20
|
-
const srcPath = path.join(__dirname, entry.name);
|
|
21
|
-
const destPath = path.join(projectPath, entry.name);
|
|
22
|
-
|
|
23
|
-
if (entry.isFile()) {
|
|
24
|
-
fs.copyFileSync(srcPath, destPath);
|
|
25
|
-
} else if (entry.isDirectory()) {
|
|
26
|
-
fs.cpSync(srcPath, destPath, { recursive: true });
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
generateFiles({});
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
function generateFiles(answers) {
|
|
5
|
+
const projectPath = path.dirname(path.dirname(__dirname)); // 输出:/Users/username/project
|
|
6
|
+
const files = fs.readdirSync(projectPath);
|
|
7
|
+
|
|
8
|
+
if (files.includes('init.lock')) {
|
|
9
|
+
return ;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const entries = fs.readdirSync(__dirname, { withFileTypes: true });
|
|
13
|
+
const excludeFiles = ['node_modules']; // 需排除的文件名列表
|
|
14
|
+
|
|
15
|
+
const filteredEntries = entries.filter(entry =>
|
|
16
|
+
!excludeFiles.includes(entry.name)
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
filteredEntries.forEach(entry => {
|
|
20
|
+
const srcPath = path.join(__dirname, entry.name);
|
|
21
|
+
const destPath = path.join(projectPath, entry.name);
|
|
22
|
+
|
|
23
|
+
if (entry.isFile()) {
|
|
24
|
+
fs.copyFileSync(srcPath, destPath);
|
|
25
|
+
} else if (entry.isDirectory()) {
|
|
26
|
+
fs.cpSync(srcPath, destPath, { recursive: true });
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
generateFiles({});
|