{"id":28562765,"url":"https://github.com/gunmer/data-mocker-cli","last_synced_at":"2025-06-10T12:11:47.646Z","repository":{"id":42254548,"uuid":"269945705","full_name":"Gunmer/data-mocker-cli","owner":"Gunmer","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-30T20:44:02.000Z","size":798,"stargazers_count":1,"open_issues_count":10,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-04T03:16:58.848Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gunmer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-06T10:24:52.000Z","updated_at":"2020-07-13T21:33:30.000Z","dependencies_parsed_at":"2023-01-31T16:15:41.358Z","dependency_job_id":null,"html_url":"https://github.com/Gunmer/data-mocker-cli","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gunmer%2Fdata-mocker-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gunmer%2Fdata-mocker-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gunmer%2Fdata-mocker-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gunmer%2Fdata-mocker-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gunmer","download_url":"https://codeload.github.com/Gunmer/data-mocker-cli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gunmer%2Fdata-mocker-cli/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259073029,"owners_count":22801094,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-10T12:11:36.098Z","updated_at":"2025-06-10T12:11:47.628Z","avatar_url":"https://github.com/Gunmer.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"data-mocker-cli\n===============\n\n![CI](https://github.com/Gunmer/data-mocker-cli/workflows/CI/badge.svg)\n[![Version](https://img.shields.io/npm/v/data-mocker-cli.svg)](https://npmjs.org/package/data-mocker-cli)\n![Downloads/week](https://img.shields.io/npm/dw/data-mocker-cli.svg)\n![License](https://img.shields.io/npm/l/data-mocker-cli.svg)\n[![codecov](https://codecov.io/gh/Gunmer/data-mocker-cli/branch/master/graph/badge.svg)](https://codecov.io/gh/Gunmer/data-mocker-cli)\n\n\u003c!-- toc --\u003e\n* [Summary](#summary)\n* [Usage](#usage)\n* [Commands](#commands)\n* [Schema file](#schema-file)\n* [Field types](#field-types)\n\u003c!-- tocstop --\u003e\n# Summary\nCli to generate a test data set, with it you can generate any flat data structure, being able to specify the type of each field or attribute.\n\nWith it you can generate thousands of test data\n\n\n# Usage\n\u003c!-- usage --\u003e\n```sh-session\n$ npm install -g data-mocker-cli\n$ dmcli COMMAND\nrunning command...\n$ dmcli (-v|--version|version)\ndata-mocker-cli/1.1.0 linux-x64 node-v12.18.1\n$ dmcli --help [COMMAND]\nUSAGE\n  $ dmcli COMMAND\n...\n```\n\u003c!-- usagestop --\u003e\n# Commands\n\u003c!-- commands --\u003e\n* [`dmcli generate NUMBER`](#dmcli-generate-number)\n* [`dmcli help [COMMAND]`](#dmcli-help-command)\n\n## `dmcli generate NUMBER`\n\nGenerate a file with mock data in json, csv or sql insert format\n\n```\nUSAGE\n  $ dmcli generate NUMBER\n\nARGUMENTS\n  NUMBER  Number of mock data\n\nOPTIONS\n  -h, --help                 show CLI help\n  -o, --output=sql|json|csv  [default: json] Output file format\n  -s, --schema=schema        (required) Schema of the data to be generated\n```\n\n_See code: [src/commands/generate.ts](https://github.com/Gunmer/data-mocker-cli/blob/v1.1.0/src/commands/generate.ts)_\n\n## `dmcli help [COMMAND]`\n\ndisplay help for dmcli\n\n```\nUSAGE\n  $ dmcli help [COMMAND]\n\nARGUMENTS\n  COMMAND  command to show help for\n\nOPTIONS\n  --all  see all commands in CLI\n```\n\n_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.1.0/src/commands/help.ts)_\n\u003c!-- commandsstop --\u003e\n\n# Schema file\nThe schema file is a json that contains a list of the fields that each data must have.\n\nIf you want to export in sql format, you can report the name of the table within the schema.json\n\n```json\n{\n  \"tableName\": \"people\",\n  \"nameFormatter\": \"LowerSnakeCase\",\n  \"fields\": [\n    {\n      \"type\": \"Number\",\n      \"name\": \"Id\",\n      \"isNullable\": false,\n      \"min\": 1\n    },\n    {\n      \"type\": \"Name\",\n      \"name\": \"First Name\"\n    },\n    {\n      \"type\": \"Surname\",\n      \"name\": \"last name 2\",\n      \"isNullable\": true\n    },\n    {\n      \"type\": \"Enum\",\n      \"name\": \"Gender\",\n      \"isNullable\": true,\n      \"source\": [\"Female\", \"Male\", \"Non-binary\"]\n    },\n    {\n      \"type\": \"Phone\",\n      \"name\": \"Mobile\",\n      \"prefix\": \"+34\",\n      \"pattern\": \"6dd dd dd dd\"\n    },\n    {\n      \"type\": \"Email\",\n      \"name\": \"Email\",\n      \"userNames\": [\"gunmer\", \"ironMan\", \"spiderman\"],\n      \"domains\": [\"private.es\"]\n    },\n    {\n      \"type\": \"String\",\n      \"name\": \"Description\",\n      \"min\": 25,\n      \"max\": 100\n    }\n  ]\n}\n```\n\n### NameFormatters\nWith this property you set the style of the name of the columns or attributes. If not reported by default it is LowerCamelCase\n\n| NameFormatters | Formats                                |\n|----------------|----------------------------------------|\n| UpperCamelCase | 'lorem ipsum' formats as 'LoremIpsum'  |\n| LowerCamelCase | 'lorem ipsum' formats as 'loremIpsum'  |\n| UpperSnakeCase | 'lorem ipsum' formats as 'Lorem_Ipsum' |\n| LowerSnakeCase | 'lorem ipsum' formats as 'lorem_ipsum' |\n| UpperKebabCase | 'lorem ipsum' formats as 'Lorem-Ipsum' |\n| LowerKebabCase | 'lorem ipsum' formats as 'lorem-ipsum' |\n| WithoutFormat  | 'lorem ipsum' formats as 'lorem ipsum' |\n\n## Common attributes\n\nAll fields contain the following attributes:\n\n| Attribute  | Description                                                                | Required | Default |\n|------------|----------------------------------------------------------------------------|----------|---------|\n| type       | Indicates the type of the field, if it is a name, surname, number, etc...  | Yes      |         |\n| name       | Name of the field with which the data will be created                      | Yes      |         |\n| isNullable | If true 25% of data contains an undefined value in the field               | No       | false   |\n\n# Field types\n### String\nGenerates a text string (lorem ipsum) up to the maximum number of characters indicated\n\n| Attribute | Description                               | Required |\n|-----------|-------------------------------------------|----------|\n| max       | Indicates the maximum value of the string | Yes      |\n| min       | Indicates the minimum length range value  | No       |\n\n### Number\nGenerate integers\n\n| Attribute | Description   | Required | Default           |\n|-----------|---------------|----------|-------------------|\n| min       | Minimum value | False    | −9007199254740991 |\n| max       | Maximum value | False    | 9007199254740991  |\n\n### Enum\nRandomly choose a value from the reported source\n\n| Attribute | Description                | Required |\n|-----------|----------------------------|----------|\n| source    | Array of options to choose | Yes      |\n\n### Name\nGenerate a random name\n\n| Attribute | Description                   | Required |\n|-----------|-------------------------------|----------|\n| source    | Array of names to choose from | False    |\n\n### Surname\nGenerate a random surname\n\n| Attribute | Description                      | Required |\n|-----------|----------------------------------|----------|\n| source    | Array of surnames to choose from | False    |\n\n### Email\nGenerate a random email with default or specific username and domain \n\n| Attribute | Description                       | Required |\n|-----------|-----------------------------------|----------|\n| userNames | Array of usernames to choose from | False    |\n| domains   | Array of domains to choose from   | False    |\n\n### Phone\nGenerate a random phone number with a pattern and prefix if needed\n\n| Attribute | Description                             | Required | Default   |\n|-----------|-----------------------------------------|----------|-----------|\n| prefix    | Set the prefix number                   | False    | Empty     |\n| pattern   | Set the patter with 'd' of phone number | False    | ddddddddd |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgunmer%2Fdata-mocker-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgunmer%2Fdata-mocker-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgunmer%2Fdata-mocker-cli/lists"}