@hapico/cli 0.0.27 → 0.0.28
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 +17 -2
- package/dist/index.js +17 -2
- package/index.ts +16 -4
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -210,8 +210,19 @@ class FileManager {
|
|
|
210
210
|
return files;
|
|
211
211
|
}
|
|
212
212
|
writeFile(file) {
|
|
213
|
+
if (!file.path || file.path.trim() === "")
|
|
214
|
+
return;
|
|
213
215
|
try {
|
|
214
216
|
const fullPath = path.join(this.basePath, file.path);
|
|
217
|
+
if (fs.existsSync(fullPath)) {
|
|
218
|
+
try {
|
|
219
|
+
if (fs.statSync(fullPath).isDirectory())
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
catch (e) {
|
|
223
|
+
// ignore
|
|
224
|
+
}
|
|
225
|
+
}
|
|
215
226
|
const dir = path.dirname(fullPath);
|
|
216
227
|
fs.mkdirSync(dir, { recursive: true });
|
|
217
228
|
let hasChanged = true;
|
|
@@ -223,6 +234,8 @@ class FileManager {
|
|
|
223
234
|
hasChanged = existingContent !== file.content;
|
|
224
235
|
}
|
|
225
236
|
catch (readError) {
|
|
237
|
+
if (readError.code === "EISDIR")
|
|
238
|
+
return;
|
|
226
239
|
console.warn(chalk_1.default.yellow(`Warning: Could not read existing file ${fullPath}, treating as changed:`), readError);
|
|
227
240
|
hasChanged = true;
|
|
228
241
|
}
|
|
@@ -232,6 +245,8 @@ class FileManager {
|
|
|
232
245
|
}
|
|
233
246
|
}
|
|
234
247
|
catch (error) {
|
|
248
|
+
if (error.code === "EISDIR")
|
|
249
|
+
return;
|
|
235
250
|
console.error(chalk_1.default.red(`Error processing file ${file.path}:`), error);
|
|
236
251
|
throw error;
|
|
237
252
|
}
|
|
@@ -396,7 +411,7 @@ class RoomState {
|
|
|
396
411
|
return this.isConnected;
|
|
397
412
|
}
|
|
398
413
|
}
|
|
399
|
-
commander_1.program.version("0.0.
|
|
414
|
+
commander_1.program.version("0.0.28").description("Hapico CLI for project management");
|
|
400
415
|
commander_1.program
|
|
401
416
|
.command("clone <id>")
|
|
402
417
|
.description("Clone a project by ID")
|
|
@@ -615,7 +630,7 @@ commander_1.program
|
|
|
615
630
|
const projectType = project.data.type || "view";
|
|
616
631
|
const zversion = options.zversion;
|
|
617
632
|
if (projectType === "expo_app" || projectType === "emg_edu_lesson") {
|
|
618
|
-
const BASE_EXPO_LINK = `exp://u.expo.dev/e362c6df-abe8-4503-8723-1362f015d167/group/
|
|
633
|
+
const BASE_EXPO_LINK = `exp://u.expo.dev/e362c6df-abe8-4503-8723-1362f015d167/group/e5d6b96e-3c78-485a-a170-1d8aa8b2c47e`;
|
|
619
634
|
const link = `${BASE_EXPO_LINK}?sessionKey=${projectId}&mode=development`;
|
|
620
635
|
qrcode_terminal_1.default.generate(link, { small: true }, (qrcode) => {
|
|
621
636
|
console.log(chalk_1.default.cyan("📱 Scan this QR code with Expo Go to connect to the project:"));
|
package/dist/index.js
CHANGED
|
@@ -210,8 +210,19 @@ class FileManager {
|
|
|
210
210
|
return files;
|
|
211
211
|
}
|
|
212
212
|
writeFile(file) {
|
|
213
|
+
if (!file.path || file.path.trim() === "")
|
|
214
|
+
return;
|
|
213
215
|
try {
|
|
214
216
|
const fullPath = path.join(this.basePath, file.path);
|
|
217
|
+
if (fs.existsSync(fullPath)) {
|
|
218
|
+
try {
|
|
219
|
+
if (fs.statSync(fullPath).isDirectory())
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
catch (e) {
|
|
223
|
+
// ignore
|
|
224
|
+
}
|
|
225
|
+
}
|
|
215
226
|
const dir = path.dirname(fullPath);
|
|
216
227
|
fs.mkdirSync(dir, { recursive: true });
|
|
217
228
|
let hasChanged = true;
|
|
@@ -223,6 +234,8 @@ class FileManager {
|
|
|
223
234
|
hasChanged = existingContent !== file.content;
|
|
224
235
|
}
|
|
225
236
|
catch (readError) {
|
|
237
|
+
if (readError.code === "EISDIR")
|
|
238
|
+
return;
|
|
226
239
|
console.warn(chalk_1.default.yellow(`Warning: Could not read existing file ${fullPath}, treating as changed:`), readError);
|
|
227
240
|
hasChanged = true;
|
|
228
241
|
}
|
|
@@ -232,6 +245,8 @@ class FileManager {
|
|
|
232
245
|
}
|
|
233
246
|
}
|
|
234
247
|
catch (error) {
|
|
248
|
+
if (error.code === "EISDIR")
|
|
249
|
+
return;
|
|
235
250
|
console.error(chalk_1.default.red(`Error processing file ${file.path}:`), error);
|
|
236
251
|
throw error;
|
|
237
252
|
}
|
|
@@ -396,7 +411,7 @@ class RoomState {
|
|
|
396
411
|
return this.isConnected;
|
|
397
412
|
}
|
|
398
413
|
}
|
|
399
|
-
commander_1.program.version("0.0.
|
|
414
|
+
commander_1.program.version("0.0.28").description("Hapico CLI for project management");
|
|
400
415
|
commander_1.program
|
|
401
416
|
.command("clone <id>")
|
|
402
417
|
.description("Clone a project by ID")
|
|
@@ -615,7 +630,7 @@ commander_1.program
|
|
|
615
630
|
const projectType = project.data.type || "view";
|
|
616
631
|
const zversion = options.zversion;
|
|
617
632
|
if (projectType === "expo_app" || projectType === "emg_edu_lesson") {
|
|
618
|
-
const BASE_EXPO_LINK = `exp://u.expo.dev/e362c6df-abe8-4503-8723-1362f015d167/group/
|
|
633
|
+
const BASE_EXPO_LINK = `exp://u.expo.dev/e362c6df-abe8-4503-8723-1362f015d167/group/e5d6b96e-3c78-485a-a170-1d8aa8b2c47e`;
|
|
619
634
|
const link = `${BASE_EXPO_LINK}?sessionKey=${projectId}&mode=development`;
|
|
620
635
|
qrcode_terminal_1.default.generate(link, { small: true }, (qrcode) => {
|
|
621
636
|
console.log(chalk_1.default.cyan("📱 Scan this QR code with Expo Go to connect to the project:"));
|
package/index.ts
CHANGED
|
@@ -228,8 +228,18 @@ class FileManager {
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
private writeFile(file: FileContent): void {
|
|
231
|
+
if (!file.path || file.path.trim() === "") return;
|
|
231
232
|
try {
|
|
232
233
|
const fullPath = path.join(this.basePath, file.path);
|
|
234
|
+
|
|
235
|
+
if (fs.existsSync(fullPath)) {
|
|
236
|
+
try {
|
|
237
|
+
if (fs.statSync(fullPath).isDirectory()) return;
|
|
238
|
+
} catch (e) {
|
|
239
|
+
// ignore
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
233
243
|
const dir = path.dirname(fullPath);
|
|
234
244
|
fs.mkdirSync(dir, { recursive: true });
|
|
235
245
|
|
|
@@ -240,7 +250,8 @@ class FileManager {
|
|
|
240
250
|
encoding: "utf8",
|
|
241
251
|
});
|
|
242
252
|
hasChanged = existingContent !== file.content;
|
|
243
|
-
} catch (readError) {
|
|
253
|
+
} catch (readError: any) {
|
|
254
|
+
if (readError.code === "EISDIR") return;
|
|
244
255
|
console.warn(
|
|
245
256
|
chalk.yellow(
|
|
246
257
|
`Warning: Could not read existing file ${fullPath}, treating as changed:`
|
|
@@ -254,7 +265,8 @@ class FileManager {
|
|
|
254
265
|
if (hasChanged) {
|
|
255
266
|
fs.writeFileSync(fullPath, file.content, { encoding: "utf8" });
|
|
256
267
|
}
|
|
257
|
-
} catch (error) {
|
|
268
|
+
} catch (error: any) {
|
|
269
|
+
if (error.code === "EISDIR") return;
|
|
258
270
|
console.error(chalk.red(`Error processing file ${file.path}:`), error);
|
|
259
271
|
throw error;
|
|
260
272
|
}
|
|
@@ -471,7 +483,7 @@ class RoomState {
|
|
|
471
483
|
}
|
|
472
484
|
}
|
|
473
485
|
|
|
474
|
-
program.version("0.0.
|
|
486
|
+
program.version("0.0.28").description("Hapico CLI for project management");
|
|
475
487
|
|
|
476
488
|
program
|
|
477
489
|
.command("clone <id>")
|
|
@@ -784,7 +796,7 @@ program
|
|
|
784
796
|
const zversion = options.zversion;
|
|
785
797
|
|
|
786
798
|
if (projectType === "expo_app" || projectType === "emg_edu_lesson") {
|
|
787
|
-
const BASE_EXPO_LINK = `exp://u.expo.dev/e362c6df-abe8-4503-8723-1362f015d167/group/
|
|
799
|
+
const BASE_EXPO_LINK = `exp://u.expo.dev/e362c6df-abe8-4503-8723-1362f015d167/group/e5d6b96e-3c78-485a-a170-1d8aa8b2c47e`;
|
|
788
800
|
const link = `${BASE_EXPO_LINK}?sessionKey=${projectId}&mode=development`;
|
|
789
801
|
QRCode.generate(link, { small: true }, (qrcode) => {
|
|
790
802
|
console.log(
|