MCPcopy Create free account
hub / github.com/adobe/react-spectrum / buildIllustrationNames

Function buildIllustrationNames

packages/dev/mcp/s2/scripts/build-data.mjs:68–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

66}
67
68function buildIllustrationNames() {
69 if (!fs.existsSync(ILLUSTRATIONS_DIR)) {
70 throw new Error(`Illustrations directory not found: ${ILLUSTRATIONS_DIR}`);
71 }
72 const files = fg.sync('**/*.svg', {
73 cwd: ILLUSTRATIONS_DIR,
74 absolute: false,
75 suppressErrors: true
76 });
77 if (files.length === 0) {
78 throw new Error(`No illustration SVG files found in: ${ILLUSTRATIONS_DIR}`);
79 }
80 const ids = Array.from(
81 new Set(
82 files.map(f => {
83 const base = f.replace(/\.svg$/i, '').replace(/^S2_lin_(.*)_\d+$/, '$1');
84 return base ? base.charAt(0).toUpperCase() + base.slice(1) : base;
85 })
86 )
87 ).sort((a, b) => a.localeCompare(b));
88 return ids;
89}
90
91async function loadAliases(modPath, exportName) {
92 if (!fs.existsSync(modPath)) {

Callers 1

mainFunction · 0.85

Calls 2

sliceMethod · 0.80
sortMethod · 0.65

Tested by

no test coverage detected