@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/dist/cli.mjs
CHANGED
|
@@ -1,355 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 _define_property(obj, key, value) {
|
|
39
|
-
if (key in obj) {
|
|
40
|
-
Object.defineProperty(obj, key, {
|
|
41
|
-
value: value,
|
|
42
|
-
enumerable: true,
|
|
43
|
-
configurable: true,
|
|
44
|
-
writable: true
|
|
45
|
-
});
|
|
46
|
-
} else {
|
|
47
|
-
obj[key] = value;
|
|
48
|
-
}
|
|
49
|
-
return obj;
|
|
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 _object_spread(target) {
|
|
79
|
-
for(var i = 1; i < arguments.length; i++){
|
|
80
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
81
|
-
var ownKeys = Object.keys(source);
|
|
82
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
83
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
84
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
85
|
-
}));
|
|
86
|
-
}
|
|
87
|
-
ownKeys.forEach(function(key) {
|
|
88
|
-
_define_property(target, key, source[key]);
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
return target;
|
|
92
|
-
}
|
|
93
|
-
function ownKeys(object, enumerableOnly) {
|
|
94
|
-
var keys = Object.keys(object);
|
|
95
|
-
if (Object.getOwnPropertySymbols) {
|
|
96
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
97
|
-
if (enumerableOnly) {
|
|
98
|
-
symbols = symbols.filter(function(sym) {
|
|
99
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
keys.push.apply(keys, symbols);
|
|
103
|
-
}
|
|
104
|
-
return keys;
|
|
105
|
-
}
|
|
106
|
-
function _object_spread_props(target, source) {
|
|
107
|
-
source = source != null ? source : {};
|
|
108
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
109
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
110
|
-
} else {
|
|
111
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
112
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
return target;
|
|
116
|
-
}
|
|
117
|
-
function _object_without_properties(source, excluded) {
|
|
118
|
-
if (source == null) return {};
|
|
119
|
-
var target = {}, sourceKeys, key, i;
|
|
120
|
-
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
121
|
-
sourceKeys = Reflect.ownKeys(Object(source));
|
|
122
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
123
|
-
key = sourceKeys[i];
|
|
124
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
125
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
126
|
-
target[key] = source[key];
|
|
127
|
-
}
|
|
128
|
-
return target;
|
|
129
|
-
}
|
|
130
|
-
target = _object_without_properties_loose(source, excluded);
|
|
131
|
-
if (Object.getOwnPropertySymbols) {
|
|
132
|
-
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
133
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
134
|
-
key = sourceKeys[i];
|
|
135
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
136
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
137
|
-
target[key] = source[key];
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return target;
|
|
141
|
-
}
|
|
142
|
-
function _object_without_properties_loose(source, excluded) {
|
|
143
|
-
if (source == null) return {};
|
|
144
|
-
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
145
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
146
|
-
key = sourceKeys[i];
|
|
147
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
148
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
149
|
-
target[key] = source[key];
|
|
150
|
-
}
|
|
151
|
-
return target;
|
|
152
|
-
}
|
|
153
|
-
function _sliced_to_array(arr, i) {
|
|
154
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
155
|
-
}
|
|
156
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
157
|
-
if (!o) return;
|
|
158
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
159
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
160
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
161
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
162
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
163
|
-
}
|
|
164
|
-
function _ts_generator(thisArg, body) {
|
|
165
|
-
var f, y, t, _ = {
|
|
166
|
-
label: 0,
|
|
167
|
-
sent: function() {
|
|
168
|
-
if (t[0] & 1) throw t[1];
|
|
169
|
-
return t[1];
|
|
170
|
-
},
|
|
171
|
-
trys: [],
|
|
172
|
-
ops: []
|
|
173
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
174
|
-
return d(g, "next", {
|
|
175
|
-
value: verb(0)
|
|
176
|
-
}), d(g, "throw", {
|
|
177
|
-
value: verb(1)
|
|
178
|
-
}), d(g, "return", {
|
|
179
|
-
value: verb(2)
|
|
180
|
-
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
181
|
-
value: function() {
|
|
182
|
-
return this;
|
|
183
|
-
}
|
|
184
|
-
}), g;
|
|
185
|
-
function verb(n) {
|
|
186
|
-
return function(v) {
|
|
187
|
-
return step([
|
|
188
|
-
n,
|
|
189
|
-
v
|
|
190
|
-
]);
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
function step(op) {
|
|
194
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
195
|
-
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
196
|
-
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;
|
|
197
|
-
if (y = 0, t) op = [
|
|
198
|
-
op[0] & 2,
|
|
199
|
-
t.value
|
|
200
|
-
];
|
|
201
|
-
switch(op[0]){
|
|
202
|
-
case 0:
|
|
203
|
-
case 1:
|
|
204
|
-
t = op;
|
|
205
|
-
break;
|
|
206
|
-
case 4:
|
|
207
|
-
_.label++;
|
|
208
|
-
return {
|
|
209
|
-
value: op[1],
|
|
210
|
-
done: false
|
|
211
|
-
};
|
|
212
|
-
case 5:
|
|
213
|
-
_.label++;
|
|
214
|
-
y = op[1];
|
|
215
|
-
op = [
|
|
216
|
-
0
|
|
217
|
-
];
|
|
218
|
-
continue;
|
|
219
|
-
case 7:
|
|
220
|
-
op = _.ops.pop();
|
|
221
|
-
_.trys.pop();
|
|
222
|
-
continue;
|
|
223
|
-
default:
|
|
224
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
225
|
-
_ = 0;
|
|
226
|
-
continue;
|
|
227
|
-
}
|
|
228
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
229
|
-
_.label = op[1];
|
|
230
|
-
break;
|
|
231
|
-
}
|
|
232
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
233
|
-
_.label = t[1];
|
|
234
|
-
t = op;
|
|
235
|
-
break;
|
|
236
|
-
}
|
|
237
|
-
if (t && _.label < t[2]) {
|
|
238
|
-
_.label = t[2];
|
|
239
|
-
_.ops.push(op);
|
|
240
|
-
break;
|
|
241
|
-
}
|
|
242
|
-
if (t[2]) _.ops.pop();
|
|
243
|
-
_.trys.pop();
|
|
244
|
-
continue;
|
|
245
|
-
}
|
|
246
|
-
op = body.call(thisArg, _);
|
|
247
|
-
} catch (e) {
|
|
248
|
-
op = [
|
|
249
|
-
6,
|
|
250
|
-
e
|
|
251
|
-
];
|
|
252
|
-
y = 0;
|
|
253
|
-
} finally{
|
|
254
|
-
f = t = 0;
|
|
255
|
-
}
|
|
256
|
-
if (op[0] & 5) throw op[1];
|
|
257
|
-
return {
|
|
258
|
-
value: op[0] ? op[1] : void 0,
|
|
259
|
-
done: true
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
import { configDeploy, getJwtEnv } from "./chunk-75BJNL7E.mjs";
|
|
264
|
-
import { uploadMini } from "./chunk-4JD7C4FF.mjs";
|
|
265
|
-
import { previewMini } from "./chunk-MLSNG3O7.mjs";
|
|
1
|
+
import {
|
|
2
|
+
configDeploy,
|
|
3
|
+
getJwtEnv
|
|
4
|
+
} from "./chunk-MSNDQMQN.mjs";
|
|
5
|
+
import {
|
|
6
|
+
uploadMini
|
|
7
|
+
} from "./chunk-4JD7C4FF.mjs";
|
|
8
|
+
import {
|
|
9
|
+
previewMini
|
|
10
|
+
} from "./chunk-MLSNG3O7.mjs";
|
|
11
|
+
import {
|
|
12
|
+
__require
|
|
13
|
+
} from "./chunk-Y6FXYEAI.mjs";
|
|
14
|
+
|
|
266
15
|
// src/cli.ts
|
|
267
16
|
import minimist from "minimist";
|
|
268
17
|
import path from "path";
|
|
269
|
-
import {
|
|
18
|
+
import { execFileSync } from "child_process";
|
|
270
19
|
var argv = minimist(process.argv.slice(2));
|
|
271
|
-
var
|
|
272
|
-
|
|
273
|
-
]);
|
|
274
|
-
var _commands = _sliced_to_array(commands, 1), command = _commands[0];
|
|
20
|
+
var { _: commands, ...args } = argv;
|
|
21
|
+
var [command] = commands;
|
|
275
22
|
var appPackageRoot = path.resolve(__dirname, "../");
|
|
276
23
|
var appProjectRoot = process.cwd();
|
|
277
|
-
var env =
|
|
278
|
-
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
4,
|
|
316
|
-
getJwtEnv()
|
|
317
|
-
];
|
|
318
|
-
case 3:
|
|
319
|
-
jwtEnv1 = _state.sent();
|
|
320
|
-
execSync("taro build ".concat(argsString), {
|
|
321
|
-
stdio: "inherit",
|
|
322
|
-
cwd: appPackageRoot,
|
|
323
|
-
env: _object_spread({}, env, jwtEnv1)
|
|
324
|
-
});
|
|
325
|
-
return [
|
|
326
|
-
3,
|
|
327
|
-
5
|
|
328
|
-
];
|
|
329
|
-
case 4:
|
|
330
|
-
if (command === "config") {
|
|
331
|
-
configDeploy();
|
|
332
|
-
} else if (command === "upload") {
|
|
333
|
-
v = argv.v, version = argv.version, d = argv.d, desc = argv.desc, P = argv.P, progress = argv.progress;
|
|
334
|
-
void uploadMini(v || version, d || desc, P || progress).catch(console.error).finally(function() {
|
|
335
|
-
return process.exit(0);
|
|
336
|
-
});
|
|
337
|
-
} else if (command === "preview") {
|
|
338
|
-
v1 = argv.v, version1 = argv.version, p = argv.p, previewPath = argv.path, d1 = argv.d, desc1 = argv.desc, s = argv.s, scene = argv.scene, P1 = argv.P, progress1 = argv.progress;
|
|
339
|
-
void previewMini(v1 || version1, p || previewPath, d1 || desc1, s || scene, P1 || progress1).finally(function() {
|
|
340
|
-
return process.exit(0);
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
_state.label = 5;
|
|
344
|
-
case 5:
|
|
345
|
-
return [
|
|
346
|
-
2
|
|
347
|
-
];
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
})();
|
|
351
|
-
}
|
|
352
|
-
main().catch(function(err) {
|
|
353
|
-
console.error("XFE Mini CLI \u6267\u884C\u51FA\u9519:", err);
|
|
354
|
-
process.exit(1);
|
|
24
|
+
var env = { ...process.env, APP_PROJECT_ROOT: appProjectRoot };
|
|
25
|
+
var taroBin = __require.resolve("@tarojs/cli/bin/taro");
|
|
26
|
+
var taroArgs = Object.entries(args).map(([key, value]) => `--${key}=${value}`);
|
|
27
|
+
async function main() {
|
|
28
|
+
if (command === "dev") {
|
|
29
|
+
const jwtEnv = await getJwtEnv();
|
|
30
|
+
execFileSync(process.execPath, [taroBin, "build", "--watch", ...taroArgs], {
|
|
31
|
+
stdio: "inherit",
|
|
32
|
+
cwd: appPackageRoot,
|
|
33
|
+
env: { ...env, ...jwtEnv }
|
|
34
|
+
});
|
|
35
|
+
} else if (command === "build") {
|
|
36
|
+
const jwtEnv = await getJwtEnv();
|
|
37
|
+
execFileSync(process.execPath, [taroBin, "build", ...taroArgs], {
|
|
38
|
+
stdio: "inherit",
|
|
39
|
+
cwd: appPackageRoot,
|
|
40
|
+
env: { ...env, ...jwtEnv }
|
|
41
|
+
});
|
|
42
|
+
} else if (command === "config") {
|
|
43
|
+
const { configWorkspace, printDeployment } = await import("./workspace-7FXUJJOQ.mjs");
|
|
44
|
+
if (argv.workspace)
|
|
45
|
+
return configWorkspace({
|
|
46
|
+
workspaceRoot: path.resolve(argv.workspace),
|
|
47
|
+
frameworkRoot: appPackageRoot
|
|
48
|
+
});
|
|
49
|
+
configDeploy();
|
|
50
|
+
if (argv.json) printDeployment(appPackageRoot);
|
|
51
|
+
} else if (command === "upload") {
|
|
52
|
+
const { v, version, d, desc, P, progress } = argv;
|
|
53
|
+
await uploadMini(v || version, d || desc, P || progress);
|
|
54
|
+
} else if (command === "preview") {
|
|
55
|
+
const { v, version, p, path: previewPath, d, desc, s, scene, P, progress } = argv;
|
|
56
|
+
await previewMini(v || version, p || previewPath, d || desc, s || scene, P || progress);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
main().catch((err) => {
|
|
60
|
+
console.error("XFE Mini CLI \u6267\u884C\u51FA\u9519:", err);
|
|
61
|
+
process.exit(1);
|
|
355
62
|
});
|
package/dist/config.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
declare const loadXfeConfig: () => Record<string, any>;
|
|
2
|
+
/** 使用与 Web 一致的项目部署目录和 Helm values 契约。 */
|
|
2
3
|
declare const configDeploy: () => void;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* 仅在项目声明了旧 BFF JWT 时获取签名密钥。
|
|
6
|
+
* 直连新 API 的小程序不需要这组构建时凭据。
|
|
7
|
+
*/
|
|
8
|
+
declare const getJwtEnv: () => Promise<Record<string, string>>;
|
|
8
9
|
|
|
9
10
|
export { configDeploy, getJwtEnv, loadXfeConfig };
|
package/dist/config.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
declare const loadXfeConfig: () => Record<string, any>;
|
|
2
|
+
/** 使用与 Web 一致的项目部署目录和 Helm values 契约。 */
|
|
2
3
|
declare const configDeploy: () => void;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* 仅在项目声明了旧 BFF JWT 时获取签名密钥。
|
|
6
|
+
* 直连新 API 的小程序不需要这组构建时凭据。
|
|
7
|
+
*/
|
|
8
|
+
declare const getJwtEnv: () => Promise<Record<string, string>>;
|
|
8
9
|
|
|
9
10
|
export { configDeploy, getJwtEnv, loadXfeConfig };
|