Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store file count on file_count event for future use #3505

Merged
merged 3 commits into from
Jan 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions packages/now-cli/src/util/deploy/process-deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export default async function processDeployment({
let queuedSpinner = null;
let buildSpinner = null;
let deploySpinner = null;
let fileCount = null;

for await (const event of createDeployment(
nowClientOptions,
Expand All @@ -81,6 +82,7 @@ export default async function processDeployment({
debug(
`Total files ${event.payload.total.size}, ${event.payload.missing.length} changed`
);
fileCount = event.payload.missing.length;

const missingSize = event.payload.missing
.map((sha: string) => event.payload.total.get(sha).data.length)
Expand Down Expand Up @@ -111,13 +113,7 @@ export default async function processDeployment({
now._host = event.payload.url;

if (!quiet) {
log(
`Synced ${pluralize(
'file',
event.payload.missing.length,
true
)} ${uploadStamp()}`
);
log(`Synced ${pluralize('file', fileCount, true)} ${uploadStamp()}`);
const version = isLegacy ? `${chalk.grey('[v1]')} ` : '';
log(`https://${event.payload.url} ${version}${deployStamp()}`);
} else {
Expand Down Expand Up @@ -187,6 +183,8 @@ export default async function processDeployment({
}
}
} else {
let fileCount = null;

for await (const event of createLegacyDeployment(
nowClientOptions,
requestBody,
Expand All @@ -200,7 +198,7 @@ export default async function processDeployment({
debug(
`Total files ${event.payload.total.size}, ${event.payload.missing.length} changed`
);

fileCount = event.payload.missing.length;
const missingSize = event.payload.missing
.map((sha: string) => event.payload.total.get(sha).data.length)
.reduce((a: number, b: number) => a + b, 0);
Expand Down Expand Up @@ -230,13 +228,7 @@ export default async function processDeployment({
now._host = event.payload.url;

if (!quiet) {
log(
`Synced ${pluralize(
'file',
event.payload.missing.length,
true
)} ${uploadStamp()}`
);
log(`Synced ${pluralize('file', fileCount, true)} ${uploadStamp()}`);
const version = isLegacy ? `${chalk.grey('[v1]')} ` : '';
log(`${event.payload.url} ${version}${deployStamp()}`);
} else {
Expand Down