@hapico/cli 0.0.22 → 0.0.24

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/bin/index.js CHANGED
@@ -123,6 +123,19 @@ const tryJSONParse = (str) => {
123
123
  }
124
124
  };
125
125
  exports.tryJSONParse = tryJSONParse;
126
+ // only support .ts, .tsx, .js, .jsx, .json, .css, .html, .env files
127
+ const supportedExtensions = [
128
+ ".ts",
129
+ ".tsx",
130
+ ".js",
131
+ ".jsx",
132
+ ".json",
133
+ ".css",
134
+ ".html",
135
+ ".env",
136
+ ".md",
137
+ ];
138
+ const ignoreFolders = ["node_modules", ".git", ".hg", ".svn"];
126
139
  const compileES5 = (code, filePath) => {
127
140
  if (filePath && !filePath.endsWith(".ts") && !filePath.endsWith(".tsx")) {
128
141
  return code;
@@ -143,7 +156,7 @@ const compileES5 = (code, filePath) => {
143
156
  return result.code;
144
157
  }
145
158
  catch (error) {
146
- console.log(chalk_1.default.red(`Error compiling code: ${error === null || error === void 0 ? void 0 : error.message}`));
159
+ console.log(chalk_1.default.red(`Error compiling code at ${filePath}`));
147
160
  return "";
148
161
  }
149
162
  };
@@ -172,12 +185,23 @@ class FileManager {
172
185
  traverseDirectory(fullPath);
173
186
  }
174
187
  else if (entry.isFile()) {
188
+ // skip các file trong thư mục bị ignore
189
+ if (ignoreFolders.some((folder) => fullPath.includes(folder))) {
190
+ return;
191
+ }
192
+ // chỉ hổ trợ các files nằm trong ./src
193
+ if (!fullPath.includes("/src/") && !fullPath.includes("\\src\\")) {
194
+ return;
195
+ }
175
196
  const content = fs.readFileSync(fullPath, { encoding: "utf8" });
176
- files.push({
177
- path: this.replaceSplashWithSeparator(fullPath.replace(this.basePath + path.sep, "./")),
178
- content,
179
- es5: (_a = (0, exports.compileES5)(content, fullPath)) !== null && _a !== void 0 ? _a : "",
180
- });
197
+ const extname = path.extname(fullPath);
198
+ if (supportedExtensions.includes(extname)) {
199
+ files.push({
200
+ path: this.replaceSplashWithSeparator(fullPath.replace(this.basePath + path.sep, "./")),
201
+ content,
202
+ es5: (_a = (0, exports.compileES5)(content, fullPath)) !== null && _a !== void 0 ? _a : "",
203
+ });
204
+ }
181
205
  }
182
206
  });
183
207
  };
@@ -371,7 +395,7 @@ class RoomState {
371
395
  return this.isConnected;
372
396
  }
373
397
  }
374
- commander_1.program.version("0.0.22").description("Hapico CLI for project management");
398
+ commander_1.program.version("0.0.24").description("Hapico CLI for project management");
375
399
  commander_1.program
376
400
  .command("clone <id>")
377
401
  .description("Clone a project by ID")
@@ -462,7 +486,7 @@ commander_1.program
462
486
  commander_1.program
463
487
  .command("dev")
464
488
  .description("Start the project in development mode")
465
- .option('--zversion <version>', 'Zalo version for QR code', '75')
489
+ .option("--zversion <version>", "Zalo version for QR code")
466
490
  .action((options) => {
467
491
  var _a;
468
492
  const { accessToken } = getStoredToken();
@@ -535,19 +559,10 @@ commander_1.program
535
559
  ".jsx",
536
560
  ".json",
537
561
  ".css",
538
- ".html",
539
562
  ".env",
540
563
  ".env.local",
541
564
  ".env.development",
542
565
  ".env.production",
543
- ".jsonc",
544
- ".yml",
545
- ".yaml",
546
- ".md",
547
- ".markdown",
548
- ".txt",
549
- ".xml",
550
- ".config",
551
566
  ];
552
567
  const filteredFiles = initialFiles.filter((file) => {
553
568
  return supportExtensions.some((ext) => file.path.endsWith(ext));
@@ -586,14 +601,33 @@ commander_1.program
586
601
  return;
587
602
  }
588
603
  const projectType = project.data.type || "view";
589
- const zversion = options.zversion || '75';
590
- if (projectType === "zalominiapp") {
591
- qrcode_terminal_1.default.generate(`https://zalo.me/s/3218692650896662017/player/${projectId}?env=TESTING&version=${zversion}`, { small: true }, (qrcode) => {
592
- console.log(chalk_1.default.cyan("📱 Scan this QR code to connect to the project:"));
604
+ const zversion = options.zversion;
605
+ if (projectType === "expo_app") {
606
+ const BASE_EXPO_LINK = `exp://u.expo.dev/e362c6df-abe8-4503-8723-1362f015d167/group/8cd11ab9-b6db-4924-9f7a-5e449f027bba`;
607
+ //exp://u.expo.dev/e362c6df-abe8-4503-8723-1362f015d167/group/8cd11ab9-b6db-4924-9f7a-5e449f027bba?sessionKey=eyJpZCI6IjU1NF8xIiwidmlld0lkIjo1NTR9&mode=development
608
+ const link = `${BASE_EXPO_LINK}?sessionKey=${projectId}&mode=development`;
609
+ qrcode_terminal_1.default.generate(link, { small: true }, (qrcode) => {
610
+ console.log(chalk_1.default.cyan("📱 Scan this QR code with Expo Go to connect to the project:"));
593
611
  console.log(qrcode);
594
612
  });
595
613
  return;
596
614
  }
615
+ else if (projectType === "zalominiapp") {
616
+ console.log("zversion", zversion);
617
+ if (!zversion) {
618
+ qrcode_terminal_1.default.generate(`https://zalo.me/s/3218692650896662017/player/${projectId}`, { small: true }, (qrcode) => {
619
+ console.log(chalk_1.default.cyan("📱 Scan this QR code to connect to the project:"));
620
+ console.log(qrcode);
621
+ });
622
+ }
623
+ else {
624
+ qrcode_terminal_1.default.generate(`https://zalo.me/s/3218692650896662017/player/${projectId}?env=TESTING&version=${zversion}`, { small: true }, (qrcode) => {
625
+ console.log(chalk_1.default.cyan("📱 Scan this QR code to connect to the project:"));
626
+ console.log(qrcode);
627
+ });
628
+ }
629
+ return;
630
+ }
597
631
  else {
598
632
  const previewUrl = `https://com.ai.vn/dev_preview/${projectId}`;
599
633
  console.log(chalk_1.default.cyan(`🌐 Open this URL in your browser to preview the project:\n${previewUrl}`));
@@ -616,7 +650,10 @@ async function pushProject(spinner, projectId) {
616
650
  return false;
617
651
  }
618
652
  const fileManager = new FileManager(srcDir);
619
- const files = fileManager.listFiles();
653
+ const files = fileManager.listFiles().filter((file) => {
654
+ const extname = path.extname(file.path);
655
+ return supportedExtensions.includes(extname);
656
+ });
620
657
  // Supported files
621
658
  const SUPPORT_FILES = [
622
659
  "./.env",
@@ -640,6 +677,9 @@ async function pushProject(spinner, projectId) {
640
677
  });
641
678
  }
642
679
  });
680
+ // Show ra thông tin dung lượng mã nguồn
681
+ const totalSize = files.reduce((acc, file) => acc + file.content.length, 0);
682
+ console.log(chalk_1.default.cyan(`Total source code size for project ${projectId}: ${(totalSize / 1024).toFixed(2)} KB`));
643
683
  spinner.text = `Pushing project source code to server for project ${projectId}...`;
644
684
  const apiUrl = `https://base.myworkbeast.com/api/views/${projectId}`;
645
685
  try {
@@ -1069,7 +1109,7 @@ commander_1.program.command("publish").action(async () => {
1069
1109
  }
1070
1110
  // Step 2: Publish main project
1071
1111
  const { accessToken } = getStoredToken();
1072
- const apiUrl = "https://base.myworkbeast.com/api/views/publish";
1112
+ const apiUrl = "https://base.myworkbeast.com/api/views/publish/v2";
1073
1113
  let allPublishSuccess = true;
1074
1114
  try {
1075
1115
  await axios_1.default.post(apiUrl, { view_id: parseInt(projectId, 10) }, {
package/dist/index.js CHANGED
@@ -123,6 +123,19 @@ const tryJSONParse = (str) => {
123
123
  }
124
124
  };
125
125
  exports.tryJSONParse = tryJSONParse;
126
+ // only support .ts, .tsx, .js, .jsx, .json, .css, .html, .env files
127
+ const supportedExtensions = [
128
+ ".ts",
129
+ ".tsx",
130
+ ".js",
131
+ ".jsx",
132
+ ".json",
133
+ ".css",
134
+ ".html",
135
+ ".env",
136
+ ".md",
137
+ ];
138
+ const ignoreFolders = ["node_modules", ".git", ".hg", ".svn"];
126
139
  const compileES5 = (code, filePath) => {
127
140
  if (filePath && !filePath.endsWith(".ts") && !filePath.endsWith(".tsx")) {
128
141
  return code;
@@ -143,7 +156,7 @@ const compileES5 = (code, filePath) => {
143
156
  return result.code;
144
157
  }
145
158
  catch (error) {
146
- console.log(chalk_1.default.red(`Error compiling code: ${error === null || error === void 0 ? void 0 : error.message}`));
159
+ console.log(chalk_1.default.red(`Error compiling code at ${filePath}`));
147
160
  return "";
148
161
  }
149
162
  };
@@ -172,12 +185,23 @@ class FileManager {
172
185
  traverseDirectory(fullPath);
173
186
  }
174
187
  else if (entry.isFile()) {
188
+ // skip các file trong thư mục bị ignore
189
+ if (ignoreFolders.some((folder) => fullPath.includes(folder))) {
190
+ return;
191
+ }
192
+ // chỉ hổ trợ các files nằm trong ./src
193
+ if (!fullPath.includes("/src/") && !fullPath.includes("\\src\\")) {
194
+ return;
195
+ }
175
196
  const content = fs.readFileSync(fullPath, { encoding: "utf8" });
176
- files.push({
177
- path: this.replaceSplashWithSeparator(fullPath.replace(this.basePath + path.sep, "./")),
178
- content,
179
- es5: (_a = (0, exports.compileES5)(content, fullPath)) !== null && _a !== void 0 ? _a : "",
180
- });
197
+ const extname = path.extname(fullPath);
198
+ if (supportedExtensions.includes(extname)) {
199
+ files.push({
200
+ path: this.replaceSplashWithSeparator(fullPath.replace(this.basePath + path.sep, "./")),
201
+ content,
202
+ es5: (_a = (0, exports.compileES5)(content, fullPath)) !== null && _a !== void 0 ? _a : "",
203
+ });
204
+ }
181
205
  }
182
206
  });
183
207
  };
@@ -371,7 +395,7 @@ class RoomState {
371
395
  return this.isConnected;
372
396
  }
373
397
  }
374
- commander_1.program.version("0.0.22").description("Hapico CLI for project management");
398
+ commander_1.program.version("0.0.24").description("Hapico CLI for project management");
375
399
  commander_1.program
376
400
  .command("clone <id>")
377
401
  .description("Clone a project by ID")
@@ -462,7 +486,7 @@ commander_1.program
462
486
  commander_1.program
463
487
  .command("dev")
464
488
  .description("Start the project in development mode")
465
- .option('--zversion <version>', 'Zalo version for QR code', '75')
489
+ .option("--zversion <version>", "Zalo version for QR code")
466
490
  .action((options) => {
467
491
  var _a;
468
492
  const { accessToken } = getStoredToken();
@@ -535,19 +559,10 @@ commander_1.program
535
559
  ".jsx",
536
560
  ".json",
537
561
  ".css",
538
- ".html",
539
562
  ".env",
540
563
  ".env.local",
541
564
  ".env.development",
542
565
  ".env.production",
543
- ".jsonc",
544
- ".yml",
545
- ".yaml",
546
- ".md",
547
- ".markdown",
548
- ".txt",
549
- ".xml",
550
- ".config",
551
566
  ];
552
567
  const filteredFiles = initialFiles.filter((file) => {
553
568
  return supportExtensions.some((ext) => file.path.endsWith(ext));
@@ -586,14 +601,33 @@ commander_1.program
586
601
  return;
587
602
  }
588
603
  const projectType = project.data.type || "view";
589
- const zversion = options.zversion || '75';
590
- if (projectType === "zalominiapp") {
591
- qrcode_terminal_1.default.generate(`https://zalo.me/s/3218692650896662017/player/${projectId}?env=TESTING&version=${zversion}`, { small: true }, (qrcode) => {
592
- console.log(chalk_1.default.cyan("📱 Scan this QR code to connect to the project:"));
604
+ const zversion = options.zversion;
605
+ if (projectType === "expo_app") {
606
+ const BASE_EXPO_LINK = `exp://u.expo.dev/e362c6df-abe8-4503-8723-1362f015d167/group/8cd11ab9-b6db-4924-9f7a-5e449f027bba`;
607
+ //exp://u.expo.dev/e362c6df-abe8-4503-8723-1362f015d167/group/8cd11ab9-b6db-4924-9f7a-5e449f027bba?sessionKey=eyJpZCI6IjU1NF8xIiwidmlld0lkIjo1NTR9&mode=development
608
+ const link = `${BASE_EXPO_LINK}?sessionKey=${projectId}&mode=development`;
609
+ qrcode_terminal_1.default.generate(link, { small: true }, (qrcode) => {
610
+ console.log(chalk_1.default.cyan("📱 Scan this QR code with Expo Go to connect to the project:"));
593
611
  console.log(qrcode);
594
612
  });
595
613
  return;
596
614
  }
615
+ else if (projectType === "zalominiapp") {
616
+ console.log("zversion", zversion);
617
+ if (!zversion) {
618
+ qrcode_terminal_1.default.generate(`https://zalo.me/s/3218692650896662017/player/${projectId}`, { small: true }, (qrcode) => {
619
+ console.log(chalk_1.default.cyan("📱 Scan this QR code to connect to the project:"));
620
+ console.log(qrcode);
621
+ });
622
+ }
623
+ else {
624
+ qrcode_terminal_1.default.generate(`https://zalo.me/s/3218692650896662017/player/${projectId}?env=TESTING&version=${zversion}`, { small: true }, (qrcode) => {
625
+ console.log(chalk_1.default.cyan("📱 Scan this QR code to connect to the project:"));
626
+ console.log(qrcode);
627
+ });
628
+ }
629
+ return;
630
+ }
597
631
  else {
598
632
  const previewUrl = `https://com.ai.vn/dev_preview/${projectId}`;
599
633
  console.log(chalk_1.default.cyan(`🌐 Open this URL in your browser to preview the project:\n${previewUrl}`));
@@ -616,7 +650,10 @@ async function pushProject(spinner, projectId) {
616
650
  return false;
617
651
  }
618
652
  const fileManager = new FileManager(srcDir);
619
- const files = fileManager.listFiles();
653
+ const files = fileManager.listFiles().filter((file) => {
654
+ const extname = path.extname(file.path);
655
+ return supportedExtensions.includes(extname);
656
+ });
620
657
  // Supported files
621
658
  const SUPPORT_FILES = [
622
659
  "./.env",
@@ -640,6 +677,9 @@ async function pushProject(spinner, projectId) {
640
677
  });
641
678
  }
642
679
  });
680
+ // Show ra thông tin dung lượng mã nguồn
681
+ const totalSize = files.reduce((acc, file) => acc + file.content.length, 0);
682
+ console.log(chalk_1.default.cyan(`Total source code size for project ${projectId}: ${(totalSize / 1024).toFixed(2)} KB`));
643
683
  spinner.text = `Pushing project source code to server for project ${projectId}...`;
644
684
  const apiUrl = `https://base.myworkbeast.com/api/views/${projectId}`;
645
685
  try {
@@ -1069,7 +1109,7 @@ commander_1.program.command("publish").action(async () => {
1069
1109
  }
1070
1110
  // Step 2: Publish main project
1071
1111
  const { accessToken } = getStoredToken();
1072
- const apiUrl = "https://base.myworkbeast.com/api/views/publish";
1112
+ const apiUrl = "https://base.myworkbeast.com/api/views/publish/v2";
1073
1113
  let allPublishSuccess = true;
1074
1114
  try {
1075
1115
  await axios_1.default.post(apiUrl, { view_id: parseInt(projectId, 10) }, {
package/index.ts CHANGED
@@ -130,6 +130,21 @@ export const tryJSONParse = (str: string): any => {
130
130
  }
131
131
  };
132
132
 
133
+ // only support .ts, .tsx, .js, .jsx, .json, .css, .html, .env files
134
+ const supportedExtensions = [
135
+ ".ts",
136
+ ".tsx",
137
+ ".js",
138
+ ".jsx",
139
+ ".json",
140
+ ".css",
141
+ ".html",
142
+ ".env",
143
+ ".md",
144
+ ];
145
+
146
+ const ignoreFolders = ["node_modules", ".git", ".hg", ".svn"];
147
+
133
148
  export const compileES5 = (code: string, filePath?: string) => {
134
149
  if (filePath && !filePath.endsWith(".ts") && !filePath.endsWith(".tsx")) {
135
150
  return code;
@@ -151,7 +166,7 @@ export const compileES5 = (code: string, filePath?: string) => {
151
166
  compileCache.set(code, result.code || "");
152
167
  return result.code;
153
168
  } catch (error: any) {
154
- console.log(chalk.red(`Error compiling code: ${error?.message}`));
169
+ console.log(chalk.red(`Error compiling code at ${filePath}`));
155
170
  return "";
156
171
  }
157
172
  };
@@ -188,14 +203,27 @@ class FileManager {
188
203
  if (entry.isDirectory()) {
189
204
  traverseDirectory(fullPath);
190
205
  } else if (entry.isFile()) {
206
+ // skip các file trong thư mục bị ignore
207
+ if (ignoreFolders.some((folder) => fullPath.includes(folder))) {
208
+ return;
209
+ }
210
+
211
+ // chỉ hổ trợ các files nằm trong ./src
212
+ if (!fullPath.includes("/src/") && !fullPath.includes("\\src\\")) {
213
+ return;
214
+ }
215
+
191
216
  const content = fs.readFileSync(fullPath, { encoding: "utf8" });
192
- files.push({
193
- path: this.replaceSplashWithSeparator(
194
- fullPath.replace(this.basePath + path.sep, "./")
195
- ),
196
- content,
197
- es5: compileES5(content, fullPath) ?? "",
198
- });
217
+ const extname = path.extname(fullPath);
218
+ if (supportedExtensions.includes(extname)) {
219
+ files.push({
220
+ path: this.replaceSplashWithSeparator(
221
+ fullPath.replace(this.basePath + path.sep, "./")
222
+ ),
223
+ content,
224
+ es5: compileES5(content, fullPath) ?? "",
225
+ });
226
+ }
199
227
  }
200
228
  });
201
229
  };
@@ -447,7 +475,7 @@ class RoomState {
447
475
  }
448
476
  }
449
477
 
450
- program.version("0.0.22").description("Hapico CLI for project management");
478
+ program.version("0.0.24").description("Hapico CLI for project management");
451
479
 
452
480
  program
453
481
  .command("clone <id>")
@@ -549,18 +577,23 @@ program
549
577
 
550
578
  const pullCode = pullResponse?.data?.code;
551
579
  if (!pullCode) {
552
- pullSpinner.info(chalk.cyan("No draft version found – using published version."));
580
+ pullSpinner.info(
581
+ chalk.cyan("No draft version found – using published version.")
582
+ );
553
583
  } else {
554
584
  const pullDecompressed = pako.inflate(
555
585
  Uint8Array.from(atob(pullCode), (c) => c.charCodeAt(0)),
556
586
  { to: "string" }
557
587
  );
558
- const latestFiles: FileContent[] = tryJSONParse(pullDecompressed)?.files || [];
588
+ const latestFiles: FileContent[] =
589
+ tryJSONParse(pullDecompressed)?.files || [];
559
590
 
560
591
  const fileManager = new FileManager(path.join(outputDir, "src"));
561
592
  fileManager.syncFiles(latestFiles);
562
593
 
563
- pullSpinner.succeed(chalk.green("✓ Latest changes pulled successfully!"));
594
+ pullSpinner.succeed(
595
+ chalk.green("✓ Latest changes pulled successfully!")
596
+ );
564
597
  }
565
598
  } catch (pullErr: any) {
566
599
  pullSpinner.warn(
@@ -584,7 +617,7 @@ program
584
617
  program
585
618
  .command("dev")
586
619
  .description("Start the project in development mode")
587
- .option('--zversion <version>', 'Zalo version for QR code', '75')
620
+ .option("--zversion <version>", "Zalo version for QR code")
588
621
  .action((options) => {
589
622
  const { accessToken } = getStoredToken();
590
623
  if (!accessToken) {
@@ -680,19 +713,10 @@ program
680
713
  ".jsx",
681
714
  ".json",
682
715
  ".css",
683
- ".html",
684
716
  ".env",
685
717
  ".env.local",
686
718
  ".env.development",
687
719
  ".env.production",
688
- ".jsonc",
689
- ".yml",
690
- ".yaml",
691
- ".md",
692
- ".markdown",
693
- ".txt",
694
- ".xml",
695
- ".config",
696
720
  ];
697
721
  const filteredFiles = initialFiles.filter((file) => {
698
722
  return supportExtensions.some((ext) => file.path.endsWith(ext));
@@ -748,19 +772,46 @@ program
748
772
  }
749
773
 
750
774
  const projectType = project.data.type || "view";
751
- const zversion = options.zversion || '75';
752
-
753
- if (projectType === "zalominiapp") {
754
- QRCode.generate(
755
- `https://zalo.me/s/3218692650896662017/player/${projectId}?env=TESTING&version=${zversion}`,
756
- { small: true },
757
- (qrcode) => {
758
- console.log(
759
- chalk.cyan("📱 Scan this QR code to connect to the project:")
760
- );
761
- console.log(qrcode);
762
- }
763
- );
775
+ const zversion = options.zversion;
776
+
777
+ if (projectType === "expo_app") {
778
+ const BASE_EXPO_LINK = `exp://u.expo.dev/e362c6df-abe8-4503-8723-1362f015d167/group/8cd11ab9-b6db-4924-9f7a-5e449f027bba`;
779
+ //exp://u.expo.dev/e362c6df-abe8-4503-8723-1362f015d167/group/8cd11ab9-b6db-4924-9f7a-5e449f027bba?sessionKey=eyJpZCI6IjU1NF8xIiwidmlld0lkIjo1NTR9&mode=development
780
+ const link = `${BASE_EXPO_LINK}?sessionKey=${projectId}&mode=development`;
781
+ QRCode.generate(link, { small: true }, (qrcode) => {
782
+ console.log(
783
+ chalk.cyan(
784
+ "📱 Scan this QR code with Expo Go to connect to the project:"
785
+ )
786
+ );
787
+ console.log(qrcode);
788
+ });
789
+ return;
790
+ } else if (projectType === "zalominiapp") {
791
+ console.log("zversion", zversion);
792
+ if (!zversion) {
793
+ QRCode.generate(
794
+ `https://zalo.me/s/3218692650896662017/player/${projectId}`,
795
+ { small: true },
796
+ (qrcode) => {
797
+ console.log(
798
+ chalk.cyan("📱 Scan this QR code to connect to the project:")
799
+ );
800
+ console.log(qrcode);
801
+ }
802
+ );
803
+ } else {
804
+ QRCode.generate(
805
+ `https://zalo.me/s/3218692650896662017/player/${projectId}?env=TESTING&version=${zversion}`,
806
+ { small: true },
807
+ (qrcode) => {
808
+ console.log(
809
+ chalk.cyan("📱 Scan this QR code to connect to the project:")
810
+ );
811
+ console.log(qrcode);
812
+ }
813
+ );
814
+ }
764
815
  return;
765
816
  } else {
766
817
  const previewUrl = `https://com.ai.vn/dev_preview/${projectId}`;
@@ -795,7 +846,10 @@ async function pushProject(spinner: Ora, projectId: string): Promise<boolean> {
795
846
  return false;
796
847
  }
797
848
  const fileManager = new FileManager(srcDir);
798
- const files = fileManager.listFiles();
849
+ const files = fileManager.listFiles().filter((file) => {
850
+ const extname = path.extname(file.path);
851
+ return supportedExtensions.includes(extname);
852
+ });
799
853
 
800
854
  // Supported files
801
855
  const SUPPORT_FILES = [
@@ -824,6 +878,13 @@ async function pushProject(spinner: Ora, projectId: string): Promise<boolean> {
824
878
  });
825
879
  }
826
880
  });
881
+ // Show ra thông tin dung lượng mã nguồn
882
+ const totalSize = files.reduce((acc, file) => acc + file.content.length, 0);
883
+ console.log(
884
+ chalk.cyan(
885
+ `Total source code size for project ${projectId}: ${(totalSize / 1024).toFixed(2)} KB`
886
+ )
887
+ );
827
888
  spinner.text = `Pushing project source code to server for project ${projectId}...`;
828
889
 
829
890
  const apiUrl = `https://base.myworkbeast.com/api/views/${projectId}`;
@@ -1441,7 +1502,7 @@ program.command("publish").action(async () => {
1441
1502
 
1442
1503
  // Step 2: Publish main project
1443
1504
  const { accessToken } = getStoredToken();
1444
- const apiUrl = "https://base.myworkbeast.com/api/views/publish";
1505
+ const apiUrl = "https://base.myworkbeast.com/api/views/publish/v2";
1445
1506
  let allPublishSuccess = true;
1446
1507
  try {
1447
1508
  await axios.post(
@@ -1533,4 +1594,4 @@ ${file.content}
1533
1594
  console.log(chalk.green(`✓ File list saved to ${outputFile}`));
1534
1595
  });
1535
1596
 
1536
- program.parse(process.argv);
1597
+ program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hapico/cli",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
4
4
  "description": "A simple CLI tool for project management",
5
5
  "main": "index.js",
6
6
  "bin": {