1import { schema } from './mockDataSchema';
2import chalk from 'chalk';
3
4const {resolve, extend} = require('json-schema-faker');
5const fs = require('fs');
6extend('faker', () => require('faker'));
7
8
9resolve(schema).then(sample => {
10 console.log('Writing to db.json')
11 fs.writeFile("./src/api/db.json", JSON.stringify(sample), function(err) {
12 if(err) {
13 return console.log(chalk.red(err));
14 } else {
15 console.log(chalk.green("Mock Data generated"));
16 }
17 });
18 });