Skip to content

Commit

Permalink
fixes --project flag on init command (#3902)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkendall committed Nov 29, 2021
1 parent 0d6d632 commit d05e855
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -0,0 +1 @@
- Fixes issue where providing the `--project` flag during `init` would not be recognized with a default project already set. (#3870)
3 changes: 2 additions & 1 deletion src/init/features/project.ts
Expand Up @@ -115,7 +115,7 @@ export async function doSetup(setup: any, config: any, options: any): Promise<vo
logger.info();

const projectFromRcFile = _.get(setup.rcfile, "projects.default");
if (projectFromRcFile) {
if (projectFromRcFile && !options.project) {
utils.logBullet(`.firebaserc already has a default project, using ${projectFromRcFile}.`);
// we still need to get project info in case user wants to init firestore or storage, which
// require a resource location:
Expand All @@ -128,6 +128,7 @@ export async function doSetup(setup: any, config: any, options: any): Promise<vo
let projectMetaData;
// If the user presented a project with `--project`, try to fetch that project.
if (options.project) {
logger.debug(`Using project from CLI flag: ${options.project}`);
projectMetaData = await getFirebaseProject(options.project);
} else {
projectMetaData = await projectChoicePrompt(options);
Expand Down

0 comments on commit d05e855

Please sign in to comment.