@xfe-repo/mini-app 1.6.5 → 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.
- package/README.md +64 -2
- package/babel.config.js +2 -12
- package/config/dev.ts +1 -25
- package/config/index.ts +52 -21
- package/config/prod.ts +1 -7
- package/deploy/.drone.yml +153 -160
- package/deploy/Dockerfile +4 -0
- package/deploy/helm/Chart.yaml +1 -1
- package/deploy/helm/templates/deployment.yaml +60 -22
- package/deploy/helm/templates/pvc.yaml +17 -0
- package/deploy/helm/templates/template.yaml +16 -0
- package/deploy/helm/templates/virtualService.yaml +13 -8
- package/deploy/helm/values.yaml +40 -7
- package/dist/chunk-4JD7C4FF.mjs +22 -164
- package/dist/chunk-MLSNG3O7.mjs +67 -336
- package/dist/chunk-MSNDQMQN.mjs +153 -0
- package/dist/chunk-Y6FXYEAI.mjs +10 -0
- package/dist/cli.js +504 -681
- package/dist/cli.mjs +55 -348
- package/dist/config.d.mts +6 -5
- package/dist/config.d.ts +6 -5
- package/dist/config.js +168 -298
- package/dist/config.mjs +11 -2
- package/dist/preview.js +87 -401
- package/dist/preview.mjs +11 -2
- package/dist/upload.js +83 -349
- package/dist/upload.mjs +7 -2
- package/dist/workspace-7FXUJJOQ.mjs +220 -0
- package/package.json +19 -18
- package/dist/chunk-75BJNL7E.mjs +0 -239
package/deploy/helm/values.yaml
CHANGED
|
@@ -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
|
package/dist/chunk-4JD7C4FF.mjs
CHANGED
|
@@ -1,167 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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
|
-
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
uploadMini
|
|
25
|
+
};
|
package/dist/chunk-MLSNG3O7.mjs
CHANGED
|
@@ -1,343 +1,74 @@
|
|
|
1
|
-
function _array_like_to_array(arr, len) {
|
|
2
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
-
return arr2;
|
|
5
|
-
}
|
|
6
|
-
function _array_with_holes(arr) {
|
|
7
|
-
if (Array.isArray(arr)) return arr;
|
|
8
|
-
}
|
|
9
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
10
|
-
try {
|
|
11
|
-
var info = gen[key](arg);
|
|
12
|
-
var value = info.value;
|
|
13
|
-
} catch (error) {
|
|
14
|
-
reject(error);
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
if (info.done) {
|
|
18
|
-
resolve(value);
|
|
19
|
-
} else {
|
|
20
|
-
Promise.resolve(value).then(_next, _throw);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function _async_to_generator(fn) {
|
|
24
|
-
return function() {
|
|
25
|
-
var self = this, args = arguments;
|
|
26
|
-
return new Promise(function(resolve, reject) {
|
|
27
|
-
var gen = fn.apply(self, args);
|
|
28
|
-
function _next(value) {
|
|
29
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
30
|
-
}
|
|
31
|
-
function _throw(err) {
|
|
32
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
33
|
-
}
|
|
34
|
-
_next(undefined);
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function _inherits(subClass, superClass) {
|
|
39
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
40
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
41
|
-
}
|
|
42
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
43
|
-
constructor: {
|
|
44
|
-
value: subClass,
|
|
45
|
-
writable: true,
|
|
46
|
-
configurable: true
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
if (superClass) _set_prototype_of(subClass, superClass);
|
|
50
|
-
}
|
|
51
|
-
function _iterable_to_array_limit(arr, i) {
|
|
52
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
53
|
-
if (_i == null) return;
|
|
54
|
-
var _arr = [];
|
|
55
|
-
var _n = true;
|
|
56
|
-
var _d = false;
|
|
57
|
-
var _s, _e;
|
|
58
|
-
try {
|
|
59
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
60
|
-
_arr.push(_s.value);
|
|
61
|
-
if (i && _arr.length === i) break;
|
|
62
|
-
}
|
|
63
|
-
} catch (err) {
|
|
64
|
-
_d = true;
|
|
65
|
-
_e = err;
|
|
66
|
-
} finally{
|
|
67
|
-
try {
|
|
68
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
69
|
-
} finally{
|
|
70
|
-
if (_d) throw _e;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return _arr;
|
|
74
|
-
}
|
|
75
|
-
function _non_iterable_rest() {
|
|
76
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
77
|
-
}
|
|
78
|
-
function _set_prototype_of(o, p) {
|
|
79
|
-
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
80
|
-
o.__proto__ = p;
|
|
81
|
-
return o;
|
|
82
|
-
};
|
|
83
|
-
return _set_prototype_of(o, p);
|
|
84
|
-
}
|
|
85
|
-
function _sliced_to_array(arr, i) {
|
|
86
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
87
|
-
}
|
|
88
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
89
|
-
if (!o) return;
|
|
90
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
91
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
92
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
93
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
94
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
95
|
-
}
|
|
96
|
-
function _wrap_reg_exp(re, groups) {
|
|
97
|
-
_wrap_reg_exp = function(re, groups) {
|
|
98
|
-
return new WrappedRegExp(re, undefined, groups);
|
|
99
|
-
};
|
|
100
|
-
var _super = RegExp.prototype;
|
|
101
|
-
var _groups = new WeakMap();
|
|
102
|
-
function WrappedRegExp(re, flags, groups) {
|
|
103
|
-
var _re = new RegExp(re, flags);
|
|
104
|
-
_groups.set(_re, groups || _groups.get(re));
|
|
105
|
-
return _set_prototype_of(_re, WrappedRegExp.prototype);
|
|
106
|
-
}
|
|
107
|
-
_inherits(WrappedRegExp, RegExp);
|
|
108
|
-
WrappedRegExp.prototype.exec = function(str) {
|
|
109
|
-
var result = _super.exec.call(this, str);
|
|
110
|
-
if (result) {
|
|
111
|
-
result.groups = buildGroups(result, this);
|
|
112
|
-
var indices = result.indices;
|
|
113
|
-
if (indices) indices.groups = buildGroups(indices, this);
|
|
114
|
-
}
|
|
115
|
-
return result;
|
|
116
|
-
};
|
|
117
|
-
WrappedRegExp.prototype[Symbol.replace] = function(str, substitution) {
|
|
118
|
-
if (typeof substitution === "string") {
|
|
119
|
-
var groups = _groups.get(this);
|
|
120
|
-
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function(_, name) {
|
|
121
|
-
var group = groups ? groups[name] : undefined;
|
|
122
|
-
if (group === undefined) return "";
|
|
123
|
-
return "$" + (Array.isArray(group) ? group.join("$") : group);
|
|
124
|
-
}));
|
|
125
|
-
}
|
|
126
|
-
if (typeof substitution === "function") {
|
|
127
|
-
var _this = this;
|
|
128
|
-
return _super[Symbol.replace].call(this, str, function() {
|
|
129
|
-
var args = arguments;
|
|
130
|
-
if (typeof args[args.length - 1] !== "object") {
|
|
131
|
-
args = [].slice.call(args);
|
|
132
|
-
args.push(buildGroups(args, _this));
|
|
133
|
-
}
|
|
134
|
-
return substitution.apply(this, args);
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
return _super[Symbol.replace].call(this, str, substitution);
|
|
138
|
-
};
|
|
139
|
-
function buildGroups(result, re) {
|
|
140
|
-
var g = _groups.get(re);
|
|
141
|
-
return Object.keys(g).reduce(function(groups, name) {
|
|
142
|
-
var i = g[name];
|
|
143
|
-
if (typeof i === "number") groups[name] = result[i];
|
|
144
|
-
else {
|
|
145
|
-
var k = 0;
|
|
146
|
-
while(result[i[k]] === undefined && k + 1 < i.length)k++;
|
|
147
|
-
groups[name] = result[i[k]];
|
|
148
|
-
}
|
|
149
|
-
return groups;
|
|
150
|
-
}, Object.create(null));
|
|
151
|
-
}
|
|
152
|
-
return _wrap_reg_exp.apply(this, arguments);
|
|
153
|
-
}
|
|
154
|
-
function _ts_generator(thisArg, body) {
|
|
155
|
-
var f, y, t, _ = {
|
|
156
|
-
label: 0,
|
|
157
|
-
sent: function() {
|
|
158
|
-
if (t[0] & 1) throw t[1];
|
|
159
|
-
return t[1];
|
|
160
|
-
},
|
|
161
|
-
trys: [],
|
|
162
|
-
ops: []
|
|
163
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
164
|
-
return d(g, "next", {
|
|
165
|
-
value: verb(0)
|
|
166
|
-
}), d(g, "throw", {
|
|
167
|
-
value: verb(1)
|
|
168
|
-
}), d(g, "return", {
|
|
169
|
-
value: verb(2)
|
|
170
|
-
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
171
|
-
value: function() {
|
|
172
|
-
return this;
|
|
173
|
-
}
|
|
174
|
-
}), g;
|
|
175
|
-
function verb(n) {
|
|
176
|
-
return function(v) {
|
|
177
|
-
return step([
|
|
178
|
-
n,
|
|
179
|
-
v
|
|
180
|
-
]);
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
function step(op) {
|
|
184
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
185
|
-
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
186
|
-
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;
|
|
187
|
-
if (y = 0, t) op = [
|
|
188
|
-
op[0] & 2,
|
|
189
|
-
t.value
|
|
190
|
-
];
|
|
191
|
-
switch(op[0]){
|
|
192
|
-
case 0:
|
|
193
|
-
case 1:
|
|
194
|
-
t = op;
|
|
195
|
-
break;
|
|
196
|
-
case 4:
|
|
197
|
-
_.label++;
|
|
198
|
-
return {
|
|
199
|
-
value: op[1],
|
|
200
|
-
done: false
|
|
201
|
-
};
|
|
202
|
-
case 5:
|
|
203
|
-
_.label++;
|
|
204
|
-
y = op[1];
|
|
205
|
-
op = [
|
|
206
|
-
0
|
|
207
|
-
];
|
|
208
|
-
continue;
|
|
209
|
-
case 7:
|
|
210
|
-
op = _.ops.pop();
|
|
211
|
-
_.trys.pop();
|
|
212
|
-
continue;
|
|
213
|
-
default:
|
|
214
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
215
|
-
_ = 0;
|
|
216
|
-
continue;
|
|
217
|
-
}
|
|
218
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
219
|
-
_.label = op[1];
|
|
220
|
-
break;
|
|
221
|
-
}
|
|
222
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
223
|
-
_.label = t[1];
|
|
224
|
-
t = op;
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
if (t && _.label < t[2]) {
|
|
228
|
-
_.label = t[2];
|
|
229
|
-
_.ops.push(op);
|
|
230
|
-
break;
|
|
231
|
-
}
|
|
232
|
-
if (t[2]) _.ops.pop();
|
|
233
|
-
_.trys.pop();
|
|
234
|
-
continue;
|
|
235
|
-
}
|
|
236
|
-
op = body.call(thisArg, _);
|
|
237
|
-
} catch (e) {
|
|
238
|
-
op = [
|
|
239
|
-
6,
|
|
240
|
-
e
|
|
241
|
-
];
|
|
242
|
-
y = 0;
|
|
243
|
-
} finally{
|
|
244
|
-
f = t = 0;
|
|
245
|
-
}
|
|
246
|
-
if (op[0] & 5) throw op[1];
|
|
247
|
-
return {
|
|
248
|
-
value: op[0] ? op[1] : void 0,
|
|
249
|
-
done: true
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
1
|
// src/preview.ts
|
|
254
2
|
import fs from "fs";
|
|
255
3
|
import path from "path";
|
|
256
4
|
import { Project, preview } from "miniprogram-ci";
|
|
257
|
-
var getProject =
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
]
|
|
281
|
-
});
|
|
5
|
+
var getProject = () => {
|
|
6
|
+
let rwaPrivateKey = "", rawProjectConfig = "";
|
|
7
|
+
const projectRoot = process.cwd();
|
|
8
|
+
try {
|
|
9
|
+
rwaPrivateKey = fs.readFileSync(path.join(projectRoot, "private.key")).toString();
|
|
10
|
+
} catch {
|
|
11
|
+
console.error("Error: \u8BF7\u5728\u9879\u76EE\u6839\u76EE\u5F55\u4E0B\u521B\u5EFA private.key \u6587\u4EF6\uFF0C\u5185\u5BB9\u4E3A\u5C0F\u7A0B\u5E8F\u7684\u79C1\u94A5");
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
rawProjectConfig = fs.readFileSync(path.join(projectRoot, "project.config.json")).toString();
|
|
16
|
+
} catch {
|
|
17
|
+
console.error("Error: \u8BF7\u5728\u9879\u76EE\u6839\u76EE\u5F55\u4E0B\u521B\u5EFA project.config.json \u6587\u4EF6\uFF0C\u5185\u5BB9\u4E3A\u5C0F\u7A0B\u5E8F\u7684\u914D\u7F6E");
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
const projectConfig = JSON.parse(rawProjectConfig);
|
|
21
|
+
return new Project({
|
|
22
|
+
appid: projectConfig.appid,
|
|
23
|
+
projectPath: projectConfig.miniprogramRoot,
|
|
24
|
+
privateKey: rwaPrivateKey,
|
|
25
|
+
type: "miniProgram",
|
|
26
|
+
ignores: ["node_modules/**/*"]
|
|
27
|
+
});
|
|
282
28
|
};
|
|
283
|
-
function previewMini(version) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
qrcodeFormat: "terminal",
|
|
299
|
-
qrcodeOutputDest: "deploy/preview.qrcode.jpg",
|
|
300
|
-
pagePath: pagePath,
|
|
301
|
-
searchQuery: searchQuery,
|
|
302
|
-
desc: desc,
|
|
303
|
-
robot: robot,
|
|
304
|
-
scene: scene
|
|
305
|
-
})
|
|
306
|
-
];
|
|
307
|
-
case 1:
|
|
308
|
-
_state.sent();
|
|
309
|
-
return [
|
|
310
|
-
2
|
|
311
|
-
];
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
})();
|
|
29
|
+
async function previewMini(version, pageUrl = "", desc = "", scene = 1011, progress = false) {
|
|
30
|
+
const [pagePath, searchQuery] = pageUrl.split("?");
|
|
31
|
+
const project = getProject();
|
|
32
|
+
const robot = choiceRobot();
|
|
33
|
+
await preview({
|
|
34
|
+
project,
|
|
35
|
+
version,
|
|
36
|
+
qrcodeFormat: "terminal",
|
|
37
|
+
qrcodeOutputDest: "deploy/preview.qrcode.jpg",
|
|
38
|
+
pagePath,
|
|
39
|
+
searchQuery,
|
|
40
|
+
desc,
|
|
41
|
+
robot,
|
|
42
|
+
scene
|
|
43
|
+
});
|
|
315
44
|
}
|
|
316
|
-
var choiceRobot =
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
45
|
+
var choiceRobot = () => {
|
|
46
|
+
const { API_ENV = "" } = process.env;
|
|
47
|
+
const { groups } = API_ENV.match(/^(?<env>prod|beta|stage|test)(?<sn>.*)/) || {};
|
|
48
|
+
const env = groups?.env || "other";
|
|
49
|
+
const sn = Number(groups?.sn) || 0;
|
|
50
|
+
let robot;
|
|
51
|
+
switch (env) {
|
|
52
|
+
case "prod":
|
|
53
|
+
case "beta":
|
|
54
|
+
robot = 1;
|
|
55
|
+
break;
|
|
56
|
+
case "stage":
|
|
57
|
+
robot = 2;
|
|
58
|
+
break;
|
|
59
|
+
case "test":
|
|
60
|
+
robot = sn % 29 >= 3 ? sn % 29 : 3;
|
|
61
|
+
break;
|
|
62
|
+
case "other":
|
|
63
|
+
robot = 30;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
console.log(`\u5C06\u4F7F\u7528CI${robot}\u673A\u5668\u4EBA`);
|
|
67
|
+
return robot;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export {
|
|
71
|
+
getProject,
|
|
72
|
+
previewMini,
|
|
73
|
+
choiceRobot
|
|
342
74
|
};
|
|
343
|
-
export { getProject, previewMini, choiceRobot };
|