@xfe-repo/mini-app 2.0.0-beta.1 → 2.0.0-beta.3
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 +35 -0
- package/config/index.ts +2 -0
- package/deploy/.drone.yml +154 -156
- package/deploy/Dockerfile +4 -0
- package/deploy/helm/Chart.yaml +1 -1
- package/deploy/helm/templates/deployment.yaml +73 -22
- package/deploy/helm/templates/pvc.yaml +17 -0
- package/deploy/helm/templates/template.yaml +16 -0
- package/deploy/helm/templates/virtualService.yaml +48 -9
- package/deploy/helm/values.yaml +40 -7
- package/dist/chunk-2XEWB3XZ.mjs +157 -0
- package/dist/chunk-4JD7C4FF.mjs +22 -164
- package/dist/chunk-MLSNG3O7.mjs +67 -336
- package/dist/chunk-Y6FXYEAI.mjs +9 -10
- package/dist/cli.js +507 -703
- package/dist/cli.mjs +53 -367
- package/dist/config.d.mts +1 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +172 -301
- package/dist/config.mjs +10 -2
- package/dist/preview.js +87 -401
- package/dist/preview.mjs +10 -2
- package/dist/upload.js +83 -349
- package/dist/upload.mjs +6 -2
- package/dist/workspace-DZAPRE3A.mjs +220 -0
- package/package.json +5 -4
- package/dist/chunk-UC6ZB6VU.mjs +0 -242
package/dist/upload.js
CHANGED
|
@@ -1,375 +1,109 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3
|
-
try {
|
|
4
|
-
var info = gen[key](arg);
|
|
5
|
-
var value = info.value;
|
|
6
|
-
} catch (error) {
|
|
7
|
-
reject(error);
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
if (info.done) {
|
|
11
|
-
resolve(value);
|
|
12
|
-
} else {
|
|
13
|
-
Promise.resolve(value).then(_next, _throw);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function _async_to_generator(fn) {
|
|
17
|
-
return function() {
|
|
18
|
-
var self = this, args = arguments;
|
|
19
|
-
return new Promise(function(resolve, reject) {
|
|
20
|
-
var gen = fn.apply(self, args);
|
|
21
|
-
function _next(value) {
|
|
22
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
23
|
-
}
|
|
24
|
-
function _throw(err) {
|
|
25
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
26
|
-
}
|
|
27
|
-
_next(undefined);
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function _inherits(subClass, superClass) {
|
|
32
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
33
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
34
|
-
}
|
|
35
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
36
|
-
constructor: {
|
|
37
|
-
value: subClass,
|
|
38
|
-
writable: true,
|
|
39
|
-
configurable: true
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
if (superClass) _set_prototype_of(subClass, superClass);
|
|
43
|
-
}
|
|
44
|
-
function _set_prototype_of(o, p) {
|
|
45
|
-
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
46
|
-
o.__proto__ = p;
|
|
47
|
-
return o;
|
|
48
|
-
};
|
|
49
|
-
return _set_prototype_of(o, p);
|
|
50
|
-
}
|
|
51
|
-
function _type_of(obj) {
|
|
52
|
-
"@swc/helpers - typeof";
|
|
53
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
54
|
-
}
|
|
55
|
-
function _wrap_reg_exp(re, groups) {
|
|
56
|
-
_wrap_reg_exp = function(re, groups) {
|
|
57
|
-
return new WrappedRegExp(re, undefined, groups);
|
|
58
|
-
};
|
|
59
|
-
var _super = RegExp.prototype;
|
|
60
|
-
var _groups = new WeakMap();
|
|
61
|
-
function WrappedRegExp(re, flags, groups) {
|
|
62
|
-
var _re = new RegExp(re, flags);
|
|
63
|
-
_groups.set(_re, groups || _groups.get(re));
|
|
64
|
-
return _set_prototype_of(_re, WrappedRegExp.prototype);
|
|
65
|
-
}
|
|
66
|
-
_inherits(WrappedRegExp, RegExp);
|
|
67
|
-
WrappedRegExp.prototype.exec = function(str) {
|
|
68
|
-
var result = _super.exec.call(this, str);
|
|
69
|
-
if (result) {
|
|
70
|
-
result.groups = buildGroups(result, this);
|
|
71
|
-
var indices = result.indices;
|
|
72
|
-
if (indices) indices.groups = buildGroups(indices, this);
|
|
73
|
-
}
|
|
74
|
-
return result;
|
|
75
|
-
};
|
|
76
|
-
WrappedRegExp.prototype[Symbol.replace] = function(str, substitution) {
|
|
77
|
-
if (typeof substitution === "string") {
|
|
78
|
-
var groups = _groups.get(this);
|
|
79
|
-
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function(_, name) {
|
|
80
|
-
var group = groups ? groups[name] : undefined;
|
|
81
|
-
if (group === undefined) return "";
|
|
82
|
-
return "$" + (Array.isArray(group) ? group.join("$") : group);
|
|
83
|
-
}));
|
|
84
|
-
}
|
|
85
|
-
if (typeof substitution === "function") {
|
|
86
|
-
var _this = this;
|
|
87
|
-
return _super[Symbol.replace].call(this, str, function() {
|
|
88
|
-
var args = arguments;
|
|
89
|
-
if (typeof args[args.length - 1] !== "object") {
|
|
90
|
-
args = [].slice.call(args);
|
|
91
|
-
args.push(buildGroups(args, _this));
|
|
92
|
-
}
|
|
93
|
-
return substitution.apply(this, args);
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
return _super[Symbol.replace].call(this, str, substitution);
|
|
97
|
-
};
|
|
98
|
-
function buildGroups(result, re) {
|
|
99
|
-
var g = _groups.get(re);
|
|
100
|
-
return Object.keys(g).reduce(function(groups, name) {
|
|
101
|
-
var i = g[name];
|
|
102
|
-
if (typeof i === "number") groups[name] = result[i];
|
|
103
|
-
else {
|
|
104
|
-
var k = 0;
|
|
105
|
-
while(result[i[k]] === undefined && k + 1 < i.length)k++;
|
|
106
|
-
groups[name] = result[i[k]];
|
|
107
|
-
}
|
|
108
|
-
return groups;
|
|
109
|
-
}, Object.create(null));
|
|
110
|
-
}
|
|
111
|
-
return _wrap_reg_exp.apply(this, arguments);
|
|
112
|
-
}
|
|
113
|
-
function _ts_generator(thisArg, body) {
|
|
114
|
-
var f, y, t, _ = {
|
|
115
|
-
label: 0,
|
|
116
|
-
sent: function() {
|
|
117
|
-
if (t[0] & 1) throw t[1];
|
|
118
|
-
return t[1];
|
|
119
|
-
},
|
|
120
|
-
trys: [],
|
|
121
|
-
ops: []
|
|
122
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
123
|
-
return d(g, "next", {
|
|
124
|
-
value: verb(0)
|
|
125
|
-
}), d(g, "throw", {
|
|
126
|
-
value: verb(1)
|
|
127
|
-
}), d(g, "return", {
|
|
128
|
-
value: verb(2)
|
|
129
|
-
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
130
|
-
value: function() {
|
|
131
|
-
return this;
|
|
132
|
-
}
|
|
133
|
-
}), g;
|
|
134
|
-
function verb(n) {
|
|
135
|
-
return function(v) {
|
|
136
|
-
return step([
|
|
137
|
-
n,
|
|
138
|
-
v
|
|
139
|
-
]);
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
function step(op) {
|
|
143
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
144
|
-
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
145
|
-
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;
|
|
146
|
-
if (y = 0, t) op = [
|
|
147
|
-
op[0] & 2,
|
|
148
|
-
t.value
|
|
149
|
-
];
|
|
150
|
-
switch(op[0]){
|
|
151
|
-
case 0:
|
|
152
|
-
case 1:
|
|
153
|
-
t = op;
|
|
154
|
-
break;
|
|
155
|
-
case 4:
|
|
156
|
-
_.label++;
|
|
157
|
-
return {
|
|
158
|
-
value: op[1],
|
|
159
|
-
done: false
|
|
160
|
-
};
|
|
161
|
-
case 5:
|
|
162
|
-
_.label++;
|
|
163
|
-
y = op[1];
|
|
164
|
-
op = [
|
|
165
|
-
0
|
|
166
|
-
];
|
|
167
|
-
continue;
|
|
168
|
-
case 7:
|
|
169
|
-
op = _.ops.pop();
|
|
170
|
-
_.trys.pop();
|
|
171
|
-
continue;
|
|
172
|
-
default:
|
|
173
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
174
|
-
_ = 0;
|
|
175
|
-
continue;
|
|
176
|
-
}
|
|
177
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
178
|
-
_.label = op[1];
|
|
179
|
-
break;
|
|
180
|
-
}
|
|
181
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
182
|
-
_.label = t[1];
|
|
183
|
-
t = op;
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
186
|
-
if (t && _.label < t[2]) {
|
|
187
|
-
_.label = t[2];
|
|
188
|
-
_.ops.push(op);
|
|
189
|
-
break;
|
|
190
|
-
}
|
|
191
|
-
if (t[2]) _.ops.pop();
|
|
192
|
-
_.trys.pop();
|
|
193
|
-
continue;
|
|
194
|
-
}
|
|
195
|
-
op = body.call(thisArg, _);
|
|
196
|
-
} catch (e) {
|
|
197
|
-
op = [
|
|
198
|
-
6,
|
|
199
|
-
e
|
|
200
|
-
];
|
|
201
|
-
y = 0;
|
|
202
|
-
} finally{
|
|
203
|
-
f = t = 0;
|
|
204
|
-
}
|
|
205
|
-
if (op[0] & 5) throw op[1];
|
|
206
|
-
return {
|
|
207
|
-
value: op[0] ? op[1] : void 0,
|
|
208
|
-
done: true
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
2
|
var __create = Object.create;
|
|
213
3
|
var __defProp = Object.defineProperty;
|
|
214
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
215
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
216
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
217
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
218
|
-
var __export =
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
enumerable: true
|
|
222
|
-
});
|
|
223
|
-
};
|
|
224
|
-
var __copyProps = function __copyProps(to, from, except, desc) {
|
|
225
|
-
if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
|
|
226
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
227
|
-
try {
|
|
228
|
-
var _loop = function() {
|
|
229
|
-
var key = _step.value;
|
|
230
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
231
|
-
get: function get() {
|
|
232
|
-
return from[key];
|
|
233
|
-
},
|
|
234
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
235
|
-
});
|
|
236
|
-
};
|
|
237
|
-
for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
238
|
-
} catch (err) {
|
|
239
|
-
_didIteratorError = true;
|
|
240
|
-
_iteratorError = err;
|
|
241
|
-
} finally{
|
|
242
|
-
try {
|
|
243
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
244
|
-
_iterator.return();
|
|
245
|
-
}
|
|
246
|
-
} finally{
|
|
247
|
-
if (_didIteratorError) {
|
|
248
|
-
throw _iteratorError;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
return to;
|
|
254
|
-
};
|
|
255
|
-
var __toESM = function __toESM(mod, isNodeMode, target) {
|
|
256
|
-
return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
|
|
257
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
258
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
259
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
260
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
261
|
-
value: mod,
|
|
262
|
-
enumerable: true
|
|
263
|
-
}) : target, mod);
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
264
11
|
};
|
|
265
|
-
var
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
269
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
270
30
|
// src/upload.ts
|
|
271
31
|
var upload_exports = {};
|
|
272
32
|
__export(upload_exports, {
|
|
273
|
-
|
|
274
|
-
return uploadMini;
|
|
275
|
-
}
|
|
33
|
+
uploadMini: () => uploadMini
|
|
276
34
|
});
|
|
277
35
|
module.exports = __toCommonJS(upload_exports);
|
|
278
36
|
var import_miniprogram_ci2 = require("miniprogram-ci");
|
|
37
|
+
|
|
279
38
|
// src/preview.ts
|
|
280
39
|
var import_fs = __toESM(require("fs"));
|
|
281
40
|
var import_path = __toESM(require("path"));
|
|
282
41
|
var import_miniprogram_ci = require("miniprogram-ci");
|
|
283
|
-
var getProject =
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
]
|
|
307
|
-
});
|
|
42
|
+
var getProject = () => {
|
|
43
|
+
let rwaPrivateKey = "", rawProjectConfig = "";
|
|
44
|
+
const projectRoot = process.cwd();
|
|
45
|
+
try {
|
|
46
|
+
rwaPrivateKey = import_fs.default.readFileSync(import_path.default.join(projectRoot, "private.key")).toString();
|
|
47
|
+
} catch {
|
|
48
|
+
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");
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
rawProjectConfig = import_fs.default.readFileSync(import_path.default.join(projectRoot, "project.config.json")).toString();
|
|
53
|
+
} catch {
|
|
54
|
+
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");
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
const projectConfig = JSON.parse(rawProjectConfig);
|
|
58
|
+
return new import_miniprogram_ci.Project({
|
|
59
|
+
appid: projectConfig.appid,
|
|
60
|
+
projectPath: projectConfig.miniprogramRoot,
|
|
61
|
+
privateKey: rwaPrivateKey,
|
|
62
|
+
type: "miniProgram",
|
|
63
|
+
ignores: ["node_modules/**/*"]
|
|
64
|
+
});
|
|
308
65
|
};
|
|
309
|
-
var choiceRobot =
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
console.log("将使用CI".concat(robot, "机器人"));
|
|
334
|
-
return robot;
|
|
66
|
+
var choiceRobot = () => {
|
|
67
|
+
const { API_ENV = "" } = process.env;
|
|
68
|
+
const { groups } = API_ENV.match(/^(?<env>prod|beta|stage|test)(?<sn>.*)/) || {};
|
|
69
|
+
const env = groups?.env || "other";
|
|
70
|
+
const sn = Number(groups?.sn) || 0;
|
|
71
|
+
let robot;
|
|
72
|
+
switch (env) {
|
|
73
|
+
case "prod":
|
|
74
|
+
case "beta":
|
|
75
|
+
robot = 1;
|
|
76
|
+
break;
|
|
77
|
+
case "stage":
|
|
78
|
+
robot = 2;
|
|
79
|
+
break;
|
|
80
|
+
case "test":
|
|
81
|
+
robot = sn % 29 >= 3 ? sn % 29 : 3;
|
|
82
|
+
break;
|
|
83
|
+
case "other":
|
|
84
|
+
robot = 30;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
console.log(`\u5C06\u4F7F\u7528CI${robot}\u673A\u5668\u4EBA`);
|
|
88
|
+
return robot;
|
|
335
89
|
};
|
|
90
|
+
|
|
336
91
|
// src/upload.ts
|
|
337
|
-
function uploadMini(version) {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
return [
|
|
351
|
-
4,
|
|
352
|
-
(0, import_miniprogram_ci2.upload)({
|
|
353
|
-
project: project,
|
|
354
|
-
version: version,
|
|
355
|
-
robot: robot,
|
|
356
|
-
desc: desc,
|
|
357
|
-
onProgressUpdate: onProgressUpdate,
|
|
358
|
-
setting: {
|
|
359
|
-
es6: true
|
|
360
|
-
}
|
|
361
|
-
})
|
|
362
|
-
];
|
|
363
|
-
case 1:
|
|
364
|
-
_state.sent();
|
|
365
|
-
return [
|
|
366
|
-
2
|
|
367
|
-
];
|
|
368
|
-
}
|
|
369
|
-
});
|
|
370
|
-
})();
|
|
92
|
+
async function uploadMini(version, desc = "", progress = false) {
|
|
93
|
+
if (!version) throw new Error("\u8BF7\u4F20\u9012\u7248\u672C\u53F7\uFF01 -v \u6216\u8005 --version");
|
|
94
|
+
const project = getProject();
|
|
95
|
+
const robot = choiceRobot();
|
|
96
|
+
const onProgressUpdate = progress ? console.log : () => null;
|
|
97
|
+
await (0, import_miniprogram_ci2.upload)({
|
|
98
|
+
project,
|
|
99
|
+
version,
|
|
100
|
+
robot,
|
|
101
|
+
desc,
|
|
102
|
+
onProgressUpdate,
|
|
103
|
+
setting: { es6: true }
|
|
104
|
+
});
|
|
371
105
|
}
|
|
372
106
|
// Annotate the CommonJS export names for ESM import in node:
|
|
373
107
|
0 && (module.exports = {
|
|
374
|
-
|
|
108
|
+
uploadMini
|
|
375
109
|
});
|