From df85aa64cd167da851f336d3e0ea50202db133ac Mon Sep 17 00:00:00 2001 From: Nell Hardcastle Date: Mon, 18 Sep 2023 07:50:19 -0700 Subject: [PATCH] deps(server): Drop moment.js in favor of date-fns --- .pnp.cjs | 10 ------- .../snapshot-container.spec.tsx.snap | 4 +-- packages/openneuro-server/package.json | 1 - .../openneuro-server/src/handlers/comments.js | 4 +-- .../src/libs/notifications.js | 4 +-- yarn.lock | 30 +++++++------------ 6 files changed, 17 insertions(+), 36 deletions(-) diff --git a/.pnp.cjs b/.pnp.cjs index 1428703f84..54c65f5309 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -6442,7 +6442,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["jsonwebtoken", "npm:9.0.0"],\ ["keyv", "npm:4.5.3"],\ ["mime-types", "npm:2.1.32"],\ - ["moment", "npm:2.29.1"],\ ["mongoose", "npm:6.11.4"],\ ["morgan", "npm:1.10.0"],\ ["node-mailjet", "npm:3.3.5"],\ @@ -20536,15 +20535,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ - ["moment", [\ - ["npm:2.29.1", {\ - "packageLocation": "./.yarn/cache/moment-npm-2.29.1-787d9fdafd-1e14d5f422.zip/node_modules/moment/",\ - "packageDependencies": [\ - ["moment", "npm:2.29.1"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["mongodb", [\ ["npm:4.16.0", {\ "packageLocation": "./.yarn/cache/mongodb-npm-4.16.0-f6d128b4ab-f0b1347739.zip/node_modules/mongodb/",\ diff --git a/packages/openneuro-app/src/scripts/dataset/__tests__/__snapshots__/snapshot-container.spec.tsx.snap b/packages/openneuro-app/src/scripts/dataset/__tests__/__snapshots__/snapshot-container.spec.tsx.snap index 91f9152608..e872da249e 100644 --- a/packages/openneuro-app/src/scripts/dataset/__tests__/__snapshots__/snapshot-container.spec.tsx.snap +++ b/packages/openneuro-app/src/scripts/dataset/__tests__/__snapshots__/snapshot-container.spec.tsx.snap @@ -1454,7 +1454,7 @@ OCI-1131441 (R. Poldrack, PI) in any publications. > Uploaded by - Test User on 2021-12-17 - over 1 year ago + Test User on 2021-12-17 - almost 2 years ago
Last Updated - 2021-12-17 - over 1 year ago + 2021-12-17 - almost 2 years ago
{ if (err) { diff --git a/packages/openneuro-server/src/libs/notifications.js b/packages/openneuro-server/src/libs/notifications.js index b67adcd1f6..bb56e929c8 100644 --- a/packages/openneuro-server/src/libs/notifications.js +++ b/packages/openneuro-server/src/libs/notifications.js @@ -4,7 +4,7 @@ import { send as emailSend } from './email' import request from 'superagent' import User from '../models/user' import Subscription from '../models/subscription' -import moment from 'moment' +import { format } from 'date-fns' import url from 'url' import bidsId from './bidsId' import { convertFromRaw, EditorState } from 'draft-js' @@ -150,7 +150,7 @@ const notifications = { datasetLabel: datasetLabel, commentUserId: userId, commentId: commentId, - dateCreated: moment(comment.createDate).format('MMMM Do'), + dateCreated: format(comment.createDate, 'MMMM Do'), commentContent: htmlContent, commentStatus: commentStatus, siteUrl: diff --git a/yarn.lock b/yarn.lock index 557c2ba82c..118a0b28b3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4874,8 +4874,8 @@ __metadata: "@emotion/react": 11.11.1 "@emotion/styled": 11.11.0 "@niivue/niivue": 0.34.0 - "@openneuro/client": ^4.20.0-alpha.3 - "@openneuro/components": ^4.20.0-alpha.3 + "@openneuro/client": ^4.20.0-alpha.4 + "@openneuro/components": ^4.20.0-alpha.4 "@tanstack/react-table": ^8.9.3 "@testing-library/jest-dom": 6.1.3 "@testing-library/react": ^11.1.0 @@ -4926,7 +4926,7 @@ __metadata: resolution: "@openneuro/cli@workspace:packages/openneuro-cli" dependencies: "@apollo/client": 3.7.2 - "@openneuro/client": ^4.20.0-alpha.3 + "@openneuro/client": ^4.20.0-alpha.4 "@types/mkdirp": 1.0.2 "@types/node": 18.11.9 bids-validator: 1.13.0 @@ -4951,14 +4951,14 @@ __metadata: languageName: unknown linkType: soft -"@openneuro/client@^4.20.0-alpha.3, @openneuro/client@workspace:packages/openneuro-client": +"@openneuro/client@^4.20.0-alpha.4, @openneuro/client@workspace:packages/openneuro-client": version: 0.0.0-use.local resolution: "@openneuro/client@workspace:packages/openneuro-client" dependencies: "@apollo/client": 3.7.2 "@graphql-tools/mock": ^9.0.0 "@graphql-tools/schema": ^10.0.0 - "@openneuro/server": ^4.20.0-alpha.3 + "@openneuro/server": ^4.20.0-alpha.4 core-js: ^3.10.1 crypto-hash: ^1.3.0 graphql: 16.6.0 @@ -4970,7 +4970,7 @@ __metadata: languageName: unknown linkType: soft -"@openneuro/components@^4.20.0-alpha.3, @openneuro/components@workspace:packages/openneuro-components": +"@openneuro/components@^4.20.0-alpha.4, @openneuro/components@workspace:packages/openneuro-components": version: 0.0.0-use.local resolution: "@openneuro/components@workspace:packages/openneuro-components" dependencies: @@ -5012,8 +5012,8 @@ __metadata: dependencies: "@apollo/client": 3.7.2 "@elastic/elasticsearch": 7.15.0 - "@openneuro/client": ^4.20.0-alpha.3 - "@openneuro/search": ^4.20.0-alpha.3 + "@openneuro/client": ^4.20.0-alpha.4 + "@openneuro/search": ^4.20.0-alpha.4 "@types/jsonwebtoken": ^8 "@types/node": 18.11.9 "@types/tsc-watch": ^4 @@ -5027,7 +5027,7 @@ __metadata: languageName: unknown linkType: soft -"@openneuro/search@^4.20.0-alpha.3, @openneuro/search@workspace:packages/openneuro-search": +"@openneuro/search@^4.20.0-alpha.4, @openneuro/search@workspace:packages/openneuro-search": version: 0.0.0-use.local resolution: "@openneuro/search@workspace:packages/openneuro-search" dependencies: @@ -5042,7 +5042,7 @@ __metadata: languageName: unknown linkType: soft -"@openneuro/server@^4.20.0-alpha.3, @openneuro/server@workspace:packages/openneuro-server": +"@openneuro/server@^4.20.0-alpha.4, @openneuro/server@workspace:packages/openneuro-server": version: 0.0.0-use.local resolution: "@openneuro/server@workspace:packages/openneuro-server" dependencies: @@ -5052,7 +5052,7 @@ __metadata: "@elastic/elasticsearch": 7.15.0 "@graphql-tools/schema": ^10.0.0 "@keyv/redis": ^2.7.0 - "@openneuro/search": ^4.20.0-alpha.3 + "@openneuro/search": ^4.20.0-alpha.4 "@passport-next/passport-google-oauth2": ^1.0.0 "@sentry/node": ^4.5.3 "@types/cors": ^2 @@ -5086,7 +5086,6 @@ __metadata: jsonwebtoken: ^9.0.0 keyv: ^4.5.3 mime-types: ^2.1.19 - moment: ^2.14.1 mongoose: ^6.11.3 morgan: ^1.6.1 node-mailjet: ^3.3.5 @@ -17395,13 +17394,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"moment@npm:^2.14.1": - version: 2.29.1 - resolution: "moment@npm:2.29.1" - checksum: 1e14d5f422a2687996be11dd2d50c8de3bd577c4a4ca79ba5d02c397242a933e5b941655de6c8cb90ac18f01cc4127e55b4a12ae3c527a6c0a274e455979345e - languageName: node - linkType: hard - "mongodb-connection-string-url@npm:^2.5.4": version: 2.5.4 resolution: "mongodb-connection-string-url@npm:2.5.4"