Skip to content

Commit

Permalink
Remove logging of metadata file upload (#2394)
Browse files Browse the repository at this point in the history
  • Loading branch information
khamilowicz authored Jun 3, 2024
1 parent f0e3b64 commit a0606ad
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 58 deletions.
41 changes: 18 additions & 23 deletions packages/eas-cli/src/build/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,20 +275,23 @@ async function uploadProjectAsync<TPlatform extends Platform>(
}

projectTarballPath = projectTarball.path;
const bucketKey = await uploadFileAtPathToGCSAsync(
ctx.graphqlClient,
UploadSessionType.EasBuildGcsProjectSources,
projectTarball.path,
createProgressTracker({
total: projectTarball.size,
message: ratio =>
`Uploading to EAS Build (${formatBytes(projectTarball.size * ratio)} / ${formatBytes(
projectTarball.size
)})`,
completedMessage: (duration: string) => `Uploaded to EAS ${chalk.dim(duration)}`,
})
);
const { metadataLocation } = await uploadMetadataFileAsync<TPlatform>(projectTarball, ctx);
const [bucketKey, { metadataLocation }] = await Promise.all([
uploadFileAtPathToGCSAsync(
ctx.graphqlClient,
UploadSessionType.EasBuildGcsProjectSources,
projectTarball.path,
createProgressTracker({
total: projectTarball.size,
message: ratio =>
`Uploading to EAS Build (${formatBytes(
projectTarball.size * ratio
)} / ${formatBytes(projectTarball.size)})`,
completedMessage: (duration: string) => `Uploaded to EAS ${chalk.dim(duration)}`,
})
),
uploadMetadataFileAsync<TPlatform>(projectTarball, ctx),
]);

if (metadataLocation) {
return { bucketKey, metadataLocation };
}
Expand Down Expand Up @@ -327,15 +330,7 @@ async function uploadMetadataFileAsync<TPlatform extends Platform>(
const metadataLocation = await uploadFileAtPathToGCSAsync(
ctx.graphqlClient,
UploadSessionType.EasBuildGcsProjectMetadata,
projectMetadataFile.path,
createProgressTracker({
total: projectMetadataFile.size,
message: ratio =>
`Uploading metadata to EAS Build (${formatBytes(
projectMetadataFile!.size * ratio
)} / ${formatBytes(projectMetadataFile!.size)})`,
completedMessage: (duration: string) => `Uploaded to EAS ${chalk.dim(duration)}`,
})
projectMetadataFile.path
);
return { metadataLocation };
} catch (err: any) {
Expand Down
45 changes: 11 additions & 34 deletions packages/eas-cli/src/build/utils/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,44 +100,21 @@ export type LocalFile = {
};

export async function makeProjectMetadataFileAsync(archivePath: string): Promise<LocalFile> {
const spinner = ora('Creating project metadata file');
const timerLabel = 'makeProjectMetadataFileAsync';
const timer = setTimeout(
() => {
spinner.start();
},
Log.isDebug ? 1 : 1000
);
startTimer(timerLabel);

const metadataLocation = path.join(getTmpDirectory(), `${uuidv4()}-eas-build-metadata.json`);
const archiveContent: string[] = [];

try {
await tar.list({
file: archivePath,
onentry: (entry: tar.ReadEntry) => {
if (entry.type === 'File' && !entry.path.includes('.git/')) {
archiveContent.push(entry.path);
}
},
});

await fs.writeJSON(metadataLocation, {
archiveContent,
});
} catch (e) {
clearTimeout(timer);
if (spinner.isSpinning) {
spinner.fail();
}
throw e;
}
clearTimeout(timer);
await tar.list({
file: archivePath,
onentry: (entry: tar.ReadEntry) => {
if (entry.type === 'File' && !entry.path.includes('.git/')) {
archiveContent.push(entry.path);
}
},
});

const duration = endTimer(timerLabel);
const prettyTime = formatMilliseconds(duration);
spinner.succeed(`Created project metadata file ${chalk.dim(prettyTime)}`);
await fs.writeJSON(metadataLocation, {
archiveContent,
});

return { path: metadataLocation, size: await fs.stat(metadataLocation).then(stat => stat.size) };
}
Expand Down
2 changes: 1 addition & 1 deletion packages/eas-cli/src/uploads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function uploadFileAtPathToGCSAsync(
graphqlClient: ExpoGraphqlClient,
type: UploadSessionType,
path: string,
handleProgressEvent: ProgressHandler
handleProgressEvent: ProgressHandler = () => {}
): Promise<string> {
const signedUrl = await UploadSessionMutation.createUploadSessionAsync(graphqlClient, type);

Expand Down

0 comments on commit a0606ad

Please sign in to comment.