1
1
import * as clc from "colorette" ;
2
- import * as utils from "../../../utils" ;
3
2
import * as repo from "./repo" ;
4
3
import * as poller from "../../../operation-poller" ;
5
4
import * as gcp from "../../../gcp/frameworks" ;
5
+ import { logBullet , logSuccess } from "../../../utils" ;
6
6
import { frameworksOrigin } from "../../../api" ;
7
7
import { Backend , BackendOutputOnlyFields } from "../../../gcp/frameworks" ;
8
8
import { Repository } from "../../../gcp/cloudbuild" ;
9
9
import { API_VERSION } from "../../../gcp/frameworks" ;
10
10
import { FirebaseError } from "../../../error" ;
11
- import { logger } from "../../../logger" ;
12
11
import { promptOnce } from "../../../prompt" ;
13
12
import { DEFAULT_REGION , ALLOWED_REGIONS } from "./constants" ;
14
13
@@ -25,7 +24,7 @@ const frameworksPollerOptions: Omit<poller.OperationPollerOptions, "operationRes
25
24
export async function doSetup ( setup : any , projectId : string ) : Promise < void > {
26
25
setup . frameworks = { } ;
27
26
28
- utils . logBullet ( "First we need a few details to create your backend." ) ;
27
+ logBullet ( "First we need a few details to create your backend." ) ;
29
28
30
29
await promptOnce (
31
30
{
@@ -50,20 +49,16 @@ export async function doSetup(setup: any, projectId: string): Promise<void> {
50
49
setup . frameworks
51
50
) ;
52
51
53
- utils . logSuccess ( `Region set to ${ setup . frameworks . region } .` ) ;
52
+ logSuccess ( `Region set to ${ setup . frameworks . region } .\n ` ) ;
54
53
55
54
const backend : Backend | undefined = await getOrCreateBackend ( projectId , setup ) ;
56
55
57
56
if ( backend ) {
58
- logger . info ( ) ;
59
- utils . logSuccess ( `Successfully created backend:\n ${ backend . name } ` ) ;
60
- logger . info ( ) ;
61
- utils . logSuccess ( `Your site is being deployed at:\n https://${ backend . uri } ` ) ;
62
- logger . info ( ) ;
63
- utils . logSuccess (
64
- `View the rollout status by running:\n firebase backends:get --backend=${ backend . name } `
57
+ logSuccess ( `Successfully created backend:\n ${ backend . name } ` ) ;
58
+ logSuccess ( `Your site is being deployed at:\n https://${ backend . uri } \n` ) ;
59
+ logSuccess (
60
+ `View the rollout status by running:\n firebase backends:get --backend=${ backend . name } \n`
65
61
) ;
66
- logger . info ( ) ;
67
62
}
68
63
}
69
64
@@ -91,7 +86,6 @@ export async function getOrCreateBackend(
91
86
} catch ( err : unknown ) {
92
87
if ( ( err as FirebaseError ) . status === 404 ) {
93
88
const cloudBuildConnRepo = await repo . linkGitHubRepository ( projectId , location ) ;
94
- logger . info ( ) ;
95
89
await promptOnce (
96
90
{
97
91
name : "branchName" ,
@@ -102,7 +96,7 @@ export async function getOrCreateBackend(
102
96
setup . frameworks
103
97
) ;
104
98
const backendDetails = toBackend ( cloudBuildConnRepo ) ;
105
- logger . info ( clc . bold ( `\n ${ clc . white ( "===" ) } Creating your backend` ) ) ;
99
+ logBullet ( clc . bold ( `${ clc . white ( "===" ) } Creating your backend` ) ) ;
106
100
return await createBackend ( projectId , location , backendDetails , setup . frameworks . serviceName ) ;
107
101
} else {
108
102
throw new FirebaseError (
@@ -133,7 +127,7 @@ async function getExistingBackend(
133
127
setup . frameworks
134
128
) ;
135
129
if ( setup . frameworks . existingBackend ) {
136
- logger . info ( "Using the existing backend." ) ;
130
+ logBullet ( "Using the existing backend." ) ;
137
131
return backend ;
138
132
}
139
133
await promptOnce (
0 commit comments