1
1
import * as clc from "colorette" ;
2
2
import { existsSync } from "fs" ;
3
- < < < << << HEAD
4
- import * as fuzzy from "fuzzy ";
5
- import * as inquirer from "inquirer" ;
6
- = === ===
7
- >>> >>> > 702 c1c090 ( Enhance `firebase init apphosting` to support local source deploys ( #8479 ) )
8
3
import * as ora from "ora" ;
9
4
import * as path from "path" ;
10
5
import { webApps } from "../../apphosting/app" ;
11
6
import {
12
7
createBackend ,
13
- < << << << HEAD
14
8
ensureAppHostingComputeServiceAccount ,
15
- = === ===
16
9
promptExistingBackend ,
17
- > >>> >>> 702 c1c090 ( Enhance `firebase init apphosting ` to support local source deploys ( #8479 ) )
18
10
promptLocation ,
19
11
promptNewBackendId ,
20
12
} from "../../apphosting/backend" ;
21
13
import { Config } from "../../config" ;
22
14
import { FirebaseError } from "../../error" ;
23
15
import { AppHostingSingle } from "../../firebaseConfig" ;
24
- < < < << << HEAD
25
- import { listBackends , parseBackendName } from "../../gcp/apphosting" ;
26
- import { checkBillingEnabled } from "../../gcp/cloudbilling" ;
27
- import { promptOnce } from "../../prompt" ;
28
- import { readTemplateSync } from "../../templates" ;
29
- import * as utils from "../../utils" ;
30
- import { logBullet } from "../../utils" ;
31
- === === =
32
16
import { checkBillingEnabled } from "../../gcp/cloudbilling" ;
17
+ import { input , select } from "../../prompt" ;
33
18
import { readTemplateSync } from "../../templates" ;
34
19
import * as utils from "../../utils" ;
35
20
import { logBullet } from "../../utils" ;
36
- import { input , select } from "../../prompt" ;
37
- >>> >>> > 702 c1c090 ( Enhance `firebase init apphosting` to support local source deploys ( #8479 ) )
38
21
39
22
const APPHOSTING_YAML_TEMPLATE = readTemplateSync ( "init/apphosting/apphosting.yaml" ) ;
40
23
@@ -44,7 +27,6 @@ const APPHOSTING_YAML_TEMPLATE = readTemplateSync("init/apphosting/apphosting.ya
44
27
export async function doSetup ( setup : any , config : Config ) : Promise < void > {
45
28
const projectId = setup . projectId as string ;
46
29
await checkBillingEnabled ( projectId ) ;
47
- < < < << << HEAD
48
30
// N.B. To deploy from source, the App Hosting Compute Service Account must have
49
31
// the storage.objectViewer IAM role. For firebase-tools <= 14.3.0, the CLI does
50
32
// not add the objectViewer role, which means all existing customers will need to
@@ -59,9 +41,6 @@ export async function doSetup(setup: any, config: Config): Promise<void> {
59
41
/* serviceAccount= */ null ,
60
42
/* deployFromSource= */ true ,
61
43
) ;
62
-
63
- === === =
64
- >>> >>> > 702 c1c090 ( Enhance `firebase init apphosting` to support local source deploys ( #8479 ) )
65
44
utils . logBullet (
66
45
"This command links your local project to Firebase App Hosting. You will be able to deploy your web app with `firebase deploy` after setup." ,
67
46
) ;
@@ -70,13 +49,7 @@ export async function doSetup(setup: any, config: Config): Promise<void> {
70
49
rootDir : "" ,
71
50
ignore : [ "node_modules" , ".git" , "firebase-debug.log" , "firebase-debug.*.log" , "functions" ] ,
72
51
} ;
73
- << < < < << HEAD
74
- const createOrLink : string = await promptOnce ( {
75
- name : "createOrLink" ,
76
- type : "list" ,
77
- = === ===
78
52
const createOrLink : string = await select ( {
79
- > >>> >>> 702 c1c090 ( Enhance `firebase init apphosting` to support local source deploys ( #8479 ) )
80
53
default : "Create a new backend" ,
81
54
message : "Please select an option" ,
82
55
choices : [
@@ -85,31 +58,18 @@ export async function doSetup(setup: any, config: Config): Promise<void> {
85
58
] ,
86
59
} ) ;
87
60
if ( createOrLink === "link" ) {
88
- << < < < << HEAD
89
- backendConfig . backendId = await promptExistingBackend ( projectId ) ;
90
- } else if ( createOrLink === "create" ) {
91
- === = ===
92
61
backendConfig . backendId = await promptExistingBackend (
93
62
projectId ,
94
63
"Which backend would you like to link?" ,
95
64
) ;
96
65
} else {
97
- >>> > >>> 702 c1c090 ( Enhance `firebase init apphosting` to support local source deploys ( #8479 ) )
98
66
logBullet ( `${ clc . yellow ( "===" ) } Set up your backend` ) ;
99
67
const location = await promptLocation (
100
68
projectId ,
101
69
"Select a primary region to host your backend:\n" ,
102
70
) ;
103
- << < < < << HEAD
104
- const backendId = await promptNewBackendId ( projectId , location , {
105
- name : "backendId" ,
106
- type : "input" ,
107
- default : "my-web-app" ,
108
- message : "Provide a name for your backend [1-30 characters]" ,
109
- } ) ;
110
- === = ===
71
+
111
72
const backendId = await promptNewBackendId ( projectId , location ) ;
112
- >>> > >>> 702 c1c090 ( Enhance `firebase init apphosting` to support local source deploys ( #8479 ) )
113
73
utils . logSuccess ( `Name set to ${ backendId } \n` ) ;
114
74
backendConfig . backendId = backendId ;
115
75
@@ -132,23 +92,10 @@ export async function doSetup(setup: any, config: Config): Promise<void> {
132
92
webApp ?. id ,
133
93
) ;
134
94
createBackendSpinner . succeed ( `Successfully created backend!\n\t${ backend . name } \n` ) ;
135
- << < < < << HEAD
136
- } else {
137
- throw new FirebaseError (
138
- `Invalid value for createOrLink "${ createOrLink } ". Please contact Firebase Support with the contents of your firebase-debug.log.` ,
139
- ) ;
140
- }
141
-
142
- logBullet ( `${ clc
3AE4
span>. yellow ( "===" ) } Deploy local source setup`) ;
143
- backendConfig . rootDir = await promptOnce ( {
144
- name : "rootDir" ,
145
- type : "input" ,
146
- = === ===
147
95
}
148
96
149
97
logBullet ( `${ clc . yellow ( "===" ) } Deploy local source setup` ) ;
150
98
backendConfig . rootDir = await input ( {
151
- > >>> >>> 702 c1c090 ( Enhance `firebase init apphosting` to support local source deploys ( #8479 ) )
152
99
default : "/" ,
153
100
message : "Specify your app's root directory relative to your firebase.json directory" ,
154
101
} ) ;
@@ -172,35 +119,6 @@ export async function doSetup(setup: any, config: Config): Promise<void> {
172
119
utils . logSuccess ( "Firebase initialization complete!" ) ;
173
120
}
174
121
175
- << < < < << HEAD
176
- async function promptExistingBackend ( projectId : string ) : Promise < string > {
177
- const { backends } = await listBackends ( projectId , "-" ) ;
178
- const backendId = await promptOnce ( {
179
- type : "autocomplete" ,
180
- name : "backendId" ,
181
- message : "Which backend would you like to link?" ,
182
- source : ( _ : any , input = "" ) : Promise < ( inquirer . DistinctChoice | inquirer . Separator ) [ ] > => {
183
- return new Promise ( ( resolve ) =>
184
- resolve ( [
185
- ...fuzzy
186
- . filter ( input , backends , {
187
- extract : ( backend ) => parseBackendName ( backend . name ) . id ,
188
- } )
189
- . map ( ( result ) => {
190
- return {
191
- name : parseBackendName ( result . original . name ) . id ,
192
- value : parseBackendName ( result . original . name ) . id ,
193
- } ;
194
- } ) ,
195
- ] ) ,
196
- ) ;
197
- } ,
198
- } ) ;
199
- return backendId ;
200
- }
201
-
202
- === = ===
203
- >>> > >>> 702 c1c090 ( Enhance `firebase init apphosting` to support local source deploys ( #8479 ) )
204
122
/** Exported for unit testing. */
205
123
export function upsertAppHostingConfig ( backendConfig : AppHostingSingle , config : Config ) : void {
206
124
if ( ! config . src . apphosting ) {
0 commit comments