MCPcopy Create free account
hub / github.com/vercel/vercel / prepareFiles

Function prepareFiles

packages/client/src/utils/index.ts:391–422  ·  view source on GitHub ↗
(
  files: FilesMap,
  clientOptions: VercelClientOptions
)

Source from the content-addressed store, hash-verified

389const isWin = process.platform.includes('win');
390
391export const prepareFiles = (
392 files: FilesMap,
393 clientOptions: VercelClientOptions
394): PreparedFile[] => {
395 const preparedFiles: PreparedFile[] = [];
396 for (const [sha, file] of files) {
397 for (const name of file.names) {
398 let fileName: string;
399
400 if (clientOptions.isDirectory) {
401 // Directory
402 fileName =
403 typeof clientOptions.path === 'string'
404 ? relative(clientOptions.path, name)
405 : name;
406 } else {
407 // Array of files or single file
408 const segments = name.split(sep);
409 fileName = segments[segments.length - 1];
410 }
411
412 preparedFiles.push({
413 file: isWin ? fileName.replace(/\\/g, '/') : fileName,
414 size: file.data?.byteLength ?? file.size,
415 mode: file.mode,
416 sha: sha || undefined,
417 });
418 }
419 }
420
421 return preparedFiles;
422};
423
424export function createDebug(debug?: boolean) {
425 if (debug) {

Callers 2

postContinueFunction · 0.90
postDeploymentFunction · 0.90

Calls 4

relativeFunction · 0.90
splitMethod · 0.80
replaceMethod · 0.80
pushMethod · 0.65

Tested by

no test coverage detected