esa-cli 0.0.2-beta.10 → 0.0.2-beta.13

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.
Files changed (75) hide show
  1. package/dist/commands/commit/index.js +26 -115
  2. package/dist/commands/commit/prodBuild.js +2 -3
  3. package/dist/commands/common/routineUtils.js +276 -0
  4. package/dist/commands/config.js +1 -1
  5. package/dist/commands/deploy/helper.js +40 -61
  6. package/dist/commands/deploy/index.js +90 -188
  7. package/dist/commands/deployments/delete.js +32 -22
  8. package/dist/commands/deployments/index.js +2 -2
  9. package/dist/commands/deployments/list.js +22 -38
  10. package/dist/commands/dev/build.js +3 -3
  11. package/dist/commands/dev/doProcess.js +5 -5
  12. package/dist/commands/dev/ew2/cacheService.js +33 -0
  13. package/dist/commands/dev/ew2/devEntry.js +2 -1
  14. package/dist/commands/dev/ew2/devPack.js +22 -11
  15. package/dist/commands/dev/ew2/kvService.js +27 -0
  16. package/dist/commands/dev/ew2/mock/cache.js +99 -15
  17. package/dist/commands/dev/ew2/mock/kv.js +142 -21
  18. package/dist/commands/dev/ew2/server.js +162 -27
  19. package/dist/commands/dev/index.js +14 -15
  20. package/dist/commands/dev/mockWorker/devPack.js +16 -7
  21. package/dist/commands/dev/mockWorker/server.js +7 -6
  22. package/dist/commands/domain/add.js +2 -2
  23. package/dist/commands/domain/delete.js +7 -7
  24. package/dist/commands/domain/index.js +2 -2
  25. package/dist/commands/domain/list.js +10 -10
  26. package/dist/commands/init/helper.js +87 -13
  27. package/dist/commands/init/index.js +461 -57
  28. package/dist/commands/init/template.jsonc +34 -0
  29. package/dist/commands/lang.js +2 -2
  30. package/dist/commands/login/index.js +57 -7
  31. package/dist/commands/logout.js +5 -5
  32. package/dist/commands/route/add.js +138 -49
  33. package/dist/commands/route/delete.js +33 -27
  34. package/dist/commands/route/helper.js +124 -0
  35. package/dist/commands/route/index.js +2 -2
  36. package/dist/commands/route/list.js +56 -17
  37. package/dist/commands/routine/delete.js +2 -2
  38. package/dist/commands/routine/index.js +2 -2
  39. package/dist/commands/routine/list.js +9 -21
  40. package/dist/commands/site/index.js +1 -1
  41. package/dist/commands/site/list.js +6 -7
  42. package/dist/commands/utils.js +55 -19
  43. package/dist/components/descriptionInput.js +1 -1
  44. package/dist/components/mutiSelectTable.js +1 -1
  45. package/dist/components/selectInput.js +2 -3
  46. package/dist/components/selectItem.js +1 -1
  47. package/dist/docs/Commands_en.md +25 -15
  48. package/dist/docs/Commands_zh_CN.md +12 -2
  49. package/dist/docs/eslint-config-en.md +1 -0
  50. package/dist/docs/eslint-config.md +73 -0
  51. package/dist/docs/init-command-quick-test.md +208 -0
  52. package/dist/docs/init-command-test-guide.md +598 -0
  53. package/dist/i18n/index.js +2 -2
  54. package/dist/i18n/locales.json +261 -17
  55. package/dist/index.js +17 -12
  56. package/dist/libs/api.js +32 -9
  57. package/dist/libs/apiService.js +258 -85
  58. package/dist/libs/git/index.js +8 -4
  59. package/dist/libs/interface.js +0 -1
  60. package/dist/libs/logger.js +63 -7
  61. package/dist/libs/service.js +2 -2
  62. package/dist/libs/templates/index.js +1 -1
  63. package/dist/utils/checkAssetsExist.js +80 -0
  64. package/dist/utils/checkDevPort.js +3 -17
  65. package/dist/utils/checkEntryFileExist.js +10 -0
  66. package/dist/utils/checkIsRoutineCreated.js +16 -31
  67. package/dist/utils/checkVersion.js +1 -1
  68. package/dist/utils/compress.js +80 -0
  69. package/dist/utils/download.js +5 -5
  70. package/dist/utils/fileMd5.js +1 -1
  71. package/dist/utils/fileUtils/index.js +71 -22
  72. package/dist/utils/installDeno.js +3 -3
  73. package/dist/utils/installEw2.js +7 -7
  74. package/dist/utils/openInBrowser.js +1 -1
  75. package/package.json +11 -6
@@ -10,10 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import * as $OpenApi from '@alicloud/openapi-client';
11
11
  import FormData from 'form-data';
12
12
  import fetch from 'node-fetch';
13
- import { Environment } from './interface.js';
14
- import { getApiConfig } from '../utils/fileUtils/index.js';
15
- import chain from 'lodash';
16
13
  import t from '../i18n/index.js';
14
+ import { getApiConfig } from '../utils/fileUtils/index.js';
15
+ import { Environment } from './interface.js';
17
16
  export class ApiService {
18
17
  constructor(cliConfig) {
19
18
  var _a, _b;
@@ -49,7 +48,7 @@ export class ApiService {
49
48
  * - message: (Optional) A string providing additional information in case of failure.
50
49
  */
51
50
  checkLogin() {
52
- return __awaiter(this, arguments, void 0, function* (isShowError = true) {
51
+ return __awaiter(this, void 0, void 0, function* () {
53
52
  try {
54
53
  let params = {
55
54
  action: 'GetErService',
@@ -91,7 +90,7 @@ export class ApiService {
91
90
  }
92
91
  }
93
92
  catch (error) {
94
- isShowError && console.log(error);
93
+ console.log('error', error);
95
94
  return {
96
95
  success: false,
97
96
  message: t('login_failed').d('An error occurred while trying to log in.')
@@ -130,7 +129,6 @@ export class ApiService {
130
129
  }
131
130
  publishRoutineCodeVersion(requestParams) {
132
131
  return __awaiter(this, void 0, void 0, function* () {
133
- var _a;
134
132
  try {
135
133
  let params = {
136
134
  action: 'PublishRoutineCodeVersion',
@@ -146,15 +144,11 @@ export class ApiService {
146
144
  return this;
147
145
  }
148
146
  };
149
- const CanaryAreaList = (_a = requestParams.CanaryAreaList) !== null && _a !== void 0 ? _a : [];
150
- const CanaryAreaListString = JSON.stringify(CanaryAreaList);
151
147
  let request = new $OpenApi.OpenApiRequest({
152
148
  query: {
153
149
  Env: requestParams.Env,
154
150
  Name: requestParams.Name,
155
- CodeVersion: requestParams.CodeVersion,
156
- CanaryCodeVersion: requestParams.CanaryCodeVersion,
157
- CanaryAreaList: CanaryAreaListString
151
+ CodeVersion: requestParams.CodeVersion
158
152
  }
159
153
  });
160
154
  let runtime = {
@@ -225,48 +219,11 @@ export class ApiService {
225
219
  return null;
226
220
  });
227
221
  }
228
- listRoutineCanaryAreas() {
229
- return __awaiter(this, void 0, void 0, function* () {
230
- try {
231
- let params = {
232
- action: 'ListRoutineCanaryAreas',
233
- version: '2024-09-10',
234
- protocol: 'https',
235
- method: 'GET',
236
- authType: 'AK',
237
- bodyType: 'json',
238
- reqBodyType: 'json',
239
- style: 'RPC',
240
- pathname: '/',
241
- toMap: function () {
242
- return this;
243
- }
244
- };
245
- let request = new $OpenApi.OpenApiRequest();
246
- let runtime = {
247
- toMap: function () {
248
- return this;
249
- }
250
- };
251
- const res = yield this.client.callApi(params, request, runtime);
252
- if (res.statusCode === 200 && res.body) {
253
- const ret = {
254
- CanaryAreas: res.body.CanaryAreas
255
- };
256
- return ret;
257
- }
258
- }
259
- catch (error) {
260
- console.log(error);
261
- }
262
- return null;
263
- });
264
- }
265
- getRoutineUserInfo() {
222
+ listUserRoutines() {
266
223
  return __awaiter(this, void 0, void 0, function* () {
267
224
  try {
268
225
  let params = {
269
- action: 'GetRoutineUserInfo',
226
+ action: 'ListUserRoutines',
270
227
  version: '2024-09-10',
271
228
  protocol: 'https',
272
229
  method: 'GET',
@@ -287,11 +244,7 @@ export class ApiService {
287
244
  };
288
245
  const res = yield this.client.callApi(params, request, runtime);
289
246
  if (res.statusCode === 200 && res.body) {
290
- const ret = {
291
- Subdomains: res.body.RoutineName,
292
- Routines: res.body.Routines
293
- };
294
- return ret;
247
+ return res;
295
248
  }
296
249
  }
297
250
  catch (error) {
@@ -569,7 +522,6 @@ export class ApiService {
569
522
  }
570
523
  getRoutine(requestParams_1) {
571
524
  return __awaiter(this, arguments, void 0, function* (requestParams, isShowError = true) {
572
- var _a, _b, _c, _d, _e, _f, _g, _h;
573
525
  try {
574
526
  let params = {
575
527
  action: 'GetRoutine',
@@ -599,16 +551,7 @@ export class ApiService {
599
551
  if (res.statusCode === 200 && res.body) {
600
552
  const routineResponse = {
601
553
  code: res.statusCode,
602
- data: {
603
- RequestId: (_a = res.body) === null || _a === void 0 ? void 0 : _a.RequestId,
604
- CodeVersions: ((_b = res.body) === null || _b === void 0 ? void 0 : _b.CodeVersions) || [],
605
- RelatedRecords: ((_c = res.body) === null || _c === void 0 ? void 0 : _c.RelatedRecords) || [],
606
- Envs: ((_d = res.body) === null || _d === void 0 ? void 0 : _d.Envs) || [],
607
- CreateTime: (_e = res.body) === null || _e === void 0 ? void 0 : _e.CreateTime,
608
- Description: (_f = res.body) === null || _f === void 0 ? void 0 : _f.Description,
609
- RelatedRoutes: ((_g = res.body) === null || _g === void 0 ? void 0 : _g.RelatedRoutes) || [],
610
- DefaultRelatedRecord: (_h = res.body) === null || _h === void 0 ? void 0 : _h.DefaultRelatedRecord
611
- }
554
+ data: res.body
612
555
  };
613
556
  return routineResponse;
614
557
  }
@@ -640,8 +583,7 @@ export class ApiService {
640
583
  let request = new $OpenApi.OpenApiRequest({
641
584
  query: {
642
585
  Name: edgeRoutine.name,
643
- Description: edgeRoutine.description,
644
- SpecName: edgeRoutine.specName
586
+ Description: edgeRoutine.description
645
587
  }
646
588
  });
647
589
  let runtime = {
@@ -696,7 +638,7 @@ export class ApiService {
696
638
  }
697
639
  };
698
640
  const uploadResult = yield this.client.callApi(params, request, runtime);
699
- const ossConfig = chain(uploadResult).get('body.OssPostConfig');
641
+ const ossConfig = uploadResult.body.OssPostConfig;
700
642
  if (uploadResult.statusCode !== 200 || !ossConfig) {
701
643
  return false;
702
644
  }
@@ -709,7 +651,6 @@ export class ApiService {
709
651
  formData.append('policy', policy);
710
652
  formData.append('key', key);
711
653
  formData.append('file', edgeRoutine.code);
712
- // TODO: ę£€ęŸ„ossē»“ęžœ;
713
654
  const ossRes = yield fetch(Url, {
714
655
  method: 'POST',
715
656
  body: formData,
@@ -772,11 +713,11 @@ export class ApiService {
772
713
  return null;
773
714
  });
774
715
  }
775
- ListRoutineOptionalSpecs() {
716
+ createRoutineRelatedRecord(requestParams) {
776
717
  return __awaiter(this, void 0, void 0, function* () {
777
718
  try {
778
719
  let params = {
779
- action: 'ListRoutineOptionalSpecs',
720
+ action: 'CreateRoutineRelatedRecord',
780
721
  version: '2024-09-10',
781
722
  protocol: 'https',
782
723
  method: 'GET',
@@ -789,7 +730,14 @@ export class ApiService {
789
730
  return this;
790
731
  }
791
732
  };
792
- let request = new $OpenApi.OpenApiRequest();
733
+ let request = new $OpenApi.OpenApiRequest({
734
+ query: {
735
+ RecordName: requestParams.RecordName,
736
+ SiteId: requestParams.SiteId,
737
+ SiteName: requestParams.SiteName,
738
+ Name: requestParams.Name
739
+ }
740
+ });
793
741
  let runtime = {
794
742
  toMap: function () {
795
743
  return this;
@@ -800,8 +748,8 @@ export class ApiService {
800
748
  const ret = {
801
749
  code: res.statusCode,
802
750
  data: {
803
- RequestId: res.body.RequestId,
804
- Specs: res.body.Specs
751
+ Status: res.body.Status,
752
+ RequestId: res.body.RequestId
805
753
  }
806
754
  };
807
755
  return ret;
@@ -813,11 +761,11 @@ export class ApiService {
813
761
  return null;
814
762
  });
815
763
  }
816
- createRoutineRelatedRecord(requestParams) {
764
+ deleteRoutineRelatedRecord(requestParams) {
817
765
  return __awaiter(this, void 0, void 0, function* () {
818
766
  try {
819
767
  let params = {
820
- action: 'CreateRoutineRelatedRecord',
768
+ action: 'DeleteRoutineRelatedRecord',
821
769
  version: '2024-09-10',
822
770
  protocol: 'https',
823
771
  method: 'GET',
@@ -835,7 +783,8 @@ export class ApiService {
835
783
  RecordName: requestParams.RecordName,
836
784
  SiteId: requestParams.SiteId,
837
785
  SiteName: requestParams.SiteName,
838
- Name: requestParams.Name
786
+ Name: requestParams.Name,
787
+ RecordId: requestParams.RecordId
839
788
  }
840
789
  });
841
790
  let runtime = {
@@ -861,11 +810,11 @@ export class ApiService {
861
810
  return null;
862
811
  });
863
812
  }
864
- deleteRoutineRelatedRecord(requestParams) {
813
+ listRoutineRelatedRecords(requestParams) {
865
814
  return __awaiter(this, void 0, void 0, function* () {
866
815
  try {
867
816
  let params = {
868
- action: 'DeleteRoutineRelatedRecord',
817
+ action: 'ListRoutineRelatedRecords',
869
818
  version: '2024-09-10',
870
819
  protocol: 'https',
871
820
  method: 'GET',
@@ -880,11 +829,190 @@ export class ApiService {
880
829
  };
881
830
  let request = new $OpenApi.OpenApiRequest({
882
831
  query: {
883
- RecordName: requestParams.RecordName,
832
+ Name: requestParams.Name,
833
+ PageNumber: requestParams.PageNumber,
834
+ PageSize: requestParams.PageSize,
835
+ SearchKeyWord: requestParams.SearchKeyWord
836
+ }
837
+ });
838
+ let runtime = {
839
+ toMap: function () {
840
+ return this;
841
+ }
842
+ };
843
+ const res = yield this.client.callApi(params, request, runtime);
844
+ if (res.statusCode === 200 && res.body) {
845
+ const ret = {
846
+ code: res.statusCode,
847
+ data: {
848
+ PageNumber: res.body.PageNumber,
849
+ PageSize: res.body.PageSize,
850
+ TotalCount: res.body.TotalCount,
851
+ RelatedRecords: res.body.RelatedRecords
852
+ }
853
+ };
854
+ return ret;
855
+ }
856
+ }
857
+ catch (error) {
858
+ console.log(error);
859
+ }
860
+ return null;
861
+ });
862
+ }
863
+ createRoutineRoute(requestParams) {
864
+ return __awaiter(this, void 0, void 0, function* () {
865
+ try {
866
+ let params = {
867
+ action: 'CreateRoutineRoute',
868
+ version: '2024-09-10',
869
+ protocol: 'https',
870
+ method: 'POST',
871
+ authType: 'AK',
872
+ bodyType: 'json',
873
+ reqBodyType: 'json',
874
+ style: 'RPC',
875
+ pathname: '/',
876
+ toMap: function () {
877
+ return this;
878
+ }
879
+ };
880
+ let request = new $OpenApi.OpenApiRequest({
881
+ query: {
884
882
  SiteId: requestParams.SiteId,
885
- SiteName: requestParams.SiteName,
883
+ RoutineName: requestParams.RoutineName,
884
+ RouteName: requestParams.RouteName,
885
+ RouteEnable: 'on',
886
+ Rule: requestParams.Rule,
887
+ Bypass: requestParams.Bypass,
888
+ Mode: 'simple'
889
+ }
890
+ });
891
+ let runtime = {
892
+ toMap: function () {
893
+ return this;
894
+ }
895
+ };
896
+ const res = yield this.client.callApi(params, request, runtime);
897
+ if (res.statusCode === 200 && res.body) {
898
+ const ret = {
899
+ code: res.statusCode,
900
+ data: {
901
+ RequestId: res.body.RequestId,
902
+ ConfigId: res.body.ConfigId
903
+ }
904
+ };
905
+ return ret;
906
+ }
907
+ }
908
+ catch (error) {
909
+ console.log(error);
910
+ }
911
+ return null;
912
+ });
913
+ }
914
+ /**
915
+ * č°ƒē”Ø CreateRoutineWithAssetsCodeVersion API čŽ·å– OSS äøŠä¼ é…ē½®
916
+ */
917
+ CreateRoutineWithAssetsCodeVersion(requestParams) {
918
+ return __awaiter(this, void 0, void 0, function* () {
919
+ try {
920
+ let params = {
921
+ action: 'CreateRoutineWithAssetsCodeVersion',
922
+ version: '2024-09-10',
923
+ protocol: 'https',
924
+ method: 'POST',
925
+ authType: 'AK',
926
+ bodyType: 'json',
927
+ reqBodyType: 'json',
928
+ style: 'RPC',
929
+ pathname: '/',
930
+ toMap: function () {
931
+ return this;
932
+ }
933
+ };
934
+ let request = new $OpenApi.OpenApiRequest({
935
+ query: {
886
936
  Name: requestParams.Name,
887
- RecordId: requestParams.RecordId
937
+ CodeDescription: requestParams.CodeDescription,
938
+ BuildId: requestParams.BuildId
939
+ }
940
+ });
941
+ let runtime = {
942
+ toMap: function () {
943
+ return this;
944
+ }
945
+ };
946
+ const result = yield this.client.callApi(params, request, runtime);
947
+ if (result.statusCode === 200 && result.body) {
948
+ return {
949
+ code: result.statusCode.toString(),
950
+ data: {
951
+ RequestId: result.body.RequestId,
952
+ CodeVersion: result.body.CodeVersion,
953
+ Status: result.body.Status,
954
+ OssPostConfig: result.body.OssPostConfig
955
+ }
956
+ };
957
+ }
958
+ return null;
959
+ }
960
+ catch (error) {
961
+ console.error('Error calling CreateRoutineWithAssetsCodeVersion:', error);
962
+ return null;
963
+ }
964
+ });
965
+ }
966
+ /**
967
+ * äøŠä¼ ę–‡ä»¶åˆ° OSS
968
+ */
969
+ uploadToOss(ossConfig, zipBuffer) {
970
+ return __awaiter(this, void 0, void 0, function* () {
971
+ try {
972
+ const { OSSAccessKeyId, Signature, Url, Key, Policy, XOssSecurityToken } = ossConfig;
973
+ const formData = new FormData();
974
+ formData.append('OSSAccessKeyId', OSSAccessKeyId);
975
+ formData.append('Signature', Signature);
976
+ formData.append('x-oss-security-token', XOssSecurityToken);
977
+ formData.append('policy', Policy);
978
+ formData.append('key', Key);
979
+ formData.append('file', zipBuffer);
980
+ const ossRes = yield fetch(Url, {
981
+ method: 'POST',
982
+ body: formData,
983
+ headers: formData.getHeaders()
984
+ });
985
+ return ossRes && (ossRes.status === 200 || ossRes.status === 204);
986
+ }
987
+ catch (error) {
988
+ console.error('Error uploading to OSS:', error);
989
+ return false;
990
+ }
991
+ });
992
+ }
993
+ createRoutineCodeDeployment(requestParams) {
994
+ return __awaiter(this, void 0, void 0, function* () {
995
+ try {
996
+ let params = {
997
+ action: 'CreateRoutineCodeDeployment',
998
+ version: '2024-09-10',
999
+ protocol: 'https',
1000
+ method: 'POST',
1001
+ authType: 'AK',
1002
+ bodyType: 'json',
1003
+ reqBodyType: 'json',
1004
+ style: 'RPC',
1005
+ pathname: '/',
1006
+ toMap: function () {
1007
+ return this;
1008
+ }
1009
+ };
1010
+ let request = new $OpenApi.OpenApiRequest({
1011
+ query: {
1012
+ Name: requestParams.Name,
1013
+ Env: requestParams.Env,
1014
+ Strategy: requestParams.Strategy,
1015
+ CodeVersions: JSON.stringify(requestParams.CodeVersions)
888
1016
  }
889
1017
  });
890
1018
  let runtime = {
@@ -897,8 +1025,10 @@ export class ApiService {
897
1025
  const ret = {
898
1026
  code: res.statusCode,
899
1027
  data: {
900
- Status: res.body.Status,
901
- RequestId: res.body.RequestId
1028
+ RequestId: res.body.RequestId,
1029
+ Strategy: res.body.Strategy,
1030
+ DeploymentId: res.body.DeploymentId,
1031
+ CodeVersions: res.body.CodeVersions
902
1032
  }
903
1033
  };
904
1034
  return ret;
@@ -910,5 +1040,48 @@ export class ApiService {
910
1040
  return null;
911
1041
  });
912
1042
  }
1043
+ getRoutineCodeVersionInfo(requestParams) {
1044
+ return __awaiter(this, void 0, void 0, function* () {
1045
+ try {
1046
+ let params = {
1047
+ action: 'GetRoutineCodeVersionInfo',
1048
+ version: '2024-09-10',
1049
+ protocol: 'https',
1050
+ method: 'GET',
1051
+ authType: 'AK',
1052
+ bodyType: 'json',
1053
+ reqBodyType: 'json',
1054
+ style: 'RPC',
1055
+ pathname: '/',
1056
+ toMap: function () {
1057
+ return this;
1058
+ }
1059
+ };
1060
+ let request = new $OpenApi.OpenApiRequest({
1061
+ query: {
1062
+ Name: requestParams.Name,
1063
+ CodeVersion: requestParams.CodeVersion
1064
+ }
1065
+ });
1066
+ let runtime = {
1067
+ toMap: function () {
1068
+ return this;
1069
+ }
1070
+ };
1071
+ const res = yield this.client.callApi(params, request, runtime);
1072
+ if (res.statusCode === 200 && res.body) {
1073
+ const ret = {
1074
+ code: res.statusCode,
1075
+ data: res.body
1076
+ };
1077
+ return ret;
1078
+ }
1079
+ }
1080
+ catch (error) {
1081
+ console.log(error);
1082
+ }
1083
+ return null;
1084
+ });
1085
+ }
913
1086
  }
914
1087
  ApiService.instance = null;
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { execSync } from 'child_process';
11
11
  import { exit } from 'process';
12
+ import logger from '../../libs/logger.js';
12
13
  export function isInstalledGit() {
13
14
  try {
14
15
  execSync('git --version');
@@ -32,7 +33,7 @@ export function cloneRepository(url, path) {
32
33
  return __awaiter(this, void 0, void 0, function* () {
33
34
  try {
34
35
  execSync(`git clone ${url} ${path}`, { stdio: 'inherit' });
35
- console.log('Repository cloned successfully.');
36
+ logger.log('Repository cloned successfully.');
36
37
  }
37
38
  catch (error) {
38
39
  console.error('Error occurred while cloning the repository:', error);
@@ -40,10 +41,13 @@ export function cloneRepository(url, path) {
40
41
  }
41
42
  });
42
43
  }
43
- export function installGit(path) {
44
+ export function installGit(path, debug = false) {
44
45
  try {
45
- execSync('git init', { stdio: 'inherit', cwd: path });
46
- console.log('Git has been installed successfully.');
46
+ execSync('git init', { stdio: 'ignore', cwd: path });
47
+ if (debug) {
48
+ logger.log('Git has been installed successfully.');
49
+ }
50
+ return true;
47
51
  }
48
52
  catch (error) {
49
53
  console.error('Error occurred during Git installation:', error);
@@ -7,7 +7,6 @@ export var PublishType;
7
7
  (function (PublishType) {
8
8
  PublishType["Staging"] = "staging";
9
9
  PublishType["Production"] = "production";
10
- PublishType["Canary"] = "canary";
11
10
  })(PublishType || (PublishType = {}));
12
11
  var BasicType;
13
12
  (function (BasicType) {
@@ -1,10 +1,10 @@
1
+ import os from 'os';
2
+ import path from 'path';
1
3
  import chalk from 'chalk';
2
- import { format, createLogger } from 'winston';
3
- import DailyRotateFile from 'winston-daily-rotate-file';
4
4
  import Table from 'cli-table3';
5
- import path from 'path';
6
- import os from 'os';
7
5
  import ora from 'ora';
6
+ import { format, createLogger } from 'winston';
7
+ import DailyRotateFile from 'winston-daily-rotate-file';
8
8
  import t from '../i18n/index.js';
9
9
  import { getProjectConfig } from '../utils/fileUtils/index.js';
10
10
  const transport = new DailyRotateFile({
@@ -72,7 +72,7 @@ class Logger {
72
72
  console.log(`\t${message}`);
73
73
  }
74
74
  success(message) {
75
- console.log(`\nšŸŽ‰ ${chalk.bgGreen(' SUCCESS ')} ${chalk.green(message)}`);
75
+ console.log(`šŸŽ‰ ${chalk.bgGreen(' SUCCESS ')} ${chalk.green(message)}`);
76
76
  }
77
77
  debug(message) {
78
78
  this.logger.debug(message);
@@ -146,15 +146,71 @@ class Logger {
146
146
  if (messages.length === 0)
147
147
  return;
148
148
  const lines = [];
149
- lines.push(`╭─ ${messages[0]}`);
149
+ lines.push(`ā•­ ${messages[0]}`);
150
150
  for (let i = 1; i < messages.length - 1; i++) {
151
151
  lines.push(`│ ${messages[i]}`);
152
152
  }
153
153
  if (messages.length > 1) {
154
- lines.push(`╰─ ${messages[messages.length - 1]}`);
154
+ lines.push(`ā•° ${messages[messages.length - 1]}`);
155
155
  }
156
156
  console.log(lines.join('\n'));
157
157
  }
158
+ // Cloudflare-like step rendering helpers
159
+ cfStepHeader(title, step, total) {
160
+ console.log(`\nā•­ ${title} ${chalk.green(`Step ${step} of ${total}`)}`);
161
+ console.log('│');
162
+ }
163
+ cfStepItem(prompt) {
164
+ console.log(`ā”œ ${prompt}`);
165
+ }
166
+ cfStepKV(key, value) {
167
+ const orange = chalk.hex('#FFA500');
168
+ console.log(`│ ${orange(key)} ${value}`);
169
+ }
170
+ cfStepSpacer() {
171
+ console.log('│');
172
+ }
173
+ cfStepEnd(str) {
174
+ console.log(`ā•° ${str || ''}`);
175
+ }
176
+ cfStepEndInline() {
177
+ try {
178
+ process.stdout.write('ā•° ');
179
+ }
180
+ catch (_a) {
181
+ console.log('ā•°');
182
+ }
183
+ }
184
+ divider() {
185
+ console.log(chalk.yellow('--------------------------------------------------------'));
186
+ }
187
+ // Replace the previous single terminal line with new content
188
+ replacePrevLine(content) {
189
+ try {
190
+ // Move cursor up 1 line, clear it, carriage return, print new content
191
+ process.stdout.write('\x1b[1A');
192
+ process.stdout.write('\x1b[2K');
193
+ process.stdout.write('\r');
194
+ console.log(content);
195
+ }
196
+ catch (_a) {
197
+ console.log(content);
198
+ }
199
+ }
200
+ // Replace multiple previous lines with one consolidated line
201
+ replacePrevLines(linesToReplace, content) {
202
+ try {
203
+ for (let i = 0; i < linesToReplace; i++) {
204
+ process.stdout.write('\x1b[1A'); // move up
205
+ process.stdout.write('\x1b[2K'); // clear line
206
+ }
207
+ process.stdout.write('\r');
208
+ console.log(content);
209
+ }
210
+ catch (_a) {
211
+ console.log(content);
212
+ }
213
+ }
158
214
  }
159
215
  const logger = Logger.getInstance();
160
216
  export default logger;
@@ -7,10 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import ora from 'ora';
11
- import chain from 'lodash';
12
10
  import FormData from 'form-data';
11
+ import chain from 'lodash';
13
12
  import fetch from 'node-fetch';
13
+ import ora from 'ora';
14
14
  import t from '../i18n/index.js';
15
15
  import api from './api.js';
16
16
  import { Environment } from './interface.js';
@@ -1,5 +1,5 @@
1
- import { getSummary } from '../../commands/common/constant.js';
2
1
  import chalk from 'chalk';
2
+ import { getSummary } from '../../commands/common/constant.js';
3
3
  import logger from '../logger.js';
4
4
  export default class Template {
5
5
  constructor(path, title) {