-
Notifications
You must be signed in to change notification settings - Fork 1.1k
firebase init
no longer requires login if no project is selected
#9251
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
Merged
+118
−176
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
fadefbe
Show init button even if not login yet
fredzqm b4d470c
compile
fredzqm 61953c4
Merge remote-tracking branch 'origin/master' into fz/fdc-no-login-init
fredzqm 7b5c744
changelog
fredzqm 86ff3a7
m
fredzqm 8129202
Update src/init/features/project.ts
fredzqm 589be1e
Merge branch 'master' into fz/fdc-no-login-init
fredzqm c180607
move auth after project options
fredzqm 0ef83e2
move auth after project options
fredzqm 61c1e65
Merge remote-tracking branch 'origin/master' into fz/fdc-no-login-init
fredzqm da9065c
changelog
fredzqm fe8e0f0
tests
fredzqm 4743e37
fix tests
fredzqm 2dd41c8
m
fredzqm b6f7436
Merge remote-tracking branch 'origin/master' into fz/fdc-no-login-init
fredzqm edbb6df
add metrics
fredzqm 63658b4
Update CHANGELOG.md
joehan 9e1bff5
Merge branch 'master' into fz/fdc-no-login-init
fredzqm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
- Fix Functions MCP log tool to normalize sort order and surface Cloud Logging error details (#9247) | ||
- Fixed an issue where `firebase init` would require log in even when no project is selected. (#9251) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ import * as projectManager from "../../management/projects"; | |
import { Config } from "../../config"; | ||
import { FirebaseProjectMetadata } from "../../types/project"; | ||
import * as promptImport from "../../prompt"; | ||
import * as requireAuthImport from "../../requireAuth"; | ||
|
||
const TEST_FIREBASE_PROJECT: FirebaseProjectMetadata = { | ||
projectId: "my-project-123", | ||
|
@@ -34,6 +35,7 @@ describe("project", () => { | |
let emptyConfig: Config; | ||
|
||
beforeEach(() => { | ||
sandbox.stub(requireAuthImport, "requireAuth").resolves(); | ||
getProjectStub = sandbox.stub(projectManager, "getFirebaseProject"); | ||
createFirebaseProjectStub = sandbox.stub(projectManager, "createFirebaseProjectAndLog"); | ||
getOrPromptProjectStub = sandbox.stub(projectManager, "getOrPromptProject"); | ||
|
@@ -94,26 +96,6 @@ describe("project", () => { | |
displayName: "my-project", | ||
}); | ||
}); | ||
|
||
it("should throw if project ID is empty after prompt", async () => { | ||
const options = {}; | ||
const setup = { config: {}, rcfile: {} }; | ||
prompt.select.onFirstCall().resolves("Create a new project"); | ||
prompt.input.resolves(""); | ||
configstoreSetStub.onFirstCall().resolves(); | ||
|
||
let err; | ||
try { | ||
await doSetup(setup, emptyConfig, options); | ||
} catch (e: any) { | ||
err = e; | ||
} | ||
|
||
expect(err.message).to.equal("Project ID cannot be empty"); | ||
expect(prompt.select).to.be.calledOnce; | ||
expect(prompt.input).to.be.calledTwice; | ||
expect(createFirebaseProjectStub).to.be.not.called; | ||
}); | ||
}); | ||
|
||
describe('with "Add Firebase resources to GCP project" option', () => { | ||
|
@@ -137,27 +119,6 @@ describe("project", () => { | |
expect(promptAvailableProjectIdStub).to.be.calledOnce; | ||
expect(addFirebaseProjectStub).to.be.calledOnceWith("my-project-123"); | ||
}); | ||
|
||
it("should throw if project ID is empty after prompt", async () => { | ||
const options = {}; | ||
const setup = { config: {}, rcfile: {} }; | ||
prompt.select | ||
.onFirstCall() | ||
.resolves("Add Firebase to an existing Google Cloud Platform project"); | ||
promptAvailableProjectIdStub.onFirstCall().resolves(""); | ||
|
||
let err; | ||
try { | ||
await doSetup(setup, emptyConfig, options); | ||
} catch (e: any) { | ||
err = e; | ||
} | ||
|
||
expect(err.message).to.equal("Project ID cannot be empty"); | ||
expect(prompt.select).to.be.calledOnce; | ||
expect(promptAvailableProjectIdStub).to.be.calledOnce; | ||
expect(addFirebaseProjectStub).to.be.not.called; | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This still works. I moved the validation into |
||
}); | ||
|
||
describe(`with "Don't set up a default project" option`, () => { | ||
|
@@ -181,6 +142,7 @@ describe("project", () => { | |
options = {}; | ||
setup = { config: {}, rcfile: { projects: { default: "my-project-123" } } }; | ||
getProjectStub.onFirstCall().resolves(TEST_FIREBASE_PROJECT); | ||
configstoreSetStub.onFirstCall().resolves(); | ||
}); | ||
|
||
it("should not prompt", async () => { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still work. The validation is at prompt layer.