MCPcopy
hub / github.com/QwikDev/qwik / copyDir

Function copyDir

scripts/create-qwik-cli.ts:168–188  ·  view source on GitHub ↗
(config: BuildConfig, srcDir: string, destDir: string)

Source from the content-addressed store, hash-verified

166}
167
168async function copyDir(config: BuildConfig, srcDir: string, destDir: string) {
169 await mkdir(destDir);
170 const items = await readdir(srcDir);
171 await Promise.all(
172 items.map(async (itemName) => {
173 if (isValidFsItem(itemName)) {
174 const srcPath = join(srcDir, itemName);
175 const destPath = join(destDir, itemName);
176 const itemStat = await stat(srcPath);
177 if (itemStat.isDirectory()) {
178 await copyDir(config, srcPath, destPath);
179 } else if (itemStat.isFile()) {
180 await copyFile(srcPath, destPath);
181 if (basename(destPath) === 'package.json') {
182 await updatePackageJson(config, destDir);
183 }
184 }
185 }
186 })
187 );
188}
189
190async function updatePackageJson(config: BuildConfig, destDir: string) {
191 const rootPkg = await readPackageJson(config.rootDir);

Callers 1

copyStartersDirFunction · 0.70

Calls 4

isValidFsItemFunction · 0.85
joinFunction · 0.85
updatePackageJsonFunction · 0.85
basenameFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…