@sevenvip666/rop 0.1.2 → 0.1.4
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/dist/bin/index.mjs +105 -70
- package/dist/cjs/index.js +51 -38
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +41 -25
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/index.mjs
CHANGED
|
@@ -210,7 +210,6 @@ var TauriConfig = /** @class */ (function () {
|
|
|
210
210
|
this.identifier = identifier;
|
|
211
211
|
}
|
|
212
212
|
TauriConfig.fromBaseConfig = function (tauriDir) {
|
|
213
|
-
console.log(tauriDir);
|
|
214
213
|
if (existsSync(join(tauriDir, 'tauri.conf.json'))) {
|
|
215
214
|
var contents = readFileSync(join(tauriDir, 'tauri.conf.json')).toString();
|
|
216
215
|
var config = _tryParseJsonConfig(contents);
|
|
@@ -559,13 +558,15 @@ function loadJsonWithEnv(_a) {
|
|
|
559
558
|
config = inputConfig;
|
|
560
559
|
}
|
|
561
560
|
if (!config.platforms || Object.keys(config.platforms).length == 0) {
|
|
562
|
-
|
|
561
|
+
console.log(colors.red('The platforms property in rop.json cannot be empty.'));
|
|
562
|
+
return;
|
|
563
563
|
}
|
|
564
564
|
var _autoEnv = getAutoEnvByFramework((_d = config === null || config === void 0 ? void 0 : config.framework) === null || _d === void 0 ? void 0 : _d.name, config.projectPath);
|
|
565
565
|
env = __assign(__assign(__assign({}, env), (_autoEnv !== null && _autoEnv !== void 0 ? _autoEnv : {})), ((_f = (_e = config.framework) === null || _e === void 0 ? void 0 : _e.env) !== null && _f !== void 0 ? _f : {}));
|
|
566
566
|
// 确保配置文件中存在 host 属性
|
|
567
567
|
if (!env.version) {
|
|
568
|
-
|
|
568
|
+
console.log(colors.red('The version property in rop.json cannot be empty.'));
|
|
569
|
+
return;
|
|
569
570
|
}
|
|
570
571
|
// 递归函数来替换对象中的字符串值
|
|
571
572
|
function replaceEnvInObject(obj) {
|
|
@@ -582,8 +583,8 @@ function loadJsonWithEnv(_a) {
|
|
|
582
583
|
}
|
|
583
584
|
replaceEnvInObject(config);
|
|
584
585
|
var targetInfos = getTargetInfo(config.platforms, platform, _arch);
|
|
585
|
-
console.log(
|
|
586
|
-
console.log(targetInfos);
|
|
586
|
+
console.log(colors.cyan("find target file:"));
|
|
587
|
+
console.log("".concat(JSON.stringify(targetInfos)));
|
|
587
588
|
return { config: config, targetInfos: targetInfos, version: env.version, arch: _arch };
|
|
588
589
|
}
|
|
589
590
|
var loadConfigJSON = function () {
|
|
@@ -637,8 +638,13 @@ var RopUploadApi = /** @class */ (function () {
|
|
|
637
638
|
switch (_c.label) {
|
|
638
639
|
case 0:
|
|
639
640
|
if (!config.accessKey) {
|
|
640
|
-
if (!config.token
|
|
641
|
-
|
|
641
|
+
if (!config.token) {
|
|
642
|
+
console.log(colors.red("Either accessKey or token must be used"));
|
|
643
|
+
return [2 /*return*/, false];
|
|
644
|
+
}
|
|
645
|
+
if (!config.projectId) {
|
|
646
|
+
console.log(colors.red("projectId cannot be empty"));
|
|
647
|
+
return [2 /*return*/, false];
|
|
642
648
|
}
|
|
643
649
|
}
|
|
644
650
|
if (!((_b = config.branch) !== null && _b !== void 0)) return [3 /*break*/, 1];
|
|
@@ -651,22 +657,27 @@ var RopUploadApi = /** @class */ (function () {
|
|
|
651
657
|
case 3:
|
|
652
658
|
branch = _a;
|
|
653
659
|
if (!branch) {
|
|
654
|
-
|
|
660
|
+
console.log(colors.red("branch cannot be empty"));
|
|
661
|
+
return [2 /*return*/, false];
|
|
655
662
|
}
|
|
656
663
|
else {
|
|
657
664
|
config.branch = branch;
|
|
658
665
|
}
|
|
659
666
|
if (!config.platform) {
|
|
660
|
-
|
|
667
|
+
console.log(colors.red("platform cannot be empty"));
|
|
668
|
+
return [2 /*return*/, false];
|
|
661
669
|
}
|
|
662
670
|
if (!config.arch) {
|
|
663
|
-
|
|
671
|
+
console.log(colors.red("arch cannot be empty"));
|
|
672
|
+
return [2 /*return*/, false];
|
|
664
673
|
}
|
|
665
674
|
if (!config.targetPath) {
|
|
666
|
-
|
|
675
|
+
console.log(colors.red("target path cannot be empty"));
|
|
676
|
+
return [2 /*return*/, false];
|
|
667
677
|
}
|
|
668
678
|
if (!fs.existsSync(config.targetPath)) {
|
|
669
|
-
|
|
679
|
+
console.log(colors.red("target file not found, file path: ".concat(config.targetPath)));
|
|
680
|
+
return [2 /*return*/, false];
|
|
670
681
|
}
|
|
671
682
|
// 如果更新包不存在的情况使用本身的包
|
|
672
683
|
if (config.updatePath && !fs.existsSync(config.updatePath)) {
|
|
@@ -674,7 +685,8 @@ var RopUploadApi = /** @class */ (function () {
|
|
|
674
685
|
config.updateName = config.targetName;
|
|
675
686
|
}
|
|
676
687
|
if (!config.version) {
|
|
677
|
-
|
|
688
|
+
console.log(colors.red("version cannot be empty"));
|
|
689
|
+
return [2 /*return*/, false];
|
|
678
690
|
}
|
|
679
691
|
return [2 /*return*/, config];
|
|
680
692
|
}
|
|
@@ -691,6 +703,9 @@ var RopUploadApi = /** @class */ (function () {
|
|
|
691
703
|
case 0: return [4 /*yield*/, this.checkParams(_config)];
|
|
692
704
|
case 1:
|
|
693
705
|
config = _c.sent();
|
|
706
|
+
if (!config) {
|
|
707
|
+
return [2 /*return*/];
|
|
708
|
+
}
|
|
694
709
|
formData = new FormData();
|
|
695
710
|
fileStream = fs.createReadStream(config.targetPath);
|
|
696
711
|
multibar = new cliProgress.MultiBar({
|
|
@@ -737,7 +752,7 @@ var RopUploadApi = /** @class */ (function () {
|
|
|
737
752
|
formData.append('signature', config.signature);
|
|
738
753
|
}
|
|
739
754
|
if (config.autoRelease) {
|
|
740
|
-
formData.append('autoRelease', config.autoRelease);
|
|
755
|
+
formData.append('autoRelease', String(config.autoRelease));
|
|
741
756
|
}
|
|
742
757
|
return [4 /*yield*/, fetch$1("".concat(this.baseDomain, "/api/upload"), {
|
|
743
758
|
method: 'POST',
|
|
@@ -755,6 +770,7 @@ var RopUploadApi = /** @class */ (function () {
|
|
|
755
770
|
multibar.stop();
|
|
756
771
|
fileStream.destroy();
|
|
757
772
|
updateFileStream === null || updateFileStream === void 0 ? void 0 : updateFileStream.destroy();
|
|
773
|
+
console.log(colors.green("Upload success!"));
|
|
758
774
|
return [2 /*return*/, { success: res.ok, body: body }];
|
|
759
775
|
}
|
|
760
776
|
});
|
|
@@ -863,8 +879,9 @@ var AuthApi = /** @class */ (function () {
|
|
|
863
879
|
AuthApi.prototype.login = function (req) {
|
|
864
880
|
return __awaiter(this, void 0, void 0, function () {
|
|
865
881
|
var res, resBody, homedir, userFilePath;
|
|
866
|
-
|
|
867
|
-
|
|
882
|
+
var _a;
|
|
883
|
+
return __generator(this, function (_b) {
|
|
884
|
+
switch (_b.label) {
|
|
868
885
|
case 0: return [4 /*yield*/, fetch("".concat(this.baseDomain).concat(LOGIN_API), {
|
|
869
886
|
method: 'POST',
|
|
870
887
|
headers: {
|
|
@@ -873,18 +890,13 @@ var AuthApi = /** @class */ (function () {
|
|
|
873
890
|
body: JSON.stringify(req),
|
|
874
891
|
})];
|
|
875
892
|
case 1:
|
|
876
|
-
res =
|
|
893
|
+
res = _b.sent();
|
|
877
894
|
return [4 /*yield*/, res.json()];
|
|
878
895
|
case 2:
|
|
879
|
-
resBody =
|
|
896
|
+
resBody = _b.sent();
|
|
880
897
|
if (!res.ok || !resBody.data) {
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
}
|
|
884
|
-
else {
|
|
885
|
-
console.log(JSON.stringify(resBody));
|
|
886
|
-
}
|
|
887
|
-
return [2 /*return*/];
|
|
898
|
+
console.log(colors.red("Login failed: status:".concat(res.status, ", message:").concat((_a = resBody.message) !== null && _a !== void 0 ? _a : res.statusText)));
|
|
899
|
+
return [2 /*return*/, false];
|
|
888
900
|
}
|
|
889
901
|
homedir = path.join(os.homedir(), '.rop');
|
|
890
902
|
if (!fs.existsSync(homedir)) {
|
|
@@ -892,7 +904,7 @@ var AuthApi = /** @class */ (function () {
|
|
|
892
904
|
}
|
|
893
905
|
userFilePath = path.join(homedir, 'user');
|
|
894
906
|
fs.writeFileSync(userFilePath, JSON.stringify(resBody.data, null, 2), 'utf8');
|
|
895
|
-
return [2 /*return
|
|
907
|
+
return [2 /*return*/, true];
|
|
896
908
|
}
|
|
897
909
|
});
|
|
898
910
|
});
|
|
@@ -906,8 +918,8 @@ var AuthApi = /** @class */ (function () {
|
|
|
906
918
|
homedir = path.join(os.homedir(), '.rop');
|
|
907
919
|
userFilePath = path.join(homedir, 'user');
|
|
908
920
|
if (!fs.existsSync(userFilePath)) {
|
|
909
|
-
console.log(
|
|
910
|
-
return [2 /*return
|
|
921
|
+
console.log(colors.red("No permission! Please execute [rop login] or use --accessKey"));
|
|
922
|
+
return [2 /*return*/, false];
|
|
911
923
|
}
|
|
912
924
|
user = JSON.parse(fs.readFileSync(userFilePath, 'utf8'));
|
|
913
925
|
return [4 /*yield*/, fetch("".concat(this.baseDomain).concat(REFRESH_TOKEN_API), {
|
|
@@ -924,17 +936,17 @@ var AuthApi = /** @class */ (function () {
|
|
|
924
936
|
resBody = _a.sent();
|
|
925
937
|
if (!res.ok || !resBody.data) {
|
|
926
938
|
if (!resBody.message || res.status != 400) {
|
|
927
|
-
console.log("Refresh token failed: status
|
|
939
|
+
console.log(colors.red("Refresh token failed: status:".concat(res.status, ", statusText:").concat(res.statusText)));
|
|
928
940
|
}
|
|
929
941
|
else {
|
|
930
|
-
console.log(
|
|
942
|
+
console.log(colors.red("Authorization expired please execute the login command"));
|
|
931
943
|
fs.rmSync(userFilePath);
|
|
932
944
|
}
|
|
933
|
-
|
|
945
|
+
return [2 /*return*/, false];
|
|
934
946
|
}
|
|
935
947
|
user.auth = resBody.data;
|
|
936
948
|
fs.writeFileSync(userFilePath, JSON.stringify(user), 'utf8');
|
|
937
|
-
return [2 /*return
|
|
949
|
+
return [2 /*return*/, true];
|
|
938
950
|
}
|
|
939
951
|
});
|
|
940
952
|
});
|
|
@@ -990,14 +1002,14 @@ var AuthApi = /** @class */ (function () {
|
|
|
990
1002
|
};
|
|
991
1003
|
AuthApi.prototype.request = function (req) {
|
|
992
1004
|
return __awaiter(this, void 0, void 0, function () {
|
|
993
|
-
var user, res, resBody, _a;
|
|
1005
|
+
var user, res, resBody, _a, result;
|
|
994
1006
|
return __generator(this, function (_b) {
|
|
995
1007
|
switch (_b.label) {
|
|
996
1008
|
case 0: return [4 /*yield*/, this.getToken()];
|
|
997
1009
|
case 1:
|
|
998
1010
|
user = _b.sent();
|
|
999
1011
|
if (!user) {
|
|
1000
|
-
console.log(
|
|
1012
|
+
console.log(colors.red("No permission! Please execute [rop login]"));
|
|
1001
1013
|
return [2 /*return*/, undefined];
|
|
1002
1014
|
}
|
|
1003
1015
|
return [4 /*yield*/, req(user.auth.accessToken)];
|
|
@@ -1006,26 +1018,28 @@ var AuthApi = /** @class */ (function () {
|
|
|
1006
1018
|
return [4 /*yield*/, res.json()];
|
|
1007
1019
|
case 3:
|
|
1008
1020
|
resBody = _b.sent();
|
|
1009
|
-
if (!(!res.ok || !resBody.data)) return [3 /*break*/,
|
|
1021
|
+
if (!(!res.ok || !resBody.data)) return [3 /*break*/, 11];
|
|
1010
1022
|
_a = res.status;
|
|
1011
1023
|
switch (_a) {
|
|
1012
1024
|
case 400: return [3 /*break*/, 4];
|
|
1013
1025
|
case 401: return [3 /*break*/, 5];
|
|
1014
1026
|
}
|
|
1015
|
-
return [3 /*break*/,
|
|
1027
|
+
return [3 /*break*/, 9];
|
|
1016
1028
|
case 4:
|
|
1017
1029
|
console.log(JSON.stringify(resBody));
|
|
1018
|
-
return [3 /*break*/,
|
|
1030
|
+
return [3 /*break*/, 10];
|
|
1019
1031
|
case 5: return [4 /*yield*/, this.refreshToken()];
|
|
1020
1032
|
case 6:
|
|
1021
|
-
_b.sent();
|
|
1033
|
+
result = _b.sent();
|
|
1034
|
+
if (!result) return [3 /*break*/, 8];
|
|
1022
1035
|
return [4 /*yield*/, this.request(req)];
|
|
1023
1036
|
case 7: return [2 /*return*/, _b.sent()];
|
|
1024
|
-
case 8:
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
case 10: return [2 /*return*/,
|
|
1037
|
+
case 8: return [3 /*break*/, 10];
|
|
1038
|
+
case 9:
|
|
1039
|
+
console.log(colors.red("request failed: status:".concat(res.status, ", statusText:").concat(res.statusText)));
|
|
1040
|
+
_b.label = 10;
|
|
1041
|
+
case 10: return [2 /*return*/, undefined];
|
|
1042
|
+
case 11: return [2 /*return*/, resBody.data];
|
|
1029
1043
|
}
|
|
1030
1044
|
});
|
|
1031
1045
|
});
|
|
@@ -1043,7 +1057,8 @@ var init = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
|
1043
1057
|
case 1:
|
|
1044
1058
|
user = _a.sent();
|
|
1045
1059
|
if (!user) {
|
|
1046
|
-
|
|
1060
|
+
console.log(colors.red("No permission! Please execute [rop login]"));
|
|
1061
|
+
return [2 /*return*/];
|
|
1047
1062
|
}
|
|
1048
1063
|
return [4 /*yield*/, confirm({
|
|
1049
1064
|
message: "Link to existing project?",
|
|
@@ -1072,7 +1087,8 @@ var init = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
|
1072
1087
|
case 6:
|
|
1073
1088
|
project = _a.sent();
|
|
1074
1089
|
if (!project) {
|
|
1075
|
-
|
|
1090
|
+
console.log(colors.yellow("project not found"));
|
|
1091
|
+
return [2 /*return*/];
|
|
1076
1092
|
}
|
|
1077
1093
|
projectId = project.id;
|
|
1078
1094
|
framework = project.framework;
|
|
@@ -1129,7 +1145,8 @@ var init = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
|
1129
1145
|
case 12:
|
|
1130
1146
|
project = _a.sent();
|
|
1131
1147
|
if (!project) {
|
|
1132
|
-
|
|
1148
|
+
console.log(colors.red("project create failed"));
|
|
1149
|
+
return [2 /*return*/];
|
|
1133
1150
|
}
|
|
1134
1151
|
projectId = project.id;
|
|
1135
1152
|
framework = project.framework;
|
|
@@ -1146,9 +1163,11 @@ var init = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
|
1146
1163
|
return [4 /*yield*/, init.initGitignore()];
|
|
1147
1164
|
case 16:
|
|
1148
1165
|
_a.sent();
|
|
1149
|
-
console.log(
|
|
1150
|
-
|
|
1151
|
-
|
|
1166
|
+
console.log(colors.green("Initialize project successfully!"));
|
|
1167
|
+
if (framework.toLowerCase() === 'tauri') {
|
|
1168
|
+
console.log(colors.blue("updater endpoints : ".concat(defaultHost, "/api/tauri/").concat(projectId, "/[your branch]/{{target}}/{{arch}}/{{current_version}}")));
|
|
1169
|
+
console.log('Please replace [your branch] with your own branch');
|
|
1170
|
+
}
|
|
1152
1171
|
return [2 /*return*/, {
|
|
1153
1172
|
projectId: projectId,
|
|
1154
1173
|
accessKey: accessKey,
|
|
@@ -1162,7 +1181,7 @@ var init = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
|
1162
1181
|
}); };
|
|
1163
1182
|
|
|
1164
1183
|
var login = function (options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1165
|
-
var username, password$1, loginReq, auth;
|
|
1184
|
+
var username, password$1, loginReq, auth, result;
|
|
1166
1185
|
return __generator(this, function (_a) {
|
|
1167
1186
|
switch (_a.label) {
|
|
1168
1187
|
case 0:
|
|
@@ -1179,7 +1198,7 @@ var login = function (options) { return __awaiter(void 0, void 0, void 0, functi
|
|
|
1179
1198
|
return [3 /*break*/, 5];
|
|
1180
1199
|
case 4:
|
|
1181
1200
|
_a.sent();
|
|
1182
|
-
console.log('cancel');
|
|
1201
|
+
console.log(colors.gray('cancel'));
|
|
1183
1202
|
return [2 /*return*/];
|
|
1184
1203
|
case 5: return [3 /*break*/, 1];
|
|
1185
1204
|
case 6:
|
|
@@ -1193,7 +1212,7 @@ var login = function (options) { return __awaiter(void 0, void 0, void 0, functi
|
|
|
1193
1212
|
return [3 /*break*/, 10];
|
|
1194
1213
|
case 9:
|
|
1195
1214
|
_a.sent();
|
|
1196
|
-
console.log('cancel');
|
|
1215
|
+
console.log(colors.gray('cancel'));
|
|
1197
1216
|
return [2 /*return*/];
|
|
1198
1217
|
case 10: return [3 /*break*/, 6];
|
|
1199
1218
|
case 11:
|
|
@@ -1204,8 +1223,10 @@ var login = function (options) { return __awaiter(void 0, void 0, void 0, functi
|
|
|
1204
1223
|
auth = new AuthApi({ baseDomain: defaultHost });
|
|
1205
1224
|
return [4 /*yield*/, auth.login(loginReq)];
|
|
1206
1225
|
case 12:
|
|
1207
|
-
_a.sent();
|
|
1208
|
-
|
|
1226
|
+
result = _a.sent();
|
|
1227
|
+
if (result) {
|
|
1228
|
+
console.log(colors.green("Login successful. Please use [rop init] to create a project."));
|
|
1229
|
+
}
|
|
1209
1230
|
return [2 /*return*/];
|
|
1210
1231
|
}
|
|
1211
1232
|
});
|
|
@@ -1223,7 +1244,7 @@ var _upload = function (config) { return __awaiter(void 0, void 0, void 0, funct
|
|
|
1223
1244
|
signature = fs$1.readFileSync(artifact.sig.path, 'utf8');
|
|
1224
1245
|
}
|
|
1225
1246
|
else {
|
|
1226
|
-
console.
|
|
1247
|
+
console.log(colors.cyan('Warn sig file not found'));
|
|
1227
1248
|
}
|
|
1228
1249
|
}
|
|
1229
1250
|
uploadClient = new RopUploadApi({ baseDomain: (_b = config.host) !== null && _b !== void 0 ? _b : defaultHost });
|
|
@@ -1239,6 +1260,7 @@ var _upload = function (config) { return __awaiter(void 0, void 0, void 0, funct
|
|
|
1239
1260
|
updatePath: (_d = artifact.update) === null || _d === void 0 ? void 0 : _d.path,
|
|
1240
1261
|
updateName: (_e = artifact.update) === null || _e === void 0 ? void 0 : _e.name,
|
|
1241
1262
|
signature: signature,
|
|
1263
|
+
branch: config.branch,
|
|
1242
1264
|
autoRelease: autoRelease,
|
|
1243
1265
|
})];
|
|
1244
1266
|
case 1:
|
|
@@ -1248,54 +1270,66 @@ var _upload = function (config) { return __awaiter(void 0, void 0, void 0, funct
|
|
|
1248
1270
|
});
|
|
1249
1271
|
}); };
|
|
1250
1272
|
var upload = function (platform, arch, options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1251
|
-
var configFilePath, data, projectId, token, jsonConfig, initConfig, authApi, user, targetInfos, config, reset, _i, targetInfos_1, item;
|
|
1252
|
-
|
|
1253
|
-
|
|
1273
|
+
var configFilePath, res, data, projectId, token, jsonConfig, initConfig, authApi, user, targetInfos, config, reset, _i, targetInfos_1, item;
|
|
1274
|
+
var _a;
|
|
1275
|
+
return __generator(this, function (_b) {
|
|
1276
|
+
switch (_b.label) {
|
|
1254
1277
|
case 0:
|
|
1255
1278
|
configFilePath = path.join('.', 'rop.json');
|
|
1256
1279
|
if (!!fs$1.existsSync(configFilePath)) return [3 /*break*/, 2];
|
|
1257
1280
|
return [4 /*yield*/, init()];
|
|
1258
1281
|
case 1:
|
|
1259
|
-
|
|
1260
|
-
|
|
1282
|
+
res = _b.sent();
|
|
1283
|
+
if (!res) {
|
|
1284
|
+
return [2 /*return*/];
|
|
1285
|
+
}
|
|
1286
|
+
_b.label = 2;
|
|
1261
1287
|
case 2:
|
|
1262
1288
|
data = loadJsonWithEnv({
|
|
1263
1289
|
platform: platform,
|
|
1264
1290
|
arch: arch,
|
|
1265
1291
|
});
|
|
1292
|
+
if (!data) {
|
|
1293
|
+
return [2 /*return*/];
|
|
1294
|
+
}
|
|
1266
1295
|
if (!!options.accessKey) return [3 /*break*/, 7];
|
|
1267
1296
|
jsonConfig = loadConfigJSON();
|
|
1268
1297
|
if (!!jsonConfig.projectId) return [3 /*break*/, 4];
|
|
1269
1298
|
return [4 /*yield*/, init()];
|
|
1270
1299
|
case 3:
|
|
1271
|
-
initConfig =
|
|
1272
|
-
|
|
1300
|
+
initConfig = _b.sent();
|
|
1301
|
+
if (initConfig) {
|
|
1302
|
+
projectId = initConfig.projectId;
|
|
1303
|
+
}
|
|
1304
|
+
else {
|
|
1305
|
+
return [2 /*return*/];
|
|
1306
|
+
}
|
|
1273
1307
|
return [3 /*break*/, 5];
|
|
1274
1308
|
case 4:
|
|
1275
1309
|
projectId = jsonConfig.projectId;
|
|
1276
|
-
|
|
1310
|
+
_b.label = 5;
|
|
1277
1311
|
case 5:
|
|
1278
1312
|
authApi = new AuthApi({ baseDomain: defaultHost });
|
|
1279
1313
|
return [4 /*yield*/, authApi.checkAndRefreshToken()];
|
|
1280
1314
|
case 6:
|
|
1281
|
-
user =
|
|
1315
|
+
user = _b.sent();
|
|
1282
1316
|
if (!user) {
|
|
1283
|
-
console.log(
|
|
1317
|
+
console.log(colors.red("No permission! Please execute [rop login]"));
|
|
1284
1318
|
return [2 /*return*/];
|
|
1285
1319
|
}
|
|
1286
1320
|
token = user.auth.accessToken;
|
|
1287
|
-
|
|
1321
|
+
_b.label = 7;
|
|
1288
1322
|
case 7:
|
|
1289
1323
|
targetInfos = data.targetInfos, config = data.config, reset = __rest(data, ["targetInfos", "config"]);
|
|
1290
1324
|
_i = 0, targetInfos_1 = targetInfos;
|
|
1291
|
-
|
|
1325
|
+
_b.label = 8;
|
|
1292
1326
|
case 8:
|
|
1293
1327
|
if (!(_i < targetInfos_1.length)) return [3 /*break*/, 11];
|
|
1294
1328
|
item = targetInfos_1[_i];
|
|
1295
|
-
return [4 /*yield*/, _upload(__assign(__assign({ accessKey: options.accessKey, projectId: projectId, token: token }, reset), { artifact: item.artifacts, host: config.host, platform: platform, autoRelease: options.release }))];
|
|
1329
|
+
return [4 /*yield*/, _upload(__assign(__assign({ accessKey: options.accessKey, projectId: projectId, token: token }, reset), { artifact: item.artifacts, host: config.host, platform: platform, branch: options.branch, autoRelease: (_a = options.release) !== null && _a !== void 0 ? _a : false }))];
|
|
1296
1330
|
case 9:
|
|
1297
|
-
|
|
1298
|
-
|
|
1331
|
+
_b.sent();
|
|
1332
|
+
_b.label = 10;
|
|
1299
1333
|
case 10:
|
|
1300
1334
|
_i++;
|
|
1301
1335
|
return [3 /*break*/, 8];
|
|
@@ -1332,6 +1366,7 @@ program
|
|
|
1332
1366
|
.argument('[string]', 'arch')
|
|
1333
1367
|
.option('-a, --accessKey <string>', 'accessKey path')
|
|
1334
1368
|
.option('-r, --release [boolean]', 'auto release')
|
|
1369
|
+
.option('-b, --branch <string>', 'branch')
|
|
1335
1370
|
.action(upload);
|
|
1336
1371
|
// 解析命令行参数
|
|
1337
1372
|
program.parse();
|