All files / packages/design-system/scripts/scs exec-adapter.js

25% Statements 1/4
100% Branches 0/0
0% Functions 0/2
25% Lines 1/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25                          1x                      
/**
 * Thin adapter over execa v10, which removed the `commandSync` / `.sync`
 * methods this pipeline relied on. It re-exposes that legacy surface so the
 * SCS scripts (and their injected-`exec` test mocks) keep a stable contract:
 *
 *   exec.commandSync('git fetch origin main', { cwd })  // full command string
 *   exec.sync('git', ['commit', '-m', msg], { cwd })     // binary + args array
 *
 * Both are backed by execa's new `execaSync`; command strings are tokenized
 * with `parseCommandString` (the documented replacement for `commandSync`).
 */
import { execaSync, parseCommandString } from 'execa';
 
const exec = {
  commandSync(command, options) {
    const [file, ...args] = parseCommandString(command);
    return execaSync(file, args, options);
  },
  sync(file, args, options) {
    return execaSync(file, args, options);
  },
};
 
export default exec;