@hapico/cli 0.0.23 → 0.0.26
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 +21 -4
- package/dist/index.js +21 -4
- package/index.ts +28 -4
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -133,6 +133,7 @@ const supportedExtensions = [
|
|
|
133
133
|
".css",
|
|
134
134
|
".html",
|
|
135
135
|
".env",
|
|
136
|
+
".md",
|
|
136
137
|
];
|
|
137
138
|
const ignoreFolders = ["node_modules", ".git", ".hg", ".svn"];
|
|
138
139
|
const compileES5 = (code, filePath) => {
|
|
@@ -394,7 +395,7 @@ class RoomState {
|
|
|
394
395
|
return this.isConnected;
|
|
395
396
|
}
|
|
396
397
|
}
|
|
397
|
-
commander_1.program.version("0.0.
|
|
398
|
+
commander_1.program.version("0.0.26").description("Hapico CLI for project management");
|
|
398
399
|
commander_1.program
|
|
399
400
|
.command("clone <id>")
|
|
400
401
|
.description("Clone a project by ID")
|
|
@@ -601,7 +602,17 @@ commander_1.program
|
|
|
601
602
|
}
|
|
602
603
|
const projectType = project.data.type || "view";
|
|
603
604
|
const zversion = options.zversion;
|
|
604
|
-
if (projectType === "
|
|
605
|
+
if (projectType === "expo_app" || projectType === "emg_edu_lesson") {
|
|
606
|
+
const BASE_EXPO_LINK = `exp://u.expo.dev/e362c6df-abe8-4503-8723-1362f015d167/group/3ac94fc0-92b1-445e-8d88-9b2f6a4b869a`;
|
|
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:"));
|
|
611
|
+
console.log(qrcode);
|
|
612
|
+
});
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
else if (projectType === "zalominiapp") {
|
|
605
616
|
console.log("zversion", zversion);
|
|
606
617
|
if (!zversion) {
|
|
607
618
|
qrcode_terminal_1.default.generate(`https://zalo.me/s/3218692650896662017/player/${projectId}`, { small: true }, (qrcode) => {
|
|
@@ -639,7 +650,10 @@ async function pushProject(spinner, projectId) {
|
|
|
639
650
|
return false;
|
|
640
651
|
}
|
|
641
652
|
const fileManager = new FileManager(srcDir);
|
|
642
|
-
const files = fileManager.listFiles()
|
|
653
|
+
const files = fileManager.listFiles().filter((file) => {
|
|
654
|
+
const extname = path.extname(file.path);
|
|
655
|
+
return supportedExtensions.includes(extname);
|
|
656
|
+
});
|
|
643
657
|
// Supported files
|
|
644
658
|
const SUPPORT_FILES = [
|
|
645
659
|
"./.env",
|
|
@@ -663,6 +677,9 @@ async function pushProject(spinner, projectId) {
|
|
|
663
677
|
});
|
|
664
678
|
}
|
|
665
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`));
|
|
666
683
|
spinner.text = `Pushing project source code to server for project ${projectId}...`;
|
|
667
684
|
const apiUrl = `https://base.myworkbeast.com/api/views/${projectId}`;
|
|
668
685
|
try {
|
|
@@ -1092,7 +1109,7 @@ commander_1.program.command("publish").action(async () => {
|
|
|
1092
1109
|
}
|
|
1093
1110
|
// Step 2: Publish main project
|
|
1094
1111
|
const { accessToken } = getStoredToken();
|
|
1095
|
-
const apiUrl = "https://base.myworkbeast.com/api/views/publish";
|
|
1112
|
+
const apiUrl = "https://base.myworkbeast.com/api/views/publish/v2";
|
|
1096
1113
|
let allPublishSuccess = true;
|
|
1097
1114
|
try {
|
|
1098
1115
|
await axios_1.default.post(apiUrl, { view_id: parseInt(projectId, 10) }, {
|
package/dist/index.js
CHANGED
|
@@ -133,6 +133,7 @@ const supportedExtensions = [
|
|
|
133
133
|
".css",
|
|
134
134
|
".html",
|
|
135
135
|
".env",
|
|
136
|
+
".md",
|
|
136
137
|
];
|
|
137
138
|
const ignoreFolders = ["node_modules", ".git", ".hg", ".svn"];
|
|
138
139
|
const compileES5 = (code, filePath) => {
|
|
@@ -394,7 +395,7 @@ class RoomState {
|
|
|
394
395
|
return this.isConnected;
|
|
395
396
|
}
|
|
396
397
|
}
|
|
397
|
-
commander_1.program.version("0.0.
|
|
398
|
+
commander_1.program.version("0.0.26").description("Hapico CLI for project management");
|
|
398
399
|
commander_1.program
|
|
399
400
|
.command("clone <id>")
|
|
400
401
|
.description("Clone a project by ID")
|
|
@@ -601,7 +602,17 @@ commander_1.program
|
|
|
601
602
|
}
|
|
602
603
|
const projectType = project.data.type || "view";
|
|
603
604
|
const zversion = options.zversion;
|
|
604
|
-
if (projectType === "
|
|
605
|
+
if (projectType === "expo_app" || projectType === "emg_edu_lesson") {
|
|
606
|
+
const BASE_EXPO_LINK = `exp://u.expo.dev/e362c6df-abe8-4503-8723-1362f015d167/group/3ac94fc0-92b1-445e-8d88-9b2f6a4b869a`;
|
|
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:"));
|
|
611
|
+
console.log(qrcode);
|
|
612
|
+
});
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
else if (projectType === "zalominiapp") {
|
|
605
616
|
console.log("zversion", zversion);
|
|
606
617
|
if (!zversion) {
|
|
607
618
|
qrcode_terminal_1.default.generate(`https://zalo.me/s/3218692650896662017/player/${projectId}`, { small: true }, (qrcode) => {
|
|
@@ -639,7 +650,10 @@ async function pushProject(spinner, projectId) {
|
|
|
639
650
|
return false;
|
|
640
651
|
}
|
|
641
652
|
const fileManager = new FileManager(srcDir);
|
|
642
|
-
const files = fileManager.listFiles()
|
|
653
|
+
const files = fileManager.listFiles().filter((file) => {
|
|
654
|
+
const extname = path.extname(file.path);
|
|
655
|
+
return supportedExtensions.includes(extname);
|
|
656
|
+
});
|
|
643
657
|
// Supported files
|
|
644
658
|
const SUPPORT_FILES = [
|
|
645
659
|
"./.env",
|
|
@@ -663,6 +677,9 @@ async function pushProject(spinner, projectId) {
|
|
|
663
677
|
});
|
|
664
678
|
}
|
|
665
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`));
|
|
666
683
|
spinner.text = `Pushing project source code to server for project ${projectId}...`;
|
|
667
684
|
const apiUrl = `https://base.myworkbeast.com/api/views/${projectId}`;
|
|
668
685
|
try {
|
|
@@ -1092,7 +1109,7 @@ commander_1.program.command("publish").action(async () => {
|
|
|
1092
1109
|
}
|
|
1093
1110
|
// Step 2: Publish main project
|
|
1094
1111
|
const { accessToken } = getStoredToken();
|
|
1095
|
-
const apiUrl = "https://base.myworkbeast.com/api/views/publish";
|
|
1112
|
+
const apiUrl = "https://base.myworkbeast.com/api/views/publish/v2";
|
|
1096
1113
|
let allPublishSuccess = true;
|
|
1097
1114
|
try {
|
|
1098
1115
|
await axios_1.default.post(apiUrl, { view_id: parseInt(projectId, 10) }, {
|
package/index.ts
CHANGED
|
@@ -140,6 +140,7 @@ const supportedExtensions = [
|
|
|
140
140
|
".css",
|
|
141
141
|
".html",
|
|
142
142
|
".env",
|
|
143
|
+
".md",
|
|
143
144
|
];
|
|
144
145
|
|
|
145
146
|
const ignoreFolders = ["node_modules", ".git", ".hg", ".svn"];
|
|
@@ -474,7 +475,7 @@ class RoomState {
|
|
|
474
475
|
}
|
|
475
476
|
}
|
|
476
477
|
|
|
477
|
-
program.version("0.0.
|
|
478
|
+
program.version("0.0.26").description("Hapico CLI for project management");
|
|
478
479
|
|
|
479
480
|
program
|
|
480
481
|
.command("clone <id>")
|
|
@@ -773,7 +774,20 @@ program
|
|
|
773
774
|
const projectType = project.data.type || "view";
|
|
774
775
|
const zversion = options.zversion;
|
|
775
776
|
|
|
776
|
-
if (projectType === "
|
|
777
|
+
if (projectType === "expo_app" || projectType === "emg_edu_lesson") {
|
|
778
|
+
const BASE_EXPO_LINK = `exp://u.expo.dev/e362c6df-abe8-4503-8723-1362f015d167/group/3ac94fc0-92b1-445e-8d88-9b2f6a4b869a`;
|
|
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") {
|
|
777
791
|
console.log("zversion", zversion);
|
|
778
792
|
if (!zversion) {
|
|
779
793
|
QRCode.generate(
|
|
@@ -832,7 +846,10 @@ async function pushProject(spinner: Ora, projectId: string): Promise<boolean> {
|
|
|
832
846
|
return false;
|
|
833
847
|
}
|
|
834
848
|
const fileManager = new FileManager(srcDir);
|
|
835
|
-
const files = fileManager.listFiles()
|
|
849
|
+
const files = fileManager.listFiles().filter((file) => {
|
|
850
|
+
const extname = path.extname(file.path);
|
|
851
|
+
return supportedExtensions.includes(extname);
|
|
852
|
+
});
|
|
836
853
|
|
|
837
854
|
// Supported files
|
|
838
855
|
const SUPPORT_FILES = [
|
|
@@ -861,6 +878,13 @@ async function pushProject(spinner: Ora, projectId: string): Promise<boolean> {
|
|
|
861
878
|
});
|
|
862
879
|
}
|
|
863
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
|
+
);
|
|
864
888
|
spinner.text = `Pushing project source code to server for project ${projectId}...`;
|
|
865
889
|
|
|
866
890
|
const apiUrl = `https://base.myworkbeast.com/api/views/${projectId}`;
|
|
@@ -1478,7 +1502,7 @@ program.command("publish").action(async () => {
|
|
|
1478
1502
|
|
|
1479
1503
|
// Step 2: Publish main project
|
|
1480
1504
|
const { accessToken } = getStoredToken();
|
|
1481
|
-
const apiUrl = "https://base.myworkbeast.com/api/views/publish";
|
|
1505
|
+
const apiUrl = "https://base.myworkbeast.com/api/views/publish/v2";
|
|
1482
1506
|
let allPublishSuccess = true;
|
|
1483
1507
|
try {
|
|
1484
1508
|
await axios.post(
|