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

Re-implement firebase init command's default project setup flow #1506

Merged
merged 8 commits into from Jul 23, 2019

Conversation

TrCaM
Copy link
Contributor

@TrCaM TrCaM commented Jul 15, 2019

Description

This pull request includes some twists on setting up the default Firebase project process when using the firebase init command:

  • What stays the same: if the default Firebase project is already set up in the current folder (previously via firebase use command or declared inside .firebaserc), the CLI will use that project and skip the project setup flow
  • What changes: if the default project is not set
    • Ask a selection question with 3 choices asking for user's desired behavior: Use an existing project, Create a new project and Don't set up default project
    • Use and existing project: (completed)
      • If the logged in account has at most 100 projects, list all projects and let user select project from the list
      • If the logged in account has more than 100 projects, prompt user for the project ID of the desired Firebase projects
    • Create a new project
      • Reuse the flow from projects:create command to create a new project
      • Set the new project as the default project for the current directory
    • Don't set up default project => do nothing

API methods changes

  • Declared FirebaseProjectPage interface
  • Implemented getProjectPage to list all projects in a page given pageSize and pageToken
  • Refactor listFirebaseProjects to use getProjectPage method

Notes:

@googlebot googlebot added the cla: yes Manual indication that this has passed CLA. label Jul 15, 2019
@TrCaM TrCaM requested a review from nbegley July 15, 2019 19:55
@coveralls
Copy link

coveralls commented Jul 15, 2019

Coverage Status

Coverage decreased (-0.2%) to 63.031% when pulling ef8252e on tc-choose-project into 9ba7603 on tc-management.

src/init/features/project.ts Outdated Show resolved Hide resolved
src/init/features/project.ts Outdated Show resolved Hide resolved
src/init/features/project.ts Outdated Show resolved Hide resolved
src/init/features/project.ts Outdated Show resolved Hide resolved
src/init/features/project.ts Outdated Show resolved Hide resolved
@TrCaM TrCaM requested a review from rosecm July 16, 2019 14:34
@TrCaM TrCaM changed the base branch from tc-cleanup to tc-management July 18, 2019 14:39
Copy link
Contributor

@bkendall bkendall left a comment

Choose a reason for hiding this comment

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

There's one big change in here that I'm seeing that I'm not sure we want to do.

For my notes, the UI now does the following when I'm logged into an account with lots of projects:

=== Project Setup

First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.

? Please select an option: Use an existing project
? Please input the project ID you would like to use:

And then it waits for me to enter an ID (rather than picking one from a list).

I don't actually think we want to change the behavior this way (unless there's a review or something I've missed discussing this already).

src/init/features/project.ts Show resolved Hide resolved
* Add create a new project option for init command
src/management/projects.ts Outdated Show resolved Hide resolved
src/management/projects.ts Outdated Show resolved Hide resolved
@nbegley nbegley assigned TrCaM and unassigned nbegley Jul 22, 2019
@TrCaM TrCaM merged commit d355098 into tc-management Jul 23, 2019
@TrCaM TrCaM deleted the tc-choose-project branch July 23, 2019 15:21
TrCaM added a commit that referenced this pull request Jul 29, 2019
)

* Implement getFirebaseProject and deprecate firebaseApi

* Implement getProjectPage() and refactor listFirebaseProject()

* Implement use an existing project option

* Update behavior when there's no project

* Implement "Create a new project" option (#1510)
TrCaM added a commit that referenced this pull request Aug 1, 2019
)

* Implement getFirebaseProject and deprecate firebaseApi

* Implement getProjectPage() and refactor listFirebaseProject()

* Implement use an existing project option

* Update behavior when there's no project

* Implement "Create a new project" option (#1510)
joehan added a commit that referenced this pull request Nov 13, 2019
* fix build container to have later npm (#1570)

* Release Firestore emulator v1.7.0 (#1571)

* Use ADC for Emulator Tests (#1575)

* Adds privacy policy link to login notice. (#1576)

* Use displayName when available (#1555)

* shows displayName if available

* formats

* uses displayName if available

* formats

* Declare project and app metadata types (#1470) and update dependencies

* Implement projects:create command (#1429)

* Implement api calls to support project creation

* Initial working command

* Replace nock with sinon to mock api requests

* export createFirebaseProject() and update tests

* Implement projects:create command

* Remove poll helper methods

* Rename firebase-resource-manager.ts to projectsCreate.ts

* Declare project and app metadata types

* Update timeout constant

* Update unit tests as suggestion

* Split metadata.ts into apps.ts and projects.ts

* move code to projects.ts

* Addressing comment

* Implement apps:create command (#1438)

* Implement API calls for apps:create command

* Implement apps:create command

* Remove --sha-certificate option

* Support providing appStoreId for iOS app creation

* Update the command to use getProjectId()

* Update unit tests as suggestion

* move code to apps.ts

* Add input options interfaces and getAppPlatform

* Implement projects:list command (#1465)

* Implement projects:list command

* Matching changes from metadata

* Move code to projects.ts

* Resolving TODO

* Implement apps:list command (#1477)

* Implement apps:list command

* Introducing AppPlatform.ANY and code refactoring

* Move code to apps.ts

* Implement getFirebaseProject and deprecate firebaseApi (#1502)

* Re-implement `firebase init` command's default project setup flow (#1506)

* Implement getFirebaseProject and deprecate firebaseApi

* Implement getProjectPage() and refactor listFirebaseProject()

* Implement use an existing project option

* Update behavior when there's no project

* Implement "Create a new project" option (#1510)

* [projects:list] and [apps:list] Logging count (#1526)

* Logging total project count after listing.

* Logging total app count

* Implement apps:sdkconfig command (#1515)

* Implement API methods for apps:sdkconfig

* Implement apps:sdkconfig command

* Add getOrPromptProject function to projects.ts (#1552)

* Make getAppPlatform throw if the input platform is unknown

* Update changelog for project and app management

* Move changelog into CHANGELOG.MD

* No more requireAuth() for functions (#1577)

* Add the ability to add Firebase resources to an existing GCP project (#1572)

* Implement projects:addfirebase command

* Update init command to have add Firebase option

* implements style fixes suggested in other pr

* typescriptifys ensureApiEnabled (#1554)

* typescriptifys ensureApiEnabled

This reverts commit e7ec80f.

* style fixes for switch to ts

* Release Firestore emulator v1.7.1 (#1584)
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

7 participants