You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- 🆕 generate-version-file add EXTERNAL env,can be used to display richer content when customizing the popup UI. Such as current version updates or other information
Copy file name to clipboardExpand all lines: README.md
+43-22Lines changed: 43 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -115,6 +115,8 @@ Step 2: after executing the `generate-version-file` custom command, generate the
115
115
116
116
- File output directory (optional): **user defined version.json output directory**, which is the dist directory by default
117
117
118
+
-`EXTERNAL` (optional): when you want to save more information to `version.json`, such as the modified content of the current version or other things that need to be displayed on the pop-up (used in onVersionUpdate custom UI) `v1.6.0`
119
+
118
120
```javascript
119
121
// package.json
120
122
@@ -137,6 +139,35 @@ Step 2: after executing the `generate-version-file` custom command, generate the
137
139
138
140
```
139
141
142
+
**EXTERNAL usage**`v1.6.0`
143
+
144
+
JSON format please use this tool to escape [click here](https://codebeautify.org/json-encode-online)
If your project is connected to CDN, it is strongly recommended that you set the `version.json` file is set to always no caching (configure in nginx or turn off the function of CDN ignoring the parameter cache)
@@ -311,17 +342,16 @@ If your card copy will be generated according to conditions, you can pass in `ME
311
342
...
312
343
// Mac or Linux system
313
344
"send-lark-message:test": "MESSAGE_JSON='{\"title\":\"This is a dynamically generated title\",\"version\":\"1.1.0-beta\",\"accessUrl\":\"http://test.example.com\",\"isNotifyAll\":true}' send-lark-message"
314
-
// Windows system: install cross-env first
315
-
// npm install cross-env -D
316
-
"send-lark-message:test": "cross-env MESSAGE_JSON='{\"title\":\"This is a dynamically generated title\",\"version\":\"1.1.0-beta\",\"accessUrl\":\"http://test.example.com\",\"isNotifyAll\":true}' send-lark-message"
345
+
// Windows system
346
+
"send-lark-message:test": "set MESSAGE_JSON={\"title\":\"This is a dynamically generated title\",\"version\":\"1.1.0-beta\",\"accessUrl\":\"http://test.example.com\",\"isNotifyAll\":true} && send-lark-message"
317
347
...
318
348
},
319
349
...
320
350
}
321
351
322
352
```
323
353
324
-
Or after export variables, quote in package.json
354
+
Or after export variables, quote in package.json (not support Windows)
325
355
326
356
```javascript
327
357
@@ -340,11 +370,7 @@ sh "export messageJSON='{\"title\": \"This is a title\"}'"
@@ -467,16 +493,15 @@ If your card copy will be generated according to conditions, you can pass in `ME
467
493
...
468
494
// Mac or Linux system
469
495
"send-wecom-message:test": "MESSAGE_JSON='{\"title\":\"This is a dynamically generated title\",\"version\":\"1.1.0-beta\",\"accessUrl\":\"http://test.example.com\",\"isNotifyAll\":true}' send-wecom-message"
470
-
// Windows system: install cross-env first
471
-
// npm install cross-env -D
472
-
"send-wecom-message:test": "cross-env MESSAGE_JSON='{\"title\":\"This is a dynamically generated title\",\"version\":\"1.1.0-beta\",\"accessUrl\":\"http://test.example.com\",\"isNotifyAll\":true}' send-wecom-message"
496
+
// Windows system
497
+
"send-wecom-message:test": "set MESSAGE_JSON={\"title\":\"This is a dynamically generated title\",\"version\":\"1.1.0-beta\",\"accessUrl\":\"http://test.example.com\",\"isNotifyAll\":true} && send-wecom-message"
473
498
...
474
499
},
475
500
...
476
501
}
477
502
```
478
503
479
-
Or after export variables, quote in package.json
504
+
Or after export variables, quote in package.json (not support Windows)
480
505
481
506
```javascript
482
507
@@ -493,11 +518,7 @@ sh "export messageJSON='{\"title\": \"This is a title\"}'"
@@ -541,17 +562,17 @@ sh "export messageJSON='{\"title\": \"This is a title\"}'"
541
562
| config.originVersionFileUrl | string | The path to the version.json file on the remote server | | Yes |
542
563
| config.localPackageVersion | string | The version of the current application usually takes the version field of package.json for comparison with the version.json file of the remote server | | Yes |
543
564
| config.pollingTime | number | Time interval for polling monitoring, in ms | 5000 | No |
544
-
| config.immediate | boolean | On the first visit, version monitoring will be triggered immediately, and then polling will be conducted at a customized time interval **`V 1.5.0`** | false | No |
565
+
| config.immediate | boolean | On the first visit, version monitoring will be triggered immediately, and then polling will be conducted at a customized time interval **`v1.5.0`** | false | No |
545
566
| config.onVersionUpdate | function(data) | Callback function for custom version hint UI (if you want to customize the popup UI, you can get the return value through the callback function to control the appearance of the popup) | | No |
546
-
| config.onRefresh | function(data) | Confirm update: the callback function of the custom refresh event, where data is the latest version **`V 1.5.0`** | | No |
547
-
| config.onCancel | function(data) | Cancel update: the callback function of the custom cancel event, where data is the latest version **`V 1.5.0`** | | No |
567
+
| config.onRefresh | function(data) | Confirm update: the callback function of the custom refresh event, where data is the latest version **`v1.5.0`** | | No |
568
+
| config.onCancel | function(data) | Cancel update: the callback function of the custom cancel event, where data is the latest version **`v1.5.0`** | | No |
548
569
| options | object | Configuration items for popup text and themes (not customize the popup UI, but use it if you need to modify the text and themes) | | No |
549
570
| options.title | string | Popup title | Update | No |
550
571
| options.description | string | Popup description | V xxx is available | No |
551
572
| options.buttonText | string | Popup button text | Refresh | No |
552
-
| options.cancelButtonText | string | Text to close pop-up button (add this option, if you want the pop-up to be allowed to be close) **`V 1.5.0`** | | No |
553
-
| options.cancelMode | ignore-current-version / ignore-today / ignore-current-window | Close pop-up mode (It takes effect when cancelButtonText is set) **`V 1.5.0`** | ignore-current-version | No |
554
-
| options.cancelUpdateAndStopWorker | boolean | When the popup is cancelled, the worker is also stopped (It takes effect when cancelButtonText is set) **`V 1.5.0`** | false | 否 |
573
+
| options.cancelButtonText | string | Text to close pop-up button (add this option, if you want the pop-up to be allowed to be close) **`v1.5.0`** | | No |
574
+
| options.cancelMode | ignore-current-version / ignore-today / ignore-current-window | Close pop-up mode (It takes effect when cancelButtonText is set) **`v1.5.0`** | ignore-current-version | No |
575
+
| options.cancelUpdateAndStopWorker | boolean | When the popup is cancelled, the worker is also stopped (It takes effect when cancelButtonText is set) **`v1.5.0`** | false | 否 |
| options.rocketColor | string | The popup picture's theme color of the rocket, after setting Options.imageUrl is invalid || No |
557
578
| options.primaryColor | string | The theme color of the popup, it will affect the hint image background color and button background color, after setting imageUrl is invalid || No |
"send-lark-message:test": "MESSAGE_JSON='{\"title\":\"This is a dynamically generated title\",\"version\":\"1.1.0-beta\",\"accessUrl\":\"http://test.example.com\",\"isNotifyAll\":true}' send-lark-message"
313
-
// Windows 系统先安装 cross-env
314
-
// npm install cross-env -D
315
-
"send-lark-message:test": "cross-env MESSAGE_JSON='{\"title\":\"This is a dynamically generated title\",\"version\":\"1.1.0-beta\",\"accessUrl\":\"http://test.example.com\",\"isNotifyAll\":true}' send-lark-message"
343
+
// Windows 系统
344
+
"send-lark-message:test": "set MESSAGE_JSON={\"title\":\"This is a dynamically generated title\",\"version\":\"1.1.0-beta\",\"accessUrl\":\"http://test.example.com\",\"isNotifyAll\":true} && send-lark-message"
316
345
...
317
346
},
318
347
...
319
348
}
320
349
321
350
```
322
351
323
-
或 export 变量后, 在 package.json 中引用
352
+
或 export 变量后, 在 package.json 中引用 (不支持 Windows)
324
353
325
354
```javascript
326
355
@@ -339,11 +368,7 @@ sh "export messageJSON='{\"title\": \"This is a title\"}'"
@@ -462,16 +487,15 @@ sh "export messageJSON='{\"title\": \"This is a title\"}'"
462
487
...
463
488
// Mac 或 Linux 系统
464
489
"send-wecom-message:test": "MESSAGE_JSON='{\"title\":\"This is a dynamically generated title\",\"version\":\"1.1.0-beta\",\"accessUrl\":\"http://test.example.com\",\"isNotifyAll\":true}' send-wecom-message"
465
-
// Windows 系统先安装 cross-env
466
-
// npm install cross-env -D
467
-
"send-wecom-message:test": "cross-env MESSAGE_JSON='{\"title\":\"This is a dynamically generated title\",\"version\":\"1.1.0-beta\",\"accessUrl\":\"http://test.example.com\",\"isNotifyAll\":true}' send-wecom-message"
490
+
// Windows 系统
491
+
"send-wecom-message:test": "set MESSAGE_JSON={\"title\":\"This is a dynamically generated title\",\"version\":\"1.1.0-beta\",\"accessUrl\":\"http://test.example.com\",\"isNotifyAll\":true} && send-wecom-message"
468
492
...
469
493
},
470
494
...
471
495
}
472
496
```
473
497
474
-
或 export 变量后, 在 `package.json` 中引用
498
+
或 export 变量后, 在 `package.json` 中引用 (不支持 Windows)
475
499
476
500
```javascript
477
501
@@ -488,11 +512,7 @@ sh "export messageJSON='{\"title\": \"This is a title\"}'"
0 commit comments