Skip to content

Commit 5fade0b

Browse files
committed
Update firebase functions to use node 20 and handle case where there are no representatives or senators
1 parent c9a2396 commit 5fade0b

File tree

11 files changed

+517
-688
lines changed

11 files changed

+517
-688
lines changed

.github/actions/setup-repo/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ inputs:
44
node-version:
55
description: "Version used by actions/setup-node"
66
required: true
7-
default: "18"
7+
default: "20"
88
yarn-version:
99
description: "Version of Yarn used to install dependencies"
1010
required: true

components/ProfilePage/SelectLegislators.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const LegislatorForm: React.FC<
3636
<Form.Label>{t("legislator.representative")}</Form.Label>
3737
<Search
3838
placeholder={t("legislator.searchRepresentative")}
39-
index={index.representatives}
39+
index={index?.representatives}
4040
isLoading={profile.updatingRep}
4141
memberId={profile.profile?.representative?.id}
4242
update={profile.updateRep}
@@ -47,7 +47,7 @@ export const LegislatorForm: React.FC<
4747
<Form.Label>{t("legislator.senator")}</Form.Label>
4848
<Search
4949
placeholder={t("legislator.searchSenator")}
50-
index={index.senators}
50+
index={index?.senators}
5151
isLoading={profile.updatingSenator}
5252
memberId={profile.profile?.senator?.id}
5353
update={profile.updateSenator}

components/legislatorSearch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const useSearch = <T extends MemberSearchIndexItem, M extends boolean>(
7373
index: T[]
7474
) => {
7575
const byId = useMemo(
76-
() => Object.fromEntries(index.map(m => [m.MemberCode, m])),
76+
() => index ? Object.fromEntries(index?.map(m => [m.MemberCode, m])) : {},
7777
[index]
7878
)
7979

firebase.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22
"hosting": {
33
"public": "out",
44
"cleanUrls": true,
5-
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
5+
"ignore": [
6+
"firebase.json",
7+
"**/.*",
8+
"**/node_modules/**"
9+
]
610
},
711
"functions": {
8-
"predeploy": ["yarn build:functions"],
12+
"predeploy": [
13+
"yarn build:functions"
14+
],
915
"source": "functions",
10-
"runtime": "nodejs18",
16+
"runtime": "nodejs20",
1117
"runtimeConfig": ".runtimeconfig.json"
1218
},
1319
"firestore": {
@@ -44,4 +50,4 @@
4450
"extensions": {
4551
"firestore-send-email": "firebase/[email protected]"
4652
}
47-
}
53+
}

functions/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"axios": "^0.25.0",
2020
"date-fns": "^2.30.0",
2121
"firebase-admin": "^10",
22-
"firebase-functions": "^3.22.0",
22+
"firebase-functions": "^4.9.0",
2323
"fluent-ffmpeg": "^2.1.3",
2424
"fuse.js": "6.5.3",
2525
"handlebars": "^4.7.8",
@@ -42,11 +42,11 @@
4242
"@types/object-hash": "^2.2.1",
4343
"copyfiles": "^2.4.1",
4444
"firebase-functions-test": "^0.3.3",
45-
"firebase-tools": "^11.16.0",
45+
"firebase-tools": "^12.4.0",
4646
"jest": "^27.5.1",
4747
"rimraf": "^3.0.2",
4848
"ts-jest": "^27.1.3",
4949
"typescript": "4.5.5"
5050
},
5151
"private": true
52-
}
52+
}

0 commit comments

Comments
 (0)