Skip to content

Commit 70fad80

Browse files
authored
Merge pull request #59 from remap-keys/replace-moment-with-date-fns
Replace `moment` library with `date-fns` library.
2 parents 863a4d1 + 58a4937 commit 70fad80

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

functions/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
"@google-cloud/pubsub": "^4.0.6",
2020
"@google-cloud/tasks": "^4.0.1",
2121
"axios": "^0.21.1",
22+
"date-fns": "^4.1.0",
2223
"firebase-admin": "^11.11.0",
2324
"firebase-functions": "^4.4.1",
2425
"jsonwebtoken": "^9.0.2",
25-
"moment": "^2.29.1",
2626
"node-html-parser": "^6.1.13",
2727
"qs": "^6.11.2",
2828
"sitemap": "^7.0.0"
@@ -31,7 +31,6 @@
3131
"@types/express-serve-static-core": "^4.17.21",
3232
"@types/jest": "^29.5.11",
3333
"@types/jsonwebtoken": "^9.0.4",
34-
"@types/moment": "^2.13.0",
3534
"@types/node": "^20.10.5",
3635
"@types/qs": "^6.9.9",
3736
"@typescript-eslint/eslint-plugin": "^6.15.0",

functions/src/host/generate-sitemap-xml-command.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import * as admin from 'firebase-admin';
22
import * as functions from 'firebase-functions';
33
import { SitemapStream, streamToPromise } from 'sitemap';
44
import { Readable } from 'stream';
5-
import * as moment from 'moment';
65
import { createGzip } from 'zlib';
6+
import { formatISO } from 'date-fns';
77

88
type IUrlEntry = {
99
url: string;
@@ -50,7 +50,7 @@ export default class GenerateSitemapXmlCommand {
5050
for (const keyboard of keyboardsSnapshot.docs) {
5151
urlEntries.push({
5252
url: `/catalog/${keyboard.id}`,
53-
lastmod: moment(keyboard.data().updated_at.toDate()).toISOString(),
53+
lastmod: formatISO(keyboard.data().updated_at.toDate()),
5454
});
5555
}
5656

functions/yarn.lock

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,13 +1124,6 @@
11241124
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca"
11251125
integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==
11261126

1127-
"@types/moment@^2.13.0":
1128-
version "2.13.0"
1129-
resolved "https://registry.yarnpkg.com/@types/moment/-/moment-2.13.0.tgz#604ebd189bc3bc34a1548689404e61a2a4aac896"
1130-
integrity sha512-DyuyYGpV6r+4Z1bUznLi/Y7HpGn4iQ4IVcGn8zrr1P4KotKLdH0sbK1TFR6RGyX6B+G8u83wCzL+bpawKU/hdQ==
1131-
dependencies:
1132-
moment "*"
1133-
11341127
"@types/node@*", "@types/node@>=12.12.47", "@types/node@>=13.7.0", "@types/node@^20.10.5":
11351128
version "20.10.5"
11361129
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.10.5.tgz#47ad460b514096b7ed63a1dae26fad0914ed3ab2"
@@ -1952,6 +1945,11 @@ css-what@^6.1.0:
19521945
resolved "https://registry.yarnpkg.com/css-what/-/css-what-6.1.0.tgz#fb5effcf76f1ddea2c81bdfaa4de44e79bac70f4"
19531946
integrity sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==
19541947

1948+
date-fns@^4.1.0:
1949+
version "4.1.0"
1950+
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-4.1.0.tgz#64b3d83fff5aa80438f5b1a633c2e83b8a1c2d14"
1951+
integrity sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==
1952+
19551953
19561954
version "2.6.9"
19571955
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
@@ -4342,11 +4340,6 @@ mkdirp@^1.0.4:
43424340
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
43434341
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
43444342

4345-
moment@*, moment@^2.29.1:
4346-
version "2.29.4"
4347-
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108"
4348-
integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==
4349-
43504343
43514344
version "2.0.0"
43524345
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"

0 commit comments

Comments
 (0)