data-crafter
v1.0.5
Published
A package to generate mock data for testing
Downloads
25
Maintainers
Readme
Mock Data Generator
Table of Contents
About the Project
A simple npm package to generate mock data for testing purposes. It supports generating various types of mock data such as users, products, addresses, transactions, reviews, and orders.
Installation
- Clone the repository:
git clone https://github.com/alexgutscher26/Data-Crafter-Mock-Data-Generator
- Install:
npm i data-crafter
- Install as Local Package:
If you want to use it as a local package for testing or development purposes, you can install it from a relative path:
npm install ../path/to/data-crafter
Usage
- Generate Mock Users
Command: generate:user
Options:
--count (optional): Number of users to generate (default is 1).
--locale (optional): Locale for the generated data (default is 'en').
--output (optional): File path to export the generated data as a JSON file.
Example Usage:
node src/cli.js generate:user --count 5 --locale de --output users.json
- Generate Custom Schema Data
Command: generate:custom
Options:
--schema (required): Path to a schema JSON file that defines the data structure.
--count (optional): Number of data items to generate (default is 1).
--locale (optional): Locale for the generated data (default is 'en').
--output (optional): File path to export the generated data as a JSON file.
Example Usage:
node src/cli.js generate:custom --schema ./schema.json --count 10 --output custom_data.json
Example Schema File
(schema.json)
Here's an example of how a schema JSON file might look:
{
"username": {"type": "string", "length": 10},
"age": {"type": "integer", "min": 18, "max": 99},
"email": {"type": "email"},
"isActive": {"type": "boolean"},
"createdAt": {"type": "date", "min": "2000-01-01", "max": "2022-12-31"}
}
Contributing
We welcome contributions from everyone! Whether you’re a seasoned developer or just starting, your input can help us improve this project.
Guidelines Code Style: Please follow the existing code style and conventions used in the project. If applicable, run tests to ensure your changes do not break existing functionality.
Documentation: If your changes introduce new features, please update the Readme accordingly. Clear documentation helps users understand how to use the new features.
Issue Tracking: Before starting work on a new feature or bug fix, check the existing issues to see if someone else is already working on it. If you want to work on an unclaimed issue, consider commenting on it to express your interest.
Respect the Community: Be respectful and considerate of other contributors. We strive to maintain a friendly and inclusive environment.
Reporting Issues
If you encounter any bugs or have feature requests, please create a new issue in the issue tracker. Provide as much detail as possible to help us understand and address the problem effectively.
Thank You
Thank you for considering contributing to our project! Every contribution helps us improve and grow. We appreciate your time and effort!
License
This project is licensed under the MIT License.