Skip to content

Commit

Permalink
Upgrade to Node.js 20
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Henneke <dominik.henneke@nordeck.net>
  • Loading branch information
dhenneke committed Aug 24, 2023
1 parent 018af6e commit 423c58d
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 46 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '20'
cache: 'yarn'

- name: yarn install
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '20'
cache: 'yarn'

- name: yarn install
Expand Down Expand Up @@ -184,7 +184,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '20'
cache: 'yarn'

- name: yarn install
Expand Down Expand Up @@ -221,7 +221,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '20'
cache: 'yarn'

- name: yarn install
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Check the following steps to develop for the widget:

### Requirements

You need to install Node.js (`>= 16.0.0`, prefer using an LTS version) and run
You need to install Node.js (`>= 20.0.0`, prefer using an LTS version) and run
`yarn` to work on this package.
The minimal Element version to use this widget is `1.11.29`.

Expand Down
8 changes: 3 additions & 5 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,20 @@
"license": "Apache-2.0",
"version": "0.0.0",
"private": true,
"dependencies": {
"cross-fetch": "^3.1.5"
},
"dependencies": {},
"devDependencies": {
"@axe-core/playwright": "^4.7.3",
"@playwright/test": "^1.37.1",
"@types/lodash": "^4.14.197",
"@types/node": "^16.18.44",
"@types/node": "^20.4.6",
"eslint": "^8.47.0",
"eslint-plugin-playwright": "^0.15.3",
"lodash": "^4.17.21",
"testcontainers": "^10.2.1",
"typescript": "^5.1.6"
},
"engines": {
"node": ">=16",
"node": ">=20",
"yarn": ">=1.22.1 <2.0.0"
},
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion e2e/src/pages/elementWebPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

import { expect, FrameLocator, Locator, Page } from '@playwright/test';
import fetch from 'cross-fetch';
import { Credentials, getElementWebUrl, getSynapseUrl } from '../util';

export type OpenIdToken = {
Expand Down
1 change: 0 additions & 1 deletion e2e/src/util/deactivateUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

import fetch from 'cross-fetch';
import { getSynapseUrl } from './config';
import { User } from './registerUser';

Expand Down
1 change: 0 additions & 1 deletion e2e/src/util/registerUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

import fetch from 'cross-fetch';
import { createHmac } from 'crypto';
import { getSynapseRegistrationSecret, getSynapseUrl } from './config';

Expand Down
4 changes: 2 additions & 2 deletions matrix-meetings-bot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM node:16-bullseye AS node_modules
FROM node:20-bullseye AS node_modules
WORKDIR /build
COPY package.json yarn.lock ./
COPY matrix-meetings-bot/package.json ./matrix-meetings-bot/
COPY resolutions/matrix-sdk-crypto-nodejs ./resolutions/matrix-sdk-crypto-nodejs/
RUN yarn install --production --frozen-lockfile --network-timeout 1000000

FROM node:16-bullseye-slim
FROM node:20-bullseye-slim
ENV NODE_ENV=production
WORKDIR /app
RUN set -x\
Expand Down
6 changes: 2 additions & 4 deletions matrix-meetings-bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"generate-disclaimer": "cp ../LICENSE ./lib/LICENSE.txt && cp NOTICE ./lib/NOTICE.txt && yarn licenses generate-disclaimer --prod >> ./lib/NOTICE.txt && yarn licenses list --prod --json --no-progress > ./lib/licenses.json"
},
"engines": {
"node": ">=16",
"node": ">=20",
"yarn": ">=1.22.1 <2.0.0"
},
"dependencies": {
Expand All @@ -54,7 +54,6 @@
"moment-timezone": "^0.5.43",
"mustache": "^4.2.0",
"nestjs-pino": "^3.4.0",
"node-fetch": "^2.6.13",
"pino": "^8.15.0",
"pino-http": "^8.4.0",
"reflect-metadata": "^0.1.13",
Expand All @@ -70,8 +69,7 @@
"@types/luxon": "^3.2.0",
"@types/mime-types": "^2.1.1",
"@types/mustache": "^4.2.2",
"@types/node": "^16.18.44",
"@types/node-fetch": "^2.6.4",
"@types/node": "^20.4.6",
"@types/uuid": "^9.0.2",
"copyfiles": "^2.4.1",
"depcheck": "^1.4.5",
Expand Down
1 change: 0 additions & 1 deletion matrix-meetings-bot/src/client/JitsiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

import { Inject, Injectable, Logger } from '@nestjs/common';
import fetch from 'node-fetch';
import { base32 } from 'rfc4648';
import { IAppConfiguration } from '../IAppConfiguration';
import { ModuleProviderToken } from '../ModuleProviderToken';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

import { Controller, Get, HttpException, Inject } from '@nestjs/common';
import fetch from 'node-fetch';
import { IAppConfiguration } from '../IAppConfiguration';
import { ModuleProviderToken } from '../ModuleProviderToken';

Expand Down
1 change: 0 additions & 1 deletion matrix-meetings-bot/src/middleware/MatrixAuthMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import { Inject, Injectable, Logger, NestMiddleware } from '@nestjs/common';
import base64url from 'base64url';
import { NextFunction, Request, Response } from 'express';
import fetch from 'node-fetch';
import { IAppConfiguration } from '../IAppConfiguration';
import { MatrixEndpoint } from '../MatrixEndpoint';
import { ModuleProviderToken } from '../ModuleProviderToken';
Expand Down
4 changes: 2 additions & 2 deletions matrix-meetings-widget/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@types/lodash": "^4.14.197",
"@types/luxon": "^3.2.0",
"@types/mustache": "^4.2.2",
"@types/node": "^16.18.44",
"@types/node": "^20.4.6",
"@types/react": "^17.0.53",
"@types/react-dom": "^17.0.19",
"@types/react-i18next": "^8.1.0",
Expand All @@ -68,7 +68,7 @@
"typescript": "^5.1.6"
},
"engines": {
"node": ">=16",
"node": ">=20",
"yarn": ">=1.22.1 <2.0.0"
},
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('useDownloadIcsFile', () => {
slice: jest.fn(),
stream: jest.fn(),
text: jest.fn(),
});
} as unknown as Blob);

(URL.createObjectURL as jest.Mock).mockReturnValue('blob:url');

Expand Down
26 changes: 19 additions & 7 deletions matrix-meetings-widget/src/timezoneMockUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,25 @@ import { Settings } from 'luxon';
const DateTimeFormat = Intl.DateTimeFormat;

export function mockDateTimeFormatTimeZone(timeZone: string): void {
jest.spyOn(Intl, 'DateTimeFormat').mockImplementation(
(locale, options) =>
new DateTimeFormat(locale, {
...options,
timeZone: options?.timeZone ?? timeZone,
})
);
jest.spyOn(Intl, 'DateTimeFormat').mockImplementation((locale, options) => {
const format = new DateTimeFormat(locale, {
...options,
timeZone: options?.timeZone ?? timeZone,
});

// replace all uncommon whitespace characters with ' '. Relates to https://github.com/nodejs/node/pull/45068
// where the unicode standard decided to use U+2009 in some cases. This breaks some of our tests
const originalFormatRange = format.formatRange;
jest
.spyOn(format, 'formatRange')
.mockImplementation((startDate, endDate) =>
originalFormatRange
.call(format, startDate, endDate)
.replace(/\s+/g, ' ')
);

return format;
});

// make sure getTimezoneOffset is based on the provided timezone and
// not the system
Expand Down
20 changes: 6 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2950,18 +2950,10 @@
resolved "https://registry.yarnpkg.com/@types/mustache/-/mustache-4.2.2.tgz#825bf5c214c3ab84d0b23fef2c8eb898f3ff8717"
integrity sha512-MUSpfpW0yZbTgjekDbH0shMYBUD+X/uJJJMm9LXN1d5yjl5lCY1vN/eWKD6D1tOtjA6206K0zcIPnUaFMurdNA==

"@types/node-fetch@^2.6.4":
version "2.6.4"
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.4.tgz#1bc3a26de814f6bf466b25aeb1473fa1afe6a660"
integrity sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg==
dependencies:
"@types/node" "*"
form-data "^3.0.0"

"@types/node@*", "@types/node@^16.18.44":
version "16.18.44"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.44.tgz#3c3ea2a832014b869f0f370630d98bb026171e76"
integrity sha512-PZXtT+wqSMHnLPVExTh+tMt1VK+GvjRLsGZMbcQ4Mb/cG63xJig/TUmgrDa9aborl2i22UnpIzHYNu7s97NbBQ==
"@types/node@*", "@types/node@^20.4.6":
version "20.5.4"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.5.4.tgz#4666fb40f9974d60c53c4ff554315860ba4feab8"
integrity sha512-Y9vbIAoM31djQZrPYjpTLo0XlaSwOIsrlfE3LpulZeRblttsLQRFRlBAppW0LOxyT3ALj2M5vU1ucQQayQH3jA==

"@types/node@^12.7.1":
version "12.20.52"
Expand Down Expand Up @@ -4996,7 +4988,7 @@ cross-env@^7.0.3:
dependencies:
cross-spawn "^7.0.1"

cross-fetch@3.1.5, cross-fetch@^3.0.4, cross-fetch@^3.1.5:
cross-fetch@3.1.5, cross-fetch@^3.0.4:
version "3.1.5"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f"
integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==
Expand Down Expand Up @@ -9489,7 +9481,7 @@ node-fetch@2.6.7:
dependencies:
whatwg-url "^5.0.0"

node-fetch@^2.6.1, node-fetch@^2.6.12, node-fetch@^2.6.13, node-fetch@^2.6.7:
node-fetch@^2.6.1, node-fetch@^2.6.12, node-fetch@^2.6.7:
version "2.6.13"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.13.tgz#a20acbbec73c2e09f9007de5cda17104122e0010"
integrity sha512-StxNAxh15zr77QvvkmveSQ8uCQ4+v5FkvNTj0OESmiHu+VRi/gXArXtkWMElOsOUNLtUEvI4yS+rdtOHZTwlQA==
Expand Down

0 comments on commit 423c58d

Please sign in to comment.