From 0d92c5d21ee46d8ac34f863fb5891dcd2a0588b7 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Thu, 24 Jul 2025 01:15:09 +0200 Subject: [PATCH] [c] Fix main module check --- spine-c/codegen/src/index.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/spine-c/codegen/src/index.ts b/spine-c/codegen/src/index.ts index ace23e161..4b0831799 100644 --- a/spine-c/codegen/src/index.ts +++ b/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); -}); \ No newline at end of file +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); + }); +} \ No newline at end of file