8000 fix merge conflicts & address apphosting/deploy.ts comments · firebase/firebase-tools@ce05795 · GitHub
[go: up one dir, main page]

Skip to content

Commit ce05795

Browse files
committed
fix merge conflicts & address apphosting/deploy.ts comments
1 parent 36135d3 commit ce05795

File tree

3 files changed

+4
-99
lines changed

3 files changed

+4
-99
lines changed

src/apphosting/backend.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -267,19 +267,7 @@ export async function ensureAppHostingComputeServiceAccount(
267267
/**
268268
* Prompts the user for a backend id and verifies that it doesn't match a pre-existing backend.
269269
*/
270-
<<<<<<< HEAD
271-
<<<<<<< HEAD
272-
export async function promptNewBackendId(
273-
projectId: string,
274-
location: string,
275-
prompt: any,
276-
): Promise<string> {
277-
=======
278-
async function promptNewBackendId(projectId: string, location: string): Promise<string> {
279-
>>>>>>> b8bbe0fdb (Update inquirer library (#8411))
280-
=======
281270
export async function promptNewBackendId(projectId: string, location: string): Promise<string> {
282-
>>>>>>> 702c1c090 (Enhance `firebase init apphosting` to support local source deploys (#8479))
283271
while (true) {
284272
const backendId = await input({
285273
default: "my-web-app",

src/deploy/apphosting/deploy.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ export default async function (context: Context, options: Options): Promise<void
2121
}
2222

2323
// Ensure that a bucket exists in each region that a backend is or will be deployed to
24-
const backendLocations = context.backendLocations.values() || [];
25-
for (const loc of backendLocations) {
24+
for (const loc of context.backendLocations.values()) {
2625
const bucketName = `firebaseapphosting-sources-${options.projectNumber}-${loc.toLowerCase()}`;
2726
try {
2827
await gcs.getBucket(bucketName);
@@ -37,7 +36,7 @@ export default async function (context: Context, options: Options): Promise<void
3736
try {
3837
await gcs.createBucket(projectId, {
3938
name: bucketName,
40-
location: "US-CENTRAL1",
39+
location: loc,
4140
lifecycle: {
4241
rule: [
4342
{

src/init/features/apphosting.ts

Lines changed: 2 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,23 @@
11
import * as clc from "colorette";
22
import { existsSync } from "fs";
3-
<<<<<<< HEAD
4-
import * as fuzzy from "fuzzy";
5-
import * as inquirer from "inquirer";
6-
=======
7-
>>>>>>> 702c1c090 (Enhance `firebase init apphosting` to support local source deploys (#8479))
83
import * as ora from "ora";
94
import * as path from "path";
105
import { webApps } from "../../apphosting/app";
116
import {
127
createBackend,
13-
<<<<<<< HEAD
148
ensureAppHostingComputeServiceAccount,
15-
=======
169
promptExistingBackend,
17-
>>>>>>> 702c1c090 (Enhance `firebase init apphosting` to support local source deploys (#8479))
1810
promptLocation,
1911
promptNewBackendId,
2012
} from "../../apphosting/backend";
2113
import { Config } from "../../config";
2214
import { FirebaseError } from "../../error";
2315
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-
=======
3216
import { checkBillingEnabled } from "../../gcp/cloudbilling";
17+
import { input, select } from "../../prompt";
3318
import { readTemplateSync } from "../../templates";
3419
import * as utils from "../../utils";
3520
import { logBullet } from "../../utils";
36-
import { input, select } from "../../prompt";
37-
>>>>>>> 702c1c090 (Enhance `firebase init apphosting` to support local source deploys (#8479))
3821

3922
const APPHOSTING_YAML_TEMPLATE = readTemplateSync("init/apphosting/apphosting.yaml");
4023

@@ -44,7 +27,6 @@ const APPHOSTING_YAML_TEMPLATE = readTemplateSync("init/apphosting/apphosting.ya
4427
export async function doSetup(setup: any, config: Config): Promise<void> {
4528
const projectId = setup.projectId as string;
4629
await checkBillingEnabled(projectId);
47-
<<<<<<< HEAD
4830
// N.B. To deploy from source, the App Hosting Compute Service Account must have
4931
// the storage.objectViewer IAM role. For firebase-tools <= 14.3.0, the CLI does
5032
// 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> {
5941
/* serviceAccount= */ null,
6042
/* deployFromSource= */ true,
6143
);
62-
63-
=======
64-
>>>>>>> 702c1c090 (Enhance `firebase init apphosting` to support local source deploys (#8479))
6544
utils.logBullet(
6645
"This command links your local project to Firebase App Hosting. You will be able to deploy your web app with `firebase deploy` after setup.",
6746
);
@@ -70,13 +49,7 @@ export async function doSetup(setup: any, config: Config): Promise<void> {
7049
rootDir: "",
7150
ignore: ["node_modules", ".git", "firebase-debug.log", "firebase-debug.*.log", "functions"],
7251
};
73-
<<<<<<< HEAD
74-
const createOrLink: string = await promptOnce({
75-
name: "createOrLink",
76-
type: "list",
77-
=======
7852
const createOrLink: string = await select({
79-
>>>>>>> 702c1c090 (Enhance `firebase init apphosting` to support local source deploys (#8479))
8053
default: "Create a new backend",
8154
message: "Please select an option",
8255
choices: [
@@ -85,31 +58,18 @@ export async function doSetup(setup: any, config: Config): Promise<void> {
8558
],
8659
});
8760
if (createOrLink === "link") {
88-
<<<<<<< HEAD
89-
backendConfig.backendId = await promptExistingBackend(projectId);
90-
} else if (createOrLink === "create") {
91-
=======
9261
backendConfig.backendId = await promptExistingBackend(
9362
projectId,
9463
"Which backend would you like to link?",
9564
);
9665
} else {
97-
>>>>>>> 702c1c090 (Enhance `firebase init apphosting` to support local source deploys (#8479))
9866
logBullet(`${clc.yellow("===")} Set up your backend`);
9967
const location = await promptLocation(
10068
projectId,
10169
"Select a primary region to host your backend:\n",
10270
);
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+
11172
const backendId = await promptNewBackendId(projectId, location);
112-
>>>>>>> 702c1c090 (Enhance `firebase init apphosting` to support local source deploys (#8479))
11373
utils.logSuccess(`Name set to ${backendId}\n`);
11474
backendConfig.backendId = backendId;
11575

@@ -132,23 +92,10 @@ export async function doSetup(setup: any, config: Config): Promise<void> {
13292
webApp?.id,
13393
);
13494
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.yellow("===")} Deploy local source setup`);
143-
backendConfig.rootDir = await promptOnce({
144-
name: "rootDir",
145-
type: "input",
146-
=======
14795
}
14896

14997
logBullet(`${clc.yellow("===")} Deploy local source setup`);
15098
backendConfig.rootDir = await input({
151-
>>>>>>> 702c1c090 (Enhance `firebase init apphosting` to support local source deploys (#8479))
15299
default: "/",
153100
message: "Specify your app's root directory relative to your firebase.json directory",
154101
});
@@ -172,35 +119,6 @@ export async function doSetup(setup: any, config: Config): Promise<void> {
172119
utils.logSuccess("Firebase initialization complete!");
173120
}
174121

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-
>>>>>>> 702c1c090 (Enhance `firebase init apphosting` to support local source deploys (#8479))
204122
/** Exported for unit testing. */
205123
export function upsertAppHostingConfig(backendConfig: AppHostingSingle, config: Config): void {
206124
if (!config.src.apphosting) {

0 commit comments

Comments
 (0)
0