All files / packages/design-system/scripts/validation/lib baseline-from-version-utils.js

100% Statements 7/7
100% Branches 4/4
100% Functions 1/1
100% Lines 7/7

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                        6x 6x 2x   4x 4x 1x   3x    
/**
 * Utilities for capture-baseline-from-version script
 */
import path from 'node:path';
import fs from 'fs-extra';
 
/**
 * Resolve the dist path inside an extracted package (package/ or package/dist).
 * @param {string} extractRoot - Path to extract root (e.g. .../package)
 * @returns {string|null} Resolved dist path or null if not found
 */
export function resolveDistPath(extractRoot) {
  const scssEntry = path.join(extractRoot, 'scss', 'index.scss');
  if (fs.existsSync(scssEntry)) {
    return extractRoot;
  }
  const distRoot = path.join(extractRoot, 'dist');
  if (fs.existsSync(path.join(distRoot, 'scss', 'index.scss'))) {
    return distRoot;
  }
  return null;
}