Skip to content

Commit eafa16e

Browse files
committed
Updating the schematic for the list depreciation
1 parent 4a74efe commit eafa16e

File tree

4 files changed

+17
-21
lines changed

4 files changed

+17
-21
lines changed

src/schematics/deploy/actions.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,8 @@ export default async function deploy(
1212
throw new Error("Cannot find firebase project for your app in .firebaserc");
1313
}
1414

15-
try {
16-
await firebaseTools.list();
17-
} catch (e) {
18-
context.logger.warn(
19-
"🚨 You're not logged into Firebase. Logging you in..."
20-
);
21-
await firebaseTools.login();
22-
}
15+
await firebaseTools.login();
16+
2317
if (!context.target) {
2418
throw new Error("Cannot execute the build target");
2519
}

src/schematics/deploy/builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default createBuilder<any>(
3737
context.target.project
3838
);
3939

40-
const buildTarget = options.buildTarget || `build:${context.target.project}:production`;
40+
const buildTarget = options.buildTarget || `${context.target.project}:build:production`;
4141

4242
try {
4343
await deploy(

src/schematics/interfaces.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
export interface Project {
2+
projectId: string;
3+
projectNumber: string;
4+
displayName: string;
25
name: string;
3-
id: string;
4-
permission: "edit" | "view" | "own";
6+
resources: { [key:string]: string }
57
}
68

79
export interface FirebaseDeployConfig {
@@ -12,7 +14,9 @@ export interface FirebaseDeployConfig {
1214
export interface FirebaseTools {
1315
login(): Promise<void>;
1416

15-
list(): Promise<Project[]>;
17+
projects: {
18+
list(): Promise<Project[]>;
19+
}
1620

1721
deploy(config: FirebaseDeployConfig): Promise<any>;
1822

src/schematics/utils.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ import { readFileSync } from "fs";
22
import { FirebaseRc, Project } from "./interfaces";
33
import { join } from "path";
44

5-
export function listProjects() {
5+
export async function listProjects() {
66
const firebase = require('firebase-tools');
7-
return firebase.list().catch(
8-
/* If list failed, then login and try again. */
9-
() => firebase.login().then(() => firebase.list())
10-
);
7+
await firebase.login();
8+
return firebase.projects.list();
119
}
1210

1311
// `fuzzy` passes either the original list of projects or an internal object
@@ -22,7 +20,7 @@ const searchProjects = (projects: Project[]) => {
2220
require('fuzzy')
2321
.filter(input, projects, {
2422
extract(el: Project) {
25-
return `${el.id} ${el.name} ${el.permission}`;
23+
return `${el.projectId} ${el.displayName}`;
2624
}
2725
})
2826
.map((result: Project | { original: Project }) => {
@@ -33,9 +31,9 @@ const searchProjects = (projects: Project[]) => {
3331
original = result.original;
3432
}
3533
return {
36-
name: `${original.id} (${original.name})`,
37-
title: original.name,
38-
value: original.id
34+
name: `${original.displayName} (${original.projectId})`,
35+
title: original.displayName,
36+
value: original.projectId
3937
};
4038
})
4139
);

0 commit comments

Comments
 (0)