Switched faker to @faker-js/faker

- `faker` was the original dependency but the maintainer ended up
  deleting the repo, so development continued in `@faker-js/faker`
- we're already using that dependency, so we can make a few simple
  changes and remove the old dependency from our repo
This commit is contained in:
Daniel Lockyer 2024-07-01 14:22:11 +02:00 committed by Daniel Lockyer
parent 60f37ed118
commit fcb95ecc1a
6 changed files with 7 additions and 12 deletions

View File

@ -1,4 +1,3 @@
import faker from 'faker';
import moment from 'moment-timezone';
import nql from '@tryghost/nql';
import {Response} from 'miragejs';
@ -7,6 +6,7 @@ import {
paginateModelCollection,
withPermissionsCheck
} from '../utils';
import {faker} from '@faker-js/faker';
import {underscore} from '@ember/string';
const ALLOWED_ROLES = [

View File

@ -1,6 +1,6 @@
import faker from 'faker';
import moment from 'moment-timezone';
import {Factory} from 'miragejs';
import {faker} from '@faker-js/faker';
const EVENT_TYPES = [
'newsletter_event',
@ -16,7 +16,7 @@ const EVENT_TYPES = [
/* eslint-disable camelcase */
export default Factory.extend({
type() { return faker.random.arrayElement([EVENT_TYPES]); },
type() { return faker.helpers.arrayElement([EVENT_TYPES]); },
createdAt() { return moment.utc().format(); },
afterCreate(event, server) {

View File

@ -1,6 +1,6 @@
import faker from 'faker';
import moment from 'moment-timezone';
import {Factory, trait} from 'miragejs';
import {faker} from '@faker-js/faker';
let randomDate = function randomDate(start = moment().subtract(30, 'days').toDate(), end = new Date()) {
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));

View File

@ -1,6 +1,6 @@
import faker from 'faker';
import moment from 'moment-timezone';
import {Factory} from 'miragejs';
import {faker} from '@faker-js/faker';
let randomDate = function randomDate(start = moment().subtract(30, 'days').toDate(), end = new Date()) {
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));

View File

@ -38,6 +38,7 @@
"@ember/test-helpers": "2.9.4",
"@ember/test-waiters": "3.1.0",
"@embroider/macros": "1.13.4",
"@faker-js/faker": "7.6.0",
"@glimmer/component": "1.1.2",
"@html-next/vertical-collection": "3.0.0",
"@sentry/ember": "7.118.0",
@ -122,7 +123,6 @@
"ember-truth-helpers": "3.1.1",
"ember-websockets": "10.2.1",
"eslint-plugin-babel": "5.3.1",
"faker": "5.5.3",
"flexsearch": "0.7.43",
"fs-extra": "11.2.0",
"glob": "8.1.0",
@ -206,4 +206,4 @@
}
}
}
}
}

View File

@ -17580,11 +17580,6 @@ fake-xml-http-request@^2.1.2:
resolved "https://registry.yarnpkg.com/fake-xml-http-request/-/fake-xml-http-request-2.1.2.tgz#f1786720cae50bbb46273035a0173414f3e85e74"
integrity sha512-HaFMBi7r+oEC9iJNpc3bvcW7Z7iLmM26hPDmlb0mFwyANSsOQAtJxbdWsXITKOzZUyMYK0zYCv3h5yDj9TsiXg==
faker@5.5.3:
version "5.5.3"
resolved "https://registry.yarnpkg.com/faker/-/faker-5.5.3.tgz#c57974ee484431b25205c2c8dc09fda861e51e0e"
integrity sha512-wLTv2a28wjUyWkbnX7u/ABZBkUkIF2fCd73V6P2oFqEGEktDfzWx4UxrSqtPRw0xPRAcjeAOIiJWqZm3pP4u3g==
fast-deep-equal@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49"