Skip to content

Commit 17f258a

Browse files
authored
feat(env): update dependency and add new miniapp env judge (#132)
* feat(env): add kuaishou and baidu miniapp env judge
1 parent 428f664 commit 17f258a

File tree

9 files changed

+122
-91
lines changed

9 files changed

+122
-91
lines changed

.github/workflows/auto-publisher.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ name: Auto Publisher
33
on:
44
push:
55
branches:
6-
- master
7-
- 'releases/**'
6+
- stable
87

98
jobs:
109
build-and-publish:

packages/env/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changelog
2+
3+
## [3.3.0] - 2021-03-15
4+
5+
### Added
6+
7+
- Add KuaiShou MiniProgram and Baidu SmartProgram env judge
8+
9+
### Changed
10+
11+
- Use @uni/env as dependency
12+

packages/env/README-en-US.md

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Judge runtime environment
44

55
## Support
6-
<img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /> <img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> <img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px"> <img alt="bytedanceMicroApp" src="https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg" width="25px" height="25px"> <img alt="quickApp" src="https://gw.alicdn.com/tfs/TB1MP7EwQT2gK0jSZPcXXcKkpXa-200-200.svg" width="25px" height="25px">
6+
<img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /> <img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> <img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px"> <img alt="bytedanceMicroApp" src="https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg" width="25px" height="25px"> <img alt="quickApp" src="https://gw.alicdn.com/tfs/TB1MP7EwQT2gK0jSZPcXXcKkpXa-200-200.svg" width="25px" height="25px"> <img alt="baiduSmartProgram" src="https://img.alicdn.com/imgextra/i4/O1CN01jngdBb24yGv2Fu34G_!!6000000007459-2-tps-200-200.png" width="25px" height="25px" title="百度小程序"> <img alt="kuaiShouMiniProgram" src="https://gw.alicdn.com/imgextra/i4/O1CN01kzmJMM24jcFEzp5Wv_!!6000000007427-2-tps-200-200.png" width="25px" height="25px" title="快手小程序">
77

88
## Install
99
```bash
@@ -12,7 +12,7 @@ $ npm install universal-env --save
1212

1313
## Usage
1414
```javascript
15-
import { isWeex, isWeb, isMiniApp, isNode, isWeChatMiniProgram, isByteDanceMicroApp, isQuickApp } from 'universal-env';
15+
import { isWeex, isWeb, isMiniApp, isNode, isWeChatMiniProgram, isByteDanceMicroApp, isQuickApp, isBaiduSmartProgram, isKuaiShouMiniProgram } from 'universal-env';
1616

1717
```
1818

@@ -32,6 +32,12 @@ Checks if environment is a wechat miniprogram environment.
3232
### `isByteDanceMicroApp: boolean`
3333
Checks if environment is a bytedance microapp environment.
3434

35+
### `isBaiduSmartProgram: boolean`
36+
Checks if environment is a baidu smartprogram environment.
37+
38+
### `isKuaiShouMiniProgram: boolean`
39+
Checks if environment is a kuaishou miniprogram environment.
40+
3541
### `isQuickApp: boolean`
3642
Checks if environment is a quickapp environment.
3743

@@ -42,18 +48,22 @@ Checks if environment is a Node.js environment.
4248

4349
Note:To judge MiniProgram env in WebView, please insert JS SDK accordingly.
4450

45-
| | isMiniApp | isWeChatMiniProgram | isByteDanceMicroApp | isQuickApp | isWeb | isWeex | isNode |
46-
| ----------------------------- | --------- | ------------------- | ------------------- | ---------- | ----- | ------ | ------ |
47-
| Alibaba MiniApp | ✔️ |||||||
48-
| Alibaba MiniApp WebView | ✔️ |||| ✔️ |||
49-
| Wechat MiniProgram || ✔️ ||||||
50-
| Wechat MiniProgram WebView || ✔️ ||| ✔️ |||
51-
| ByteDance MicroApp ||| ✔️ |||||
52-
| ByteDance MicroApp WebView ||| ✔️ || ✔️ |||
53-
| QuickApp |||| ✔️ ||||
54-
| QuickApp WebView ||||| ✔️ |||
55-
| Weex |||||| ✔️ ||
56-
| Node ||||||| ✔️ |
57-
| Web ||||| ✔️ |||
51+
| | isMiniApp | isWeChatMiniProgram | isByteDanceMicroApp | isQuickApp | isWeb | isWeex | isNode | isKuaiShouMiniProgram | isBaiduSmartProgram |
52+
| ----------------------------- | --------- | ------------------- | ------------------- | ---------- | ----- | ------ | ------ | ------ | ------ |
53+
| Alibaba MiniApp | ✔️ |||||||||
54+
| Alibaba MiniApp WebView | ✔️ |||| ✔️ |||||
55+
| Wechat MiniProgram || ✔️ ||||||||
56+
| Wechat MiniProgram WebView || ✔️ ||| ✔️ |||||
57+
| ByteDance MicroApp ||| ✔️ |||||||
58+
| ByteDance MicroApp WebView ||| ✔️ || ✔️ |||||
59+
| KuaiShou MiniProgram ||| ✔️ |||||✔️||
60+
| KuaiShou MiniProgram WebView ||| ✔️ || ✔️ |||✔️||
61+
| Baidu SmartProgram |||||||||✔️|
62+
| Baidu SmartProgram WebView |||||||||✔️|
63+
| QuickApp |||| ✔️ ||||||
64+
| QuickApp WebView ||||| ✔️ |||||
65+
| Weex |||||| ✔️ ||||
66+
| Node ||||||| ✔️ |||
67+
| Web ||||| ✔️ |||||
5868

5969

packages/env/README.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
判断和获取运行时环境
44

55
## 支持
6-
<img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /> <img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> <img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px"> <img alt="bytedanceMicroApp" src="https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg" width="25px" height="25px"> <img alt="quickApp" src="https://gw.alicdn.com/tfs/TB1MP7EwQT2gK0jSZPcXXcKkpXa-200-200.svg" width="25px" height="25px">
6+
<img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /> <img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> <img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px"> <img alt="bytedanceMicroApp" src="https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg" width="25px" height="25px"> <img alt="quickApp" src="https://gw.alicdn.com/tfs/TB1MP7EwQT2gK0jSZPcXXcKkpXa-200-200.svg" width="25px" height="25px"> <img alt="baiduSmartProgram" src="https://img.alicdn.com/imgextra/i4/O1CN01jngdBb24yGv2Fu34G_!!6000000007459-2-tps-200-200.png" width="25px" height="25px" title="百度小程序"> <img alt="kuaiShouMiniProgram" src="https://gw.alicdn.com/imgextra/i4/O1CN01kzmJMM24jcFEzp5Wv_!!6000000007427-2-tps-200-200.png" width="25px" height="25px" title="快手小程序">
77

88
## 安装
99
```bash
@@ -12,7 +12,7 @@ $ npm install universal-env --save
1212

1313
## 示例
1414
```javascript
15-
import { isWeex, isWeb, isMiniApp, isNode, isWeChatMiniProgram, isByteDanceMicroApp, isQuickApp } from 'universal-env';
15+
import { isWeex, isWeb, isMiniApp, isNode, isWeChatMiniProgram, isByteDanceMicroApp, isQuickApp, isBaiduSmartProgram, isKuaiShouMiniProgram } from 'universal-env';
1616

1717
```
1818

@@ -32,6 +32,12 @@ import { isWeex, isWeb, isMiniApp, isNode, isWeChatMiniProgram, isByteDanceMicro
3232
### `isByteDanceMicroApp: boolean`
3333
校验字节跳动小程序环境
3434

35+
### `isBaiduSmartProgram: boolean`
36+
校验百度小程序环境
37+
38+
### `isKuaiShouMiniProgram: boolean`
39+
校验快手小程序环境
40+
3541
### `isQuickApp: boolean`
3642
校验快应用环境
3743

@@ -42,19 +48,21 @@ import { isWeex, isWeb, isMiniApp, isNode, isWeChatMiniProgram, isByteDanceMicro
4248

4349
注:以下各小程序 WebView 内容器判断依赖 WebView 中注入容器的JS SDK。
4450

45-
| | isMiniApp | isWeChatMiniProgram | isByteDanceMicroApp | isQuickApp | isWeb | isWeex | isNode |
46-
| ------------------- | --------- | ------------------- | ------------------ | ---------- | ----- | ------ | ------ |
47-
| 阿里小程序 | ✔️ |||||||
48-
| 阿里小程序 WebView | ✔️ |||| ✔️ |||
49-
| 微信小程序 || ✔️ ||||||
50-
| 微信小程序 WebView || ✔️ ||| ✔️ |||
51-
| 字节跳动小程序 ||| ✔️ |||||
52-
| 字节跳动小程序 WebView ||| ✔️ || ✔️ |||
53-
| 快应用 |||| ✔️ ||||
54-
| 快应用 WebView ||||| ✔️ |||
55-
| Weex |||||| ✔️ ||
56-
| Node ||||||| ✔️ |
57-
| Web ||||| ✔️ |||
58-
59-
51+
| | isMiniApp | isWeChatMiniProgram | isByteDanceMicroApp | isQuickApp | isWeb | isWeex | isNode | isKuaiShouMiniProgram | isBaiduSmartProgram |
52+
| ----------------------------- | --------- | ------------------- | ------------------- | ---------- | ----- | ------ | ------ | ------ | ------ |
53+
| 阿里小程序 | ✔️ |||||||||
54+
| 阿里小程序 WebView | ✔️ |||| ✔️ |||||
55+
| 微信小程序 || ✔️ ||||||||
56+
| 微信小程序 WebView || ✔️ ||| ✔️ |||||
57+
| 字节跳动小程序 ||| ✔️ |||||||
58+
| 字节跳动小程序 WebView ||| ✔️ || ✔️ |||||
59+
| 快手小程序 ||| ✔️ |||||✔️||
60+
| 快手小程序 WebView ||| ✔️ || ✔️ |||✔️||
61+
| 百度小程序 |||||||||✔️|
62+
| 百度小程序 WebView |||||||||✔️|
63+
| 快应用 |||| ✔️ ||||||
64+
| 快应用 WebView ||||| ✔️ |||||
65+
| Weex |||||| ✔️ ||||
66+
| Node ||||||| ✔️ |||
67+
| Web ||||| ✔️ |||||
6068

0 commit comments

Comments
 (0)