소스 검색

[c] Fix main module check

Mario Zechner 1 개월 전
부모
커밋
0d92c5d21e
1개의 변경된 파일7개의 추가작업 그리고 4개의 파일을 삭제
  1. 7 4
      spine-c/codegen/src/index.ts

+ 7 - 4
spine-c/codegen/src/index.ts

@@ -83,7 +83,10 @@ async function main() {
     console.log('Code generation complete!');
 }
 
-main().catch(error => {
-    console.error('Error:', error);
-    process.exit(1);
-});
+if (import.meta.url === `file://${process.argv[1]}`) {
+    // Run the main function if this file is executed directly
+    main().catch(error => {
+        console.error('Error during code generation:', error);
+        process.exit(1);
+    });
+}