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

rewrite open command to typescript #1403

Merged
merged 4 commits into from
Jun 19, 2019
Merged

rewrite open command to typescript #1403

merged 4 commits into from
Jun 19, 2019

Conversation

bkendall
Copy link
Contributor

@bkendall bkendall commented Jun 14, 2019

Description

Rewrite open command to Typescript.

Scenarios Tested

  • firebase open
  • firebase open hosting:site
  • firebase open asdf (for the error)

This fixes an internal bug: b/135410470

@bkendall bkendall requested a review from thechenky June 14, 2019 21:13
@googlebot googlebot added the cla: yes Manual indication that this has passed CLA. label Jun 14, 2019
@coveralls
Copy link

coveralls commented Jun 14, 2019

Coverage Status

Coverage decreased (-0.05%) to 61.319% when pulling 5278494 on bk-open into 8337e70 on master.

} else if (link.arg === "hosting:site") {
url = utils.addSubdomain(api.hostingOrigin, options.instance);
} else if (link.arg === "functions") {
url = "https://console.firebase.google.com/project/" + options.project + "/functions/list";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd move the url without the path as a constant at the top like

const FIREBASE_CONSOLE = "https://console.firebase.google.com" then use format string here to make paths look nicer.

Also noticing...couldn't this be utils.consoleUrl(options.project, "/functions/list");?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This particular one has been removed in favor of utils.consoleUrl.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sg

url = "https://console.firebase.google.com/project/" + options.project + "/functions/list";
} else if (link.arg === "functions:log") {
url =
"https://console.developers.google.com/logs/viewer?resource=cloudfunctions.googleapis.com&project=" +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, move to const at the top of the file as GCP_CONSOLE = ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I weigh these in my head: moving a string to a constant elsewhere in a file vs. keeping context where it's necessary. In this case, keeping the context well out-weighs moving part of this to a constant. It's only in one spot and it's important to realize this goes very much elsewhere.

That said, isn't this a really, really outdated URL (should it be console.cloud.google.com)? And why shouldn't it be utils.consoleUrl(options.project, "/functions/logs")?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree if it's not used anywhere else that it's fine to keep the URL here. Interesting point, this was probably going to the google cloud console because we didn't have logs implemented in firebase console? We should change that to open the Firebase console :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. I'm fine with changing that, but I think that should be in a different CL since that's changing some behavior (I'd like to keep this having the same behavior... plus that little fix)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure that sounds fine

src/commands/open.ts Show resolved Hide resolved
src/commands/open.ts Outdated Show resolved Hide resolved
src/commands/open.ts Outdated Show resolved Hide resolved
@bkendall bkendall requested a review from thechenky June 18, 2019 22:47
Copy link
Contributor

@thechenky thechenky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Manual indication that this has passed CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants