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

Function copyFile

packages/dev/s2-docs/scripts/generateAgentSkills.mjs:765–780  ·  view source on GitHub ↗
(entry, targetSubdir, stripPrefix = null)

Source from the content-addressed store, hash-verified

763
764 // Copy files by category
765 const copyFile = (entry, targetSubdir, stripPrefix = null) => {
766 const sourcePath = path.join(sourceDir, entry.path);
767 if (!fs.existsSync(sourcePath)) {
768 return;
769 }
770
771 // Optionally strip a prefix from the path to avoid double-nesting
772 let targetRelPath = entry.path;
773 if (stripPrefix && targetRelPath.startsWith(stripPrefix)) {
774 targetRelPath = targetRelPath.slice(stripPrefix.length);
775 }
776
777 const targetPath = path.join(refsDir, targetSubdir, targetRelPath);
778 fs.mkdirSync(path.dirname(targetPath), {recursive: true});
779 fs.copyFileSync(sourcePath, targetPath);
780 };
781
782 // Copy guides
783 const customContent = getCustomSkillContent(skillConfig.name);

Callers 1

copyDocsDocumentationFunction · 0.85

Calls 1

sliceMethod · 0.80

Tested by

no test coverage detected