From e0ea3d670ebc34386940ef34e34799690ffc665e Mon Sep 17 00:00:00 2001 From: Knut Behrends Date: Sun, 7 Oct 2018 00:29:55 +0200 Subject: [PATCH] add faker to devDependencies, set locale of faker to 'de' --- buildScripts/generateMockData.js | 8 ++++++++ buildScripts/mockDataSchema.js | 4 ++-- package-lock.json | 6 ++++++ package.json | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/buildScripts/generateMockData.js b/buildScripts/generateMockData.js index 88d50ca5..ab3dcc72 100644 --- a/buildScripts/generateMockData.js +++ b/buildScripts/generateMockData.js @@ -11,6 +11,14 @@ import { schema } from './mockDataSchema'; import fs from 'fs'; import chalk from 'chalk'; +jsf.extend('faker', () => { + const faker = require('faker'); + + faker.locale = 'de'; // or any other language + + return faker; +}); + const json = JSON.stringify(jsf(schema)); fs.writeFile('./src/api/db.json', json, function(err) { diff --git a/buildScripts/mockDataSchema.js b/buildScripts/mockDataSchema.js index aa1a24b5..0d6986cc 100644 --- a/buildScripts/mockDataSchema.js +++ b/buildScripts/mockDataSchema.js @@ -3,8 +3,8 @@ export const schema = { properties: { users: { type: 'array', - minItems: 3, - maxItems: 5, + minItems: 30, + maxItems: 50, items: { type: 'object', properties: { diff --git a/package-lock.json b/package-lock.json index f793449f..004b8498 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4255,6 +4255,12 @@ "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", "dev": true }, + "faker": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/faker/-/faker-4.1.0.tgz", + "integrity": "sha1-HkW7vsxndLPBlfrSg1EJxtdIzD8=", + "dev": true + }, "fast-deep-equal": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", diff --git a/package.json b/package.json index 10d543f1..1e9bad1f 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "eslint-watch": "^3.1.5", "express": "^4.16.3", "extract-text-webpack-plugin": "^3.0.2", + "faker": "^4.1.0", "html-webpack-plugin": "3.2.0", "jsdom": "7.2.2", "json-schema-faker": "^0.5.0-rc15",