@xfe-repo/mini-app 2.0.0-beta.1 → 2.0.0-beta.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.
@@ -1,4 +1,7 @@
1
- {{- if .Values.virtualService.enabled }}
1
+ {{- if and .Values.virtualService .Values.virtualService.enabled }}
2
+ {{- $hosts := get (.Values.virtualService.hosts | default dict) .Values.envType | default list }}
3
+ {{- if .Values.host }}{{ $hosts = prepend $hosts .Values.host | uniq }}{{- end }}
4
+ {{- if $hosts }}
2
5
  apiVersion: networking.istio.io/v1alpha3
3
6
  kind: VirtualService
4
7
  metadata:
@@ -6,8 +9,7 @@ metadata:
6
9
  namespace: {{ include "template.namespace" . }}
7
10
  spec:
8
11
  hosts:
9
- {{- $host := (get .Values.virtualService.hosts .Values.envType) }}
10
- {{- range $host }}
12
+ {{- range $hosts }}
11
13
  - "{{ . }}"
12
14
  {{- end }}
13
15
  gateways:
@@ -19,14 +21,17 @@ spec:
19
21
  - match:
20
22
  - uri:
21
23
  prefix: /
24
+ {{- with .Values.virtualService.timeout }}
25
+ timeout: {{ . }}
26
+ {{- end }}
22
27
  route:
23
28
  - destination:
24
29
  host: {{ .Values.app }}
25
30
  port:
26
31
  number: 80
27
- corsPolicy:
28
- allowOrigin:
29
- - "*"
30
- allowMethods:
31
- - "*"
32
+ {{- with .Values.virtualService.corsPolicy }}
33
+ corsPolicy:
34
+ {{- toYaml . | nindent 8 }}
35
+ {{- end }}
36
+ {{- end }}
32
37
  {{- end }}
@@ -6,15 +6,48 @@ commitSHA: '<<CI_COMMIT_SHA>>'
6
6
  envType: '<<ENV_TYPE>>'
7
7
  hostPrefix: '<<HOST_PREFIX>>'
8
8
  namespace: ''
9
+ host: ''
9
10
  virtualService:
11
+ corsPolicy:
12
+ allowOrigin: ['*']
13
+ allowMethods: ['*']
10
14
  enabled: true
11
- hosts:
12
- test:
13
- - '<<HOST_PREFIX>>.exam.t.eshetang.com'
14
- stage:
15
- - 'stage.exam.t.eshetang.com'
16
- prod:
17
- - 'exam.eshetang.com'
15
+ hosts: {}
18
16
  gateways:
19
17
  - 'common-gateway-eshetang'
20
18
  targetK8s: 'saas'
19
+
20
+ # 可选持久卷;省略时保持现有无状态 Web 应用的部署行为。
21
+ persistence:
22
+ enabled: false
23
+ mountPath: /data
24
+ size: 20Gi
25
+ existingClaim: ''
26
+ storageClass: ''
27
+
28
+ # H5 使用 Nginx;不继承 Node 镜像的用户与安全上下文。
29
+ resources:
30
+ requests:
31
+ cpu: 100m
32
+ memory: 256Mi
33
+ limits:
34
+ cpu: '2'
35
+ memory: 1Gi
36
+ terminationGracePeriodSeconds: 40
37
+ # H5 默认检查 Nginx 首页,探针可局部覆盖或关闭。
38
+ startupProbe:
39
+ httpGet:
40
+ path: /
41
+ port: 80
42
+ failureThreshold: 30
43
+ periodSeconds: 2
44
+ readinessProbe:
45
+ httpGet:
46
+ path: /
47
+ port: 80
48
+ periodSeconds: 5
49
+ livenessProbe:
50
+ httpGet:
51
+ path: /
52
+ port: 80
53
+ periodSeconds: 15
@@ -1,167 +1,25 @@
1
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
- try {
3
- var info = gen[key](arg);
4
- var value = info.value;
5
- } catch (error) {
6
- reject(error);
7
- return;
8
- }
9
- if (info.done) {
10
- resolve(value);
11
- } else {
12
- Promise.resolve(value).then(_next, _throw);
13
- }
14
- }
15
- function _async_to_generator(fn) {
16
- return function() {
17
- var self = this, args = arguments;
18
- return new Promise(function(resolve, reject) {
19
- var gen = fn.apply(self, args);
20
- function _next(value) {
21
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
22
- }
23
- function _throw(err) {
24
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
25
- }
26
- _next(undefined);
27
- });
28
- };
29
- }
30
- function _ts_generator(thisArg, body) {
31
- var f, y, t, _ = {
32
- label: 0,
33
- sent: function() {
34
- if (t[0] & 1) throw t[1];
35
- return t[1];
36
- },
37
- trys: [],
38
- ops: []
39
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
40
- return d(g, "next", {
41
- value: verb(0)
42
- }), d(g, "throw", {
43
- value: verb(1)
44
- }), d(g, "return", {
45
- value: verb(2)
46
- }), typeof Symbol === "function" && d(g, Symbol.iterator, {
47
- value: function() {
48
- return this;
49
- }
50
- }), g;
51
- function verb(n) {
52
- return function(v) {
53
- return step([
54
- n,
55
- v
56
- ]);
57
- };
58
- }
59
- function step(op) {
60
- if (f) throw new TypeError("Generator is already executing.");
61
- while(g && (g = 0, op[0] && (_ = 0)), _)try {
62
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
63
- if (y = 0, t) op = [
64
- op[0] & 2,
65
- t.value
66
- ];
67
- switch(op[0]){
68
- case 0:
69
- case 1:
70
- t = op;
71
- break;
72
- case 4:
73
- _.label++;
74
- return {
75
- value: op[1],
76
- done: false
77
- };
78
- case 5:
79
- _.label++;
80
- y = op[1];
81
- op = [
82
- 0
83
- ];
84
- continue;
85
- case 7:
86
- op = _.ops.pop();
87
- _.trys.pop();
88
- continue;
89
- default:
90
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
91
- _ = 0;
92
- continue;
93
- }
94
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
95
- _.label = op[1];
96
- break;
97
- }
98
- if (op[0] === 6 && _.label < t[1]) {
99
- _.label = t[1];
100
- t = op;
101
- break;
102
- }
103
- if (t && _.label < t[2]) {
104
- _.label = t[2];
105
- _.ops.push(op);
106
- break;
107
- }
108
- if (t[2]) _.ops.pop();
109
- _.trys.pop();
110
- continue;
111
- }
112
- op = body.call(thisArg, _);
113
- } catch (e) {
114
- op = [
115
- 6,
116
- e
117
- ];
118
- y = 0;
119
- } finally{
120
- f = t = 0;
121
- }
122
- if (op[0] & 5) throw op[1];
123
- return {
124
- value: op[0] ? op[1] : void 0,
125
- done: true
126
- };
127
- }
128
- }
129
- import { choiceRobot, getProject } from "./chunk-MLSNG3O7.mjs";
1
+ import {
2
+ choiceRobot,
3
+ getProject
4
+ } from "./chunk-MLSNG3O7.mjs";
5
+
130
6
  // src/upload.ts
131
7
  import { upload } from "miniprogram-ci";
132
- function uploadMini(version) {
133
- var desc = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", progress = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
134
- return _async_to_generator(function() {
135
- var project, robot, onProgressUpdate;
136
- return _ts_generator(this, function(_state) {
137
- switch(_state.label){
138
- case 0:
139
- if (!version) throw new Error("\u8BF7\u4F20\u9012\u7248\u672C\u53F7\uFF01 -v \u6216\u8005 --version");
140
- project = getProject();
141
- robot = choiceRobot();
142
- onProgressUpdate = progress ? console.log : function() {
143
- return null;
144
- };
145
- return [
146
- 4,
147
- upload({
148
- project: project,
149
- version: version,
150
- robot: robot,
151
- desc: desc,
152
- onProgressUpdate: onProgressUpdate,
153
- setting: {
154
- es6: true
155
- }
156
- })
157
- ];
158
- case 1:
159
- _state.sent();
160
- return [
161
- 2
162
- ];
163
- }
164
- });
165
- })();
8
+ async function uploadMini(version, desc = "", progress = false) {
9
+ if (!version) throw new Error("\u8BF7\u4F20\u9012\u7248\u672C\u53F7\uFF01 -v \u6216\u8005 --version");
10
+ const project = getProject();
11
+ const robot = choiceRobot();
12
+ const onProgressUpdate = progress ? console.log : () => null;
13
+ await upload({
14
+ project,
15
+ version,
16
+ robot,
17
+ desc,
18
+ onProgressUpdate,
19
+ setting: { es6: true }
20
+ });
166
21
  }
167
- export { uploadMini };
22
+
23
+ export {
24
+ uploadMini
25
+ };