Skip to content

Instantly share code, notes, and snippets.

@remorses
Created December 15, 2025 21:33
Show Gist options
  • Select an option

  • Save remorses/77e5245c66d16be92614ac21a71bf58a to your computer and use it in GitHub Desktop.

Select an option

Save remorses/77e5245c66d16be92614ac21a71bf58a to your computer and use it in GitHub Desktop.
Termcast bug fixes for release command

Termcast Bug Fixes

Two bugs were found in termcast that prevented the release command from working properly.

Bug 1: Release command requires path argument

File: src/cli.ts (or dist/cli.js)

Problem: The release command was defined with a required <path> argument, but dev and build commands use optional [path]. Running termcast release without a path silently did nothing.

Fix: Change <path> to [path] and add fallback to process.cwd():

 cli
-    .command('release <path>', 'Build and publish extension to GitHub releases')
+    .command('release [path]', 'Build and publish extension to GitHub releases')
     .option('--single', 'Only compile for the current platform')
     .action(async (extensionPath, options) => {
-    extensionPath = path.resolve(extensionPath);
+    extensionPath = path.resolve(extensionPath || process.cwd());

Bug 2: Race condition in parallel compilation

File: src/compile.ts (or dist/compile.js)

Problem: When releasing, compileExtension is called in parallel for all 11 targets using Promise.all. Each compilation creates a temporary _entry.tsx file in the same location. This causes a race condition where one compile deletes the file while another is still using it.

Fix: Use a unique temp entry file per target:

+    const targetSuffix = target ? targetToFileSuffix(target) : 'default';
-    const tempEntryPath = path.join(bundleDir, '_entry.tsx');
+    const tempEntryPath = path.join(bundleDir, `_entry-${targetSuffix}.tsx`);

Summary

Bug Location Issue Fix
1 cli.ts <path> required Change to [path] with process.cwd() fallback
2 compile.ts Shared _entry.tsx Use _entry-${targetSuffix}.tsx per target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment