Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fixed an issue where functions deployments would silently fail (#6989)
81 changes: 42 additions & 39 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
import { reconcileStudioFirebaseProject } from "./management/studio";
import { requireAuth } from "./requireAuth";
import { Options } from "./options";
import { useConsoleLoggers } from "./logger";
import { logger, useConsoleLoggers } from "./logger";
import { isFirebaseStudio } from "./env";

export interface CommandModule {
load: () => void;
}

export function isCommandModule(value: unknown): value is CommandModule {

Check warning on line 25 in src/command.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing JSDoc comment
return typeof value === "function" && typeof (value as any).load === "function";

Check warning on line 26 in src/command.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type

Check warning on line 26 in src/command.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .load on an `any` value
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand All @@ -38,7 +38,7 @@
export interface CLIClient {
cli: CommanderStatic;
errorOut: (e: Error) => void;
[key: string]: any;

Check warning on line 41 in src/command.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
}

/**
Expand Down Expand Up @@ -78,7 +78,7 @@

/**
* Sets an alias for a command.
* @param aliases an alternativre name for the command. Users will be able to call the command via this name.

Check warning on line 81 in src/command.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Expected @PARAM names to be "alias". Got "aliases"
* @return the command, for chaining.
*/
alias(alias: string): Command {
Expand All @@ -87,10 +87,10 @@
}

/**
* Sets any options for the command.

Check warning on line 90 in src/command.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Expected only 0 line after block description
*
* @example
* command.option("-d, --debug", "turn on debugging", false)

Check warning on line 93 in src/command.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Expected no lines between tags
*
* @param args the commander-style option definition.
* @return the command, for chaining.
Expand All @@ -102,10 +102,10 @@
}

/**
* Sets up --force flag for the command.

Check warning on line 105 in src/command.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Expected only 0 line after block description
*
* @param message overrides the description for --force for this command
* @returns the command, for chaining

Check warning on line 108 in src/command.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Invalid JSDoc tag (preference). Replace "returns" JSDoc tag with "return"
*/
withForce(message?: string): Command {
this.options.push(["-f, --force", message || "automatically accept all interactive prompts"]);
Expand All @@ -129,7 +129,7 @@
*
* This text is displayed when:
* - the `--help` flag is passed to the command, or
* - the `help <command>` command is used.

Check warning on line 132 in src/command.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Expected only 0 line after block description
*
* @param t the human-readable help text.
* @return the command, for chaining.
Expand Down Expand Up @@ -236,28 +236,28 @@
});
}
const duration = Math.floor((process.uptime() - start) * 1000);
const trackSuccess = trackGA4(
"command_execution",
{
command_name: this.name,
result: "success",
interactive: getInheritedOption(options, "nonInteractive") ? "false" : "true",
},
duration,
);
if (!isEmulator) {
await withTimeout(5000, trackSuccess);
} else {
await withTimeout(
5000,
Promise.all([
trackSuccess,
try {
const trackSuccess = trackGA4(
"command_execution",
{
command_name: this.name,
result: "success",
interactive: getInheritedOption(options, "nonInteractive") ? "false" : "true",
},
duration,
);
const tracks = [trackSuccess];
if (isEmulator) {
tracks.push(
trackEmulator("command_success", {
command_name: this.name,
duration,
}),
]),
);
);
}
await withTimeout(1000, Promise.all(tracks));
} catch (gaErr) {
logger.debug("Analytics tracking failed during success path:", gaErr);
}
Comment thread
shettyvarun268 marked this conversation as resolved.
Resolved
process.exit();
})
Expand All @@ -278,27 +278,30 @@
});
}
const duration = Math.floor((process.uptime() - start) * 1000);
await withTimeout(
5000,
Promise.all([
trackGA4(
"command_execution",
{
try {
const trackError = trackGA4(
"command_execution",
{
command_name: this.name,
result: "error",
interactive: getInheritedOption(options, "nonInteractive") ? "false" : "true",
},
duration,
);
const tracks = [trackError];
if (isEmulator) {
tracks.push(
trackEmulator("command_error", {
command_name: this.name,
result: "error",
interactive: getInheritedOption(options, "nonInteractive") ? "false" : "true",
},
duration,
),
isEmulator
? trackEmulator("command_error", {
command_name: this.name,
duration,
error_type: err.exit === 1 ? "user" : "unexpected",
})
: Promise.resolve(),
]),
);
duration,
error_type: err?.exit === 1 ? "user" : "unexpected",
}),
);
}
await withTimeout(1000, Promise.all(tracks));
} catch (gaErr) {
logger.debug("Analytics tracking failed during error path:", gaErr);
}
Comment thread
shettyvarun268 marked this conversation as resolved.
Resolved
Comment thread
shettyvarun268 marked this conversation as resolved.
Resolved

client.errorOut(err);
});
Expand Down
Loading