refactor: migrate from qqjs to execa with custom wrapper#3678
Merged
Conversation
Replaces qqjs dependency with execa v9 and introduces a lightweight
exec.ts wrapper that preserves qqjs behavior (stdio inheritance,
command logging, error handling).
Changes:
- Created scripts/utils/exec.ts wrapper with x(), shell(), stdout(), and run() helpers
- Migrated all qqjs usage to exec.ts (install-scripts.js, version.js, smoke tests)
- Fixed execa v8→v9 breaking changes in homebrew.js and plugin tests
- Updated import syntax: import execa from 'execa' → import {execa} from 'execa'
- Replaced execa.command() with shell() helper (removed in v9)
- Updated stdio array syntax to named properties
- Removed qqjs dependency (63 packages removed)
The exec.ts wrapper provides a consistent API across all scripts:
- x(cmd, args, opts): Execute with args array (stdio: 'inherit' default)
- shell(cmd, opts): Execute shell commands (strings with pipes, etc.)
- stdout(cmd, args, opts): Capture stdout as string (trims trailing newline)
- run(fn): Async error handler (logs errors, sets process.exitCode)
- config.silent: Toggle command logging
All existing functionality preserved, no behavior changes.
Simplifications: - Removed unused config.silent feature (only ever set to false) - Inlined console.log calls (removed log() helper) - Removed intermediate defaultOptions variables - Reduced from 75 lines to 60 lines (20% reduction) Renamed exec.ts → script-exec.ts to clarify purpose: - script-exec.ts provides wrappers for shell scripts (stdio: 'inherit') - Tests that need to capture output use execa directly Changes: - scripts/utils/exec.ts → scripts/utils/script-exec.ts - Updated all imports across 5 files - smoke.acceptance.test.ts: uses execa directly (needs output capture) - plugin.acceptance.test.ts: uses script-exec.ts (no capture needed) - Fixed TypeScript syntax in install-scripts.js (removed 'as const') All tests pass with proper type checking.
d66ed82 to
b8f82a7
Compare
Converted script-exec from TypeScript to plain JavaScript to eliminate the build step dependency. Scripts can now run directly without requiring 'npm run build' first, which is more reliable for CI/CD pipelines. Changes: - src/lib/scripts/script-exec.ts → scripts/utils/script-exec.js - Removed all TypeScript type annotations - Reverted all imports back to ../utils/script-exec.js paths - No build step required Benefits: - Scripts work immediately without compilation - Simpler CI/CD - no build step before running scripts - Fewer failure points in release automation - 60 lines of clean, dependency-minimal JavaScript Validation: - All scripts pass syntax check - install-scripts.js executes correctly - version.js executes and returns version - All tests type check correctly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR replaces the
qqjsdependency withexecav9 and introduces a lightweight wrapper (scripts/utils/exec.ts) that preserves qqjs behavior while modernizing our command execution infrastructure.Key changes:
scripts/utils/exec.tswrapper withx(),shell(),stdout(), andrun()helpers that maintain qqjs defaults (stdio inheritance, command logging, error handling)Benefits:
Type of Change
Patch Updates (patch semver update)
Testing
Notes:
All existing scripts and tests continue to work unchanged. The exec.ts wrapper preserves exact qqjs behavior:
Steps: