All files / packages/icons/.claude/skills/icons-release/scripts/lib repo.js

0% Statements 0/6
0% Branches 0/2
0% Functions 0/2
0% Lines 0/5

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 26                                                   
'use strict'
 
const fs = require('fs')
const path = require('path')
 
/**
 * Repo-state helper for "convert existing" (copy) handling: locate an icon's
 * SVG in a given set so we can detect a target collision. Matching is by NAME
 * within a set.
 */
 
/**
 * Return the existing repo SVG path for an icon name in a set, or null.
 * Checks common/, the set root, and ltr/ (directional).
 */
function findRepoIconPath(repoRoot, type, name) {
  const candidates = [
    path.join(repoRoot, 'svg', type, 'common', `${name}.svg`),
    path.join(repoRoot, 'svg', type, `${name}.svg`),
    path.join(repoRoot, 'svg', type, 'ltr', `${name}.svg`)
  ]
  return candidates.find(p => fs.existsSync(p)) || null
}
 
module.exports = { findRepoIconPath }