Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(other): bump @faker-js/faker from 5.1.0 to 8.4.1 in /webapp and adapt repo-wide code to deprecation warnings #6999

Merged
merged 8 commits into from
May 1, 2024
6 changes: 3 additions & 3 deletions backend/src/db/factories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Factory.define('badge')
})

Factory.define('image')
.attr('url', faker.image.unsplash.imageUrl)
.attr('url', faker.image.url)
.attr('aspectRatio', 1.3333333333333333)
.attr('alt', faker.lorem.sentence)
.attr('type', 'image/jpeg')
Expand All @@ -63,7 +63,7 @@ Factory.define('basicUser')
.option('password', '1234')
.attrs({
id: uuid,
name: faker.name.fullName,
name: faker.person.fullName,
password: '1234',
role: 'user',
termsAndConditionsAgreedVersion: '0.0.1',
Expand Down Expand Up @@ -107,7 +107,7 @@ Factory.define('user')
.option('email', faker.internet.exampleEmail)
.option('avatar', () =>
Factory.build('image', {
url: faker.internet.avatar(),
url: faker.image.avatar(),
}),
)
.after(async (buildObject, options) => {
Expand Down
24 changes: 12 additions & 12 deletions backend/src/db/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
categoryIds: ['cat16'],
author: peterLustig,
image: Factory.build('image', {
url: faker.image.unsplash.food(300, 169),
url: faker.image.urlLoremFlickr({ category: 'food', width: 300, height: 169 }),
sensitive: true,
aspectRatio: 300 / 169,
}),
Expand All @@ -648,7 +648,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
categoryIds: ['cat1'],
author: bobDerBaumeister,
image: Factory.build('image', {
url: faker.image.unsplash.technology(300, 1500),
url: faker.image.urlLoremFlickr({ category: 'technics', width: 300, height: 1500 }),
aspectRatio: 300 / 1500,
}),
},
Expand Down Expand Up @@ -696,7 +696,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
categoryIds: ['cat6'],
author: peterLustig,
image: Factory.build('image', {
url: faker.image.unsplash.buildings(300, 857),
url: faker.image.urlLoremFlickr({ category: 'city', width: 300, height: 857 }),
aspectRatio: 300 / 857,
}),
},
Expand Down Expand Up @@ -735,7 +735,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
categoryIds: ['cat11'],
author: louie,
image: Factory.build('image', {
url: faker.image.unsplash.people(300, 901),
url: faker.image.urlLoremFlickr({ category: 'people', width: 300, height: 901 }),
aspectRatio: 300 / 901,
}),
},
Expand All @@ -761,7 +761,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
categoryIds: ['cat14'],
author: jennyRostock,
image: Factory.build('image', {
url: faker.image.unsplash.objects(300, 200),
url: faker.image.urlLoremFlickr({ category: 'abstract', width: 300, height: 200 }),
aspectRatio: 300 / 450,
}),
},
Expand Down Expand Up @@ -821,7 +821,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
mutation: createPostMutation(),
variables: {
id: 'p8',
image: faker.image.unsplash.nature(),
image: faker.image.urlLoremFlickr({ category: 'nature' }),
title: `Quantum Flow Theory explains Quantum Gravity`,
content: hashtagAndMention1,
categoryIds: ['cat8'],
Expand Down Expand Up @@ -1178,7 +1178,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
categoryIds: ['cat1'],
author: jennyRostock,
image: Factory.build('image', {
url: faker.image.unsplash.objects(),
url: faker.image.urlLoremFlickr({ category: 'abstract' }),
}),
},
)
Expand Down Expand Up @@ -1229,7 +1229,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
categoryIds: ['cat1'],
author: peterLustig,
image: Factory.build('image', {
url: faker.image.unsplash.buildings(),
url: faker.image.urlLoremFlickr({ category: 'city' }),
}),
},
)
Expand Down Expand Up @@ -1280,7 +1280,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
categoryIds: ['cat1'],
author: dewey,
image: Factory.build('image', {
url: faker.image.unsplash.food(),
url: faker.image.urlLoremFlickr({ category: 'food' }),
}),
},
)
Expand Down Expand Up @@ -1331,7 +1331,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
categoryIds: ['cat1'],
author: louie,
image: Factory.build('image', {
url: faker.image.unsplash.technology(),
url: faker.image.urlLoremFlickr({ category: 'technics' }),
}),
},
)
Expand Down Expand Up @@ -1382,7 +1382,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
categoryIds: ['cat1'],
author: bobDerBaumeister,
image: Factory.build('image', {
url: faker.image.unsplash.people(),
url: faker.image.urlLoremFlickr({ category: 'people' }),
}),
},
)
Expand Down Expand Up @@ -1433,7 +1433,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
categoryIds: ['cat1'],
author: huey,
image: Factory.build('image', {
url: faker.image.unsplash.nature(),
url: faker.image.urlLoremFlickr({ category: 'nature' }),
}),
},
)
Expand Down
4 changes: 2 additions & 2 deletions webapp/components/CommentList/CommentList.story.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import faker from '@faker-js/faker'
import { faker } from '@faker-js/faker'
import { storiesOf } from '@storybook/vue'
import { withA11y } from '@storybook/addon-a11y'
import HcCommentList from './CommentList.vue'
Expand All @@ -8,7 +8,7 @@ helpers.init()

const commentMock = (fields) => {
return {
id: faker.random.uuid(),
id: faker.string.uuid(),
title: faker.lorem.sentence(),
content: faker.lorem.paragraph(),
createdAt: faker.date.past(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import faker from '@faker-js/faker'
import { faker } from '@faker-js/faker'
import { storiesOf } from '@storybook/vue'
import { withA11y } from '@storybook/addon-a11y'
import HcEmpty from '~/components/Empty/Empty'
Expand All @@ -17,7 +17,7 @@ helpers.init()
const postMock = (fields) => {
return {
...post,
id: faker.random.uuid(),
id: faker.string.uuid(),
createdAt: faker.date.past(),
updatedAt: faker.date.recent(),
deleted: false,
Expand All @@ -30,7 +30,7 @@ const postMock = (fields) => {
const userMock = (fields) => {
return {
...user,
id: faker.random.uuid(),
id: faker.string.uuid(),
createdAt: faker.date.past(),
updatedAt: faker.date.recent(),
deleted: false,
Expand Down
2 changes: 1 addition & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@babel/core": "^7.24.4",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.22.4",
"@faker-js/faker": "5.1.0",
"@faker-js/faker": "8.4.1",
"@nuxtjs/composition-api": "0.32.0",
"@storybook/addon-a11y": "^8.0.8",
"@storybook/addon-actions": "^5.3.21",
Expand Down
18 changes: 9 additions & 9 deletions webapp/storybook/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Vue from 'vue'
import Vuex from 'vuex'
import vuexI18n from 'vuex-i18n/dist/vuex-i18n.umd.js'
import Styleguide from '@human-connection/styleguide'
import faker from '@faker-js/faker'
import { faker } from '@faker-js/faker'
import Filters from '~/plugins/vue-filters'
import Directives from '~/plugins/vue-directives'
import IziToast from '~/plugins/izi-toast'
Expand Down Expand Up @@ -61,9 +61,9 @@ const helpers = {
},
fakeUser(n) {
return new Array(n || 1).fill(0).map(() => {
const name = faker.name.findName()
const name = faker.person.fullName()
return {
id: faker.random.uuid(),
id: faker.string.uuid(),
name,
slug: faker.helpers.slugify(name),
}
Expand All @@ -74,14 +74,14 @@ const helpers = {
const title = faker.lorem.words()
const content = faker.lorem.paragraph()
return {
id: faker.random.uuid(),
id: faker.string.uuid(),
title,
content,
slug: faker.lorem.slug(title),
shoutedCount: faker.random.number(),
commentsCount: faker.random.number(),
clickedCount: faker.random.number(),
viewedTeaserCount: faker.random.number(),
slug: faker.lorem.slug({ min: 1, max: 3 }, title),
shoutedCount: faker.number.int(),
commentsCount: faker.number.int(),
clickedCount: faker.number.int(),
viewedTeaserCount: faker.number.int(),
postType: ['Article'],
}
})
Expand Down
8 changes: 4 additions & 4 deletions webapp/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2270,10 +2270,10 @@
minimatch "^3.0.4"
strip-json-comments "^3.1.1"

"@faker-js/faker@5.1.0":
version "5.1.0"
resolved "https://registry.yarnpkg.com/@faker-js/faker/-/faker-5.1.0.tgz#cee1d77ada0d0dbbe77201d18b1ebabf432d9c0f"
integrity sha512-0VonSKh7fBCqvY+V2FLN2ZW4pR4ZtWJalWmwSaiaB7yK7y4qp8vDfuaq9QdLjf/cdZGx3M7Wc4Q+x4fZHxI21Q==
"@faker-js/faker@8.4.1":
version "8.4.1"
resolved "https://registry.yarnpkg.com/@faker-js/faker/-/faker-8.4.1.tgz#5d5e8aee8fce48f5e189bf730ebd1f758f491451"
integrity sha512-XQ3cU+Q8Uqmrbf2e0cIC/QN43sTBSC8KF12u29Mb47tWrt2hAgBXSgpZMj4Ao8Uk0iJcU99QsOCaIL8934obCg==

"@hapi/address@2.x.x":
version "2.0.0"
Expand Down