Skip to content

Commit 4ead312

Browse files
committed
fix(deps): upgrade dependencies
1 parent 35c55dd commit 4ead312

File tree

16 files changed

+4881
-2941
lines changed

16 files changed

+4881
-2941
lines changed

.eslintrc.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ module.exports = {
5656
{
5757
files: ['plugin/admin/src/**/*.js', 'playground/src/admin/**/*.js'],
5858
parser: '@babel/eslint-parser',
59-
extends: ['eslint:recommended', 'plugin:react/recommended', 'prettier'],
60-
plugins: ['react', 'react-hooks', 'import', 'jsx-a11y'],
59+
extends: ['eslint:recommended', 'plugin:react/recommended', 'prettier', 'plugin:jsx-a11y/recommended'],
60+
plugins: ['react', 'react-hooks', 'import'],
6161
env: {
6262
browser: true,
6363
commonjs: true,
@@ -120,7 +120,6 @@ module.exports = {
120120
'import/no-named-as-default': 0,
121121
'import/order': 2,
122122
'import/prefer-default-export': 'off',
123-
'jsx-a11y/click-events-have-key-events': 1,
124123
'max-len': [
125124
2,
126125
{

.github/workflows/e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
strategy:
77
matrix:
88
node: [18, 20]
9-
strapi: [4.14, 4.15]
9+
strapi: [4.14, 4.15, 4.19]
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v3

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@
1515
"release": "multi-semantic-release --ignore-private-packages"
1616
},
1717
"devDependencies": {
18-
"@babel/eslint-parser": "^7.19.1",
19-
"@babel/preset-react": "^7.18.6",
20-
"@commitlint/cli": "^17.4.2",
21-
"@commitlint/config-conventional": "^17.4.2",
18+
"@babel/eslint-parser": "^7.23.10",
19+
"@babel/preset-react": "^7.23.3",
20+
"@commitlint/cli": "^18.6.0",
21+
"@commitlint/config-conventional": "^18.6.0",
2222
"@semantic-release/git": "^10.0.1",
2323
"@feki.de/semantic-release-yarn": "^1.0.1",
2424
"cz-conventional-changelog": "3.3.0",
25-
"eslint": "^8.35.0",
26-
"eslint-config-prettier": "^8.8.0",
27-
"eslint-plugin-import": "^2.27.5",
28-
"eslint-plugin-jsx-a11y": "^6.7.1",
25+
"eslint": "^8.56.0",
26+
"eslint-config-prettier": "^9.1.0",
27+
"eslint-plugin-import": "^2.29.1",
28+
"eslint-plugin-jsx-a11y": "^6.8.0",
2929
"eslint-plugin-node": "^11.1.0",
30-
"eslint-plugin-react": "^7.32.2",
30+
"eslint-plugin-react": "^7.33.2",
3131
"eslint-plugin-react-hooks": "^4.6.0",
32-
"husky": "^8.0.1",
33-
"jest": "^29.4.1",
34-
"lint-staged": "^13.2.0",
32+
"husky": "^9.0.10",
33+
"jest": "^29.7.0",
34+
"lint-staged": "^15.2.1",
3535
"multi-semantic-release": "^3.0.2",
36-
"semantic-release": "^19.0.5"
36+
"semantic-release": "^22.0.12"
3737
},
3838
"config": {
3939
"commitizen": {

playground/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,4 @@ dist
114114
build
115115
.strapi-updater.json
116116
types
117+
.strapi

playground/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@
1818
"test": "echo no unittests"
1919
},
2020
"dependencies": {
21-
"@strapi/plugin-i18n": "4.15.0",
22-
"@strapi/plugin-users-permissions": "4.15.0",
23-
"@strapi/strapi": "4.15.0",
24-
"better-sqlite3": "8.2.0",
25-
"dotenv": "^16.0.3",
26-
"lodash.set": "^4.3.2",
27-
"mime-types": "^2.1.27",
28-
"react": "^18.0.0",
29-
"react-dom": "^18.0.0",
21+
"@strapi/plugin-i18n": "4.19.1",
22+
"@strapi/plugin-users-permissions": "4.19.1",
23+
"@strapi/strapi": "4.19.1",
24+
"better-sqlite3": "9.4.0",
25+
"dotenv": "^16.4.1",
26+
"lodash": "^4.17.21",
27+
"mime-types": "^2.1.35",
28+
"react": "^18.2.0",
29+
"react-dom": "^18.2.0",
3030
"react-router-dom": "^5.2.0",
3131
"styled-components": "^5.2.1"
3232
},
3333
"devDependencies": {
34-
"cypress": "^12.7.0",
35-
"start-server-and-test": "^2.0.0"
34+
"cypress": "^13.6.4",
35+
"start-server-and-test": "^2.0.3"
3636
},
3737
"engines": {
3838
"node": ">=14.19.1 <=20.x.x",

playground/src/bootstrap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const fs = require('fs')
44
const path = require('path')
55
const mime = require('mime-types')
6-
const set = require('lodash.set')
6+
const set = require('lodash/set')
77
const {
88
categories,
99
homepage,

playground/templates/template.package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@
2121
"@strapi/plugin-i18n": "${VERSION}",
2222
"@strapi/plugin-users-permissions": "${VERSION}",
2323
"@strapi/strapi": "${VERSION}",
24-
"better-sqlite3": "8.2.0",
25-
"dotenv": "^16.0.3",
26-
"lodash.set": "^4.3.2",
27-
"mime-types": "^2.1.27",
28-
"react": "^18.0.0",
29-
"react-dom": "^18.0.0",
24+
"better-sqlite3": "9.4.0",
25+
"dotenv": "^16.4.1",
26+
"lodash": "^4.17.21",
27+
"mime-types": "^2.1.35",
28+
"react": "^18.2.0",
29+
"react-dom": "^18.2.0",
3030
"react-router-dom": "^5.2.0",
3131
"styled-components": "^5.2.1"
3232
},
3333
"devDependencies": {
34-
"cypress": "^12.7.0",
35-
"start-server-and-test": "^2.0.0"
34+
"cypress": "^13.6.4",
35+
"start-server-and-test": "^2.0.3"
3636
},
3737
"engines": {
3838
"node": ">=14.19.1 <=20.x.x",

plugin/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@
2828
},
2929
"dependencies": {
3030
"@strapi/helper-plugin": "^4.15.0",
31-
"axios": "^1.2.2",
31+
"axios": "^1.6.7",
3232
"bottleneck": "^2.19.5",
33-
"jsdom": "^21.1.1",
33+
"jsdom": "^24.0.0",
3434
"showdown": "^2.1.0"
3535
},
3636
"devDependencies": {
37-
"@faker-js/faker": "^7.6.0",
37+
"@faker-js/faker": "^8.4.0",
3838
"@strapi/plugin-i18n": "^4.15.0",
39-
"axios-mock-adapter": "^1.21.2",
39+
"axios-mock-adapter": "^1.22.0",
4040
"lodash": "^4.17.21"
4141
},
4242
"peerDependencies": {

providers/deepl/__mocks__/server.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
'use strict'
22

33
const { setupServer } = require('msw/node')
4-
const { rest } = require('msw')
4+
const { http, HttpResponse } = require('msw')
55

66
function createJsonEndpoint(path, response) {
7-
return rest.get(path, (request, restResponse, context) =>
8-
restResponse(context.status(200), context.json(response(request)))
7+
return http.get(path, (info) =>
8+
HttpResponse.json(response(info), {status: 200})
99
)
1010
}
1111

1212
function createQueryJsonEndpoint(path, queryResponseMap) {
13-
return rest.get(path, (request, restResponse, context) => {
13+
return http.get(path, ({request}) => {
1414
const response = queryResponseMap[request.url.search]
1515
if (!response) {
1616
console.warn(
1717
`API call ${request.url.toString()} doesn't have a query handler.`
1818
)
19-
return restResponse(context.status(404))
19+
return new HttpResponse(null, {status: 404})
2020
}
2121

22-
return restResponse(context.status(200), context.json(response))
22+
return HttpResponse.json(response,{status: 200})
2323
})
2424
}
2525

2626
function createTextEndpoint(path, response) {
27-
return rest.get(path, (_request, restResponse, context) =>
28-
restResponse(context.status(200), context.text(response))
27+
return http.get(path, () =>
28+
HttpResponse.text(response, {status: 200})
2929
)
3030
}
3131

32-
const notFoundByDefault = rest.get(/.*/, (request, response, context) => {
32+
const notFoundByDefault = http.get(/.*/, ({request}) => {
3333
console.warn(
3434
`API call ${request.url.toString()} doesn't have a query handler.`
3535
)
36-
response(context.status(404))
36+
return new HttpResponse(null, {status: 404})
3737
})
3838

3939
function getServer(...handlers) {

providers/deepl/lib/__tests__/deepl.test.js

Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { faker } = require('@faker-js/faker')
44
const {
55
stringByteLength,
66
} = require('strapi-plugin-translate/server/utils/byte-length')
7-
const { rest } = require('msw')
7+
const { http, HttpResponse } = require('msw')
88

99
const {
1010
DEEPL_FREE_API,
@@ -40,41 +40,39 @@ describe('deepl provider', () => {
4040
return matchAuthKey === passedAuthKey
4141
}
4242

43-
const usageHandler = async (req, res, ctx) => {
44-
if (isAuthenticated(req)) {
45-
return res(ctx.json(usage_result))
43+
const usageHandler = async ({ request }) => {
44+
if (isAuthenticated(request)) {
45+
return HttpResponse.json(usage_result, { status: 200 })
4646
}
47-
return res(ctx.status(403))
47+
return new HttpResponse(null, { status: 403 })
4848
}
49-
const translateHandler = async (req, res, ctx) => {
50-
const body = await req.text()
49+
const translateHandler = async ({ request }) => {
50+
const body = await request.text()
5151
if (stringByteLength(body || '') > DEEPL_API_MAX_REQUEST_SIZE) {
5252
console.log({ length: stringByteLength(body || '') })
53-
return res(ctx.status(413))
53+
return new HttpResponse(null, { status: 413 })
5454
}
5555
const params = new URLSearchParams(body)
56-
if (isAuthenticated(req)) {
56+
if (isAuthenticated(request)) {
5757
let text = params.getAll('text')
5858
if (text.length == 0) {
59-
return res(ctx.status(400))
59+
return new HttpResponse(null, { status: 400 })
6060
}
6161
if (text.length > 50) {
62-
return res(ctx.status(413))
62+
return new HttpResponse(null, { status: 413 })
6363
}
6464
let targetLang = params.get('target_lang')
6565
if (!targetLang) {
66-
return res(ctx.status(400))
66+
return new HttpResponse(null, { status: 400 })
6767
}
68-
return res(
69-
ctx.json({
70-
translations: text.map((t) => ({
71-
detected_source_language: 'EN',
72-
text: t,
73-
})),
74-
})
75-
)
68+
return HttpResponse.json({
69+
translations: text.map((t) => ({
70+
detected_source_language: 'EN',
71+
text: t,
72+
})),
73+
})
7674
}
77-
return res(ctx.status(403))
75+
return new HttpResponse(null, { status: 403 })
7876
}
7977
beforeAll(() => {
8078
server = getServer()
@@ -109,8 +107,8 @@ describe('deepl provider', () => {
109107
})
110108
beforeEach(() => {
111109
server.use(
112-
rest.post(`${DEEPL_FREE_API}/usage`, usageHandler),
113-
rest.post(`${DEEPL_PAID_API}/usage`, usageHandler)
110+
http.get(`${DEEPL_FREE_API}/usage`, usageHandler),
111+
http.get(`${DEEPL_PAID_API}/usage`, usageHandler)
114112
)
115113
})
116114
if (validKey) {
@@ -141,8 +139,8 @@ describe('deepl provider', () => {
141139
describe('translate', () => {
142140
beforeEach(() => {
143141
server.use(
144-
rest.post(`${DEEPL_FREE_API}/translate`, translateHandler),
145-
rest.post(`${DEEPL_PAID_API}/translate`, translateHandler)
142+
http.post(`${DEEPL_FREE_API}/translate`, translateHandler),
143+
http.post(`${DEEPL_PAID_API}/translate`, translateHandler)
146144
)
147145
})
148146
describe.each([
@@ -317,7 +315,7 @@ describe('deepl provider', () => {
317315
text: faker.helpers.uniqueArray(
318316
() =>
319317
faker.lorem.paragraphs(
320-
faker.datatype.number({
318+
faker.number.int({
321319
min: DEEPL_API_MAX_REQUEST_SIZE / 2000,
322320
max: DEEPL_API_MAX_REQUEST_SIZE / 200,
323321
})
@@ -374,17 +372,17 @@ describe('deepl provider', () => {
374372
describe('setup', () => {
375373
beforeEach(() => {
376374
server.use(
377-
rest.post(`${DEEPL_FREE_API}/usage`, usageHandler),
378-
rest.post(`${DEEPL_PAID_API}/usage`, usageHandler),
379-
rest.post(`${deeplTestApi}/v2/usage`, usageHandler)
375+
http.get(`${DEEPL_FREE_API}/usage`, usageHandler),
376+
http.get(`${DEEPL_PAID_API}/usage`, usageHandler),
377+
http.get(`${deeplTestApi}/v2/usage`, usageHandler)
380378
)
381379
})
382380
describe('provider options', () => {
383381
it('key used', async () => {
384382
const deeplProvider = provider.init({
385383
apiKey: authKey,
386384
})
387-
385+
deeplProvider.usage().catch((e) => console.error(e))
388386
await expect(deeplProvider.usage()).resolves.toBeTruthy()
389387
})
390388

@@ -402,39 +400,44 @@ describe('deepl provider', () => {
402400
requiredParams,
403401
forbiddenParams = []
404402
) => {
405-
const handler = async (req, res, ctx) => {
406-
const body = await req.text()
403+
const handler = async ({ request }) => {
404+
const body = await request.text()
407405
const params = new URLSearchParams(body)
408406

409407
for (const key of forbiddenParams) {
410408
if (params.has(key)) {
411-
res.networkError(`Server should not have received param ${key}`)
409+
return new HttpResponse.text(
410+
`Server should not have received param ${key}`,
411+
{ status: 400 }
412+
)
412413
}
413414
}
414415
for (const key of Object.keys(requiredParams)) {
415416
if (!params.has(key)) {
416-
res.networkError(`Server did not receive required param ${key}`)
417+
return new HttpResponse.text(
418+
`Server did not receive required param ${key}`,
419+
{ status: 400 }
420+
)
417421
} else if (params.get(key) !== requiredParams[key]) {
418-
res.networkError(
422+
return new HttpResponse.text(
419423
`Required param ${key}=${
420424
requiredParams[key]
421-
} did not match received ${key}=${params.get(key)}`
425+
} did not match received ${key}=${params.get(key)}`,
426+
{ status: 400 }
422427
)
423428
}
424429
}
425430

426431
// skip authentication and validation
427432
let text = params.getAll('text')
428-
return res(
429-
ctx.json({
430-
translations: text.map((t) => ({
431-
detected_source_language: 'EN',
432-
text: t,
433-
})),
434-
})
435-
)
433+
return HttpResponse.json({
434+
translations: text.map((t) => ({
435+
detected_source_language: 'EN',
436+
text: t,
437+
})),
438+
})
436439
}
437-
server.use(rest.post(`${DEEPL_PAID_API}/translate`, handler))
440+
server.use(http.post(`${DEEPL_PAID_API}/translate`, handler))
438441
}
439442

440443
it('uses formality when provided', async () => {

0 commit comments

Comments
 (0)