diff --git a/src/init/features/frameworks/index.ts b/src/init/features/frameworks/index.ts index 0f778f16091..1ec784c7edd 100644 --- a/src/init/features/frameworks/index.ts +++ b/src/init/features/frameworks/index.ts @@ -1,14 +1,13 @@ import * as clc from "colorette"; -import * as utils from "../../../utils"; import * as repo from "./repo"; import * as poller from "../../../operation-poller"; import * as gcp from "../../../gcp/frameworks"; +import { logBullet, logSuccess } from "../../../utils"; import { frameworksOrigin } from "../../../api"; import { Backend, BackendOutputOnlyFields } from "../../../gcp/frameworks"; import { Repository } from "../../../gcp/cloudbuild"; import { API_VERSION } from "../../../gcp/frameworks"; import { FirebaseError } from "../../../error"; -import { logger } from "../../../logger"; import { promptOnce } from "../../../prompt"; import { DEFAULT_REGION, ALLOWED_REGIONS } from "./constants"; @@ -25,7 +24,7 @@ const frameworksPollerOptions: Omit { setup.frameworks = {}; - utils.logBullet("First we need a few details to create your backend."); + logBullet("First we need a few details to create your backend."); await promptOnce( { @@ -50,20 +49,16 @@ export async function doSetup(setup: any, projectId: string): Promise { setup.frameworks ); - utils.logSuccess(`Region set to ${setup.frameworks.region}.`); + logSuccess(`Region set to ${setup.frameworks.region}.\n`); const backend: Backend | undefined = await getOrCreateBackend(projectId, setup); if (backend) { - logger.info(); - utils.logSuccess(`Successfully created backend:\n ${backend.name}`); - logger.info(); - utils.logSuccess(`Your site is being deployed at:\n https://${backend.uri}`); - logger.info(); - utils.logSuccess( - `View the rollout status by running:\n firebase backends:get --backend=${backend.name}` + logSuccess(`Successfully created backend:\n ${backend.name}`); + logSuccess(`Your site is being deployed at:\n https://${backend.uri}\n`); + logSuccess( + `View the rollout status by running:\n firebase backends:get --backend=${backend.name}\n` ); - logger.info(); } } @@ -90,7 +85,6 @@ export async function getOrCreateBackend( } catch (err: unknown) { if ((err as FirebaseError).status === 404) { const cloudBuildConnRepo = await repo.linkGitHubRepository(projectId, location); - logger.info(); await promptOnce( { name: "branchName", @@ -101,7 +95,7 @@ export async function getOrCreateBackend( setup.frameworks ); const backendDetails = toBackend(cloudBuildConnRepo); - logger.info(clc.bold(`\n${clc.white("===")} Creating your backend`)); + logBullet(clc.bold(`${clc.white("===")} Creating your backend`)); return await createBackend(projectId, location, backendDetails, setup.frameworks.serviceName); } else { throw new FirebaseError( @@ -132,7 +126,7 @@ async function getExistingBackend( setup.frameworks ); if (setup.frameworks.existingBackend) { - logger.info("Using the existing backend."); + logBullet("Using the existing backend."); return backend; } await promptOnce( diff --git a/src/init/features/frameworks/repo.ts b/src/init/features/frameworks/repo.ts index 24927c0f08b..3f1265828a9 100644 --- a/src/init/features/frameworks/repo.ts +++ b/src/init/features/frameworks/repo.ts @@ -80,7 +80,7 @@ export async function linkGitHubRepository( projectId: string, location: string ): Promise { - logger.info(clc.bold(`\n${clc.yellow("===")} Connect a GitHub repository`)); + utils.logBullet(clc.bold(`${clc.yellow("===")} Connect a GitHub repository`)); const existingConns = await listFrameworksConnections(projectId); if (existingConns.length < 1) { const grantSuccess = await promptSecretManagerAdminGrant(projectId); @@ -165,7 +165,7 @@ async function promptRepositoryUri( async function promptSecretManagerAdminGrant(projectId: string): Promise { const projectNumber = await getProjectNumber({ projectId }); const cbsaEmail = gcb.serviceAgentEmail(projectNumber); - logger.info( + utils.logBullet( "To create a new GitHub connection, Secret Manager Admin role (roles/secretmanager.admin) is required on the Cloud Build Service Agent." ); const grant = await promptOnce({ @@ -173,7 +173,7 @@ async function promptSecretManagerAdminGrant(projectId: string): Promise