seed-wizard 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +102 -0
  3. package/bin/cli.js +56 -0
  4. package/index.js +118 -0
  5. package/package.json +35 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Saurabh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # šŸ§™ā€ā™‚ļø Seed Wizard
2
+
3
+ > **Stop writing insert statements by hand.** Seed Wizard is a powerful, stretchable CLI tool for generating realistic dummy data for SQL and NoSQL databases — in seconds.
4
+
5
+
6
+ ---
7
+
8
+ ## ✨ Features
9
+
10
+ | Feature | Description |
11
+ |---|---|
12
+ | šŸ—„ļø Multi-Database | Generate `.sql` for PostgreSQL/MySQL or `.json` for MongoDB/Firebase |
13
+ | šŸ‡®šŸ‡³ Indian Locale | Built-in support for **+91 phone formats**, Indian cities, and addresses |
14
+ | šŸ“Š Beautiful UX | Real-time **progress bars** and a colored dashboard in your terminal |
15
+ | 🧠 Type Smart | Auto-detects numbers vs. strings; handles SQL escaping (`O'Connor` → `'O''Connor'`) |
16
+ | šŸ”§ Stretchable Schema | Pass exactly the columns you need as CLI arguments — no config files |
17
+
18
+ ---
19
+
20
+ ## šŸ“¦ Installation
21
+
22
+ ```bash
23
+ npm install -g seed-wizard-cli
24
+ ```
25
+
26
+ ---
27
+
28
+ ## šŸ› ļø Usage
29
+
30
+ ### Show Help & Dashboard
31
+
32
+ ```bash
33
+ seed-wizard --help
34
+ ```
35
+
36
+ ### Generate SQL (PostgreSQL / MySQL)
37
+
38
+ ```bash
39
+ seed-wizard sql <table> "<columns>" <count>
40
+ ```
41
+
42
+ **Example:**
43
+
44
+ ```bash
45
+ seed-wizard sql users "name, age, phone, balance, city" 100
46
+ ```
47
+
48
+ ### Generate JSON (MongoDB / Firebase)
49
+
50
+ ```bash
51
+ seed-wizard json <collection> "<columns>" <count>
52
+ ```
53
+
54
+ **Example:**
55
+
56
+ ```bash
57
+ seed-wizard json products "product, price, description, date" 50
58
+ ```
59
+
60
+ ---
61
+
62
+ ## šŸ”‘ Available Data Keywords
63
+
64
+ | Category | Keywords |
65
+ |---|---|
66
+ | šŸ‘¤ Personal | `name`, `email`, `phone` *(+91)*, `age`, `gender`, `avatar` |
67
+ | šŸ“ Location | `city`, `address`, `country`, `zip` |
68
+ | šŸ’¼ Business | `balance`, `company`, `job`, `price`, `product` |
69
+ | āš™ļø System | `id`, `date`, `password`, `description`, `boolean` |
70
+
71
+ ---
72
+
73
+ ## šŸ’” Examples
74
+
75
+ **Banking / Fintech:**
76
+ ```bash
77
+ seed-wizard sql customers "name, balance, age, phone" 500
78
+ ```
79
+
80
+ **E-commerce Inventory:**
81
+ ```bash
82
+ seed-wizard json inventory "product, price, description" 20
83
+ ```
84
+
85
+ **User Profiles:**
86
+ ```bash
87
+ seed-wizard sql profiles "name, email, age, city, gender, avatar" 200
88
+ ```
89
+
90
+ ---
91
+
92
+ ## šŸ—‚ļø Output
93
+
94
+ - **SQL mode** → generates a `.sql` file with ready-to-run `INSERT` statements
95
+ - **JSON mode** → generates a `.json` file importable into MongoDB, Firebase, or any document store
96
+
97
+ ---
98
+
99
+ ## šŸ“„ License
100
+
101
+ MIT Ā© [Saurabh Jadhav](https://github.com/saurabhj2k3)
102
+
package/bin/cli.js ADDED
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+ const { generateSQL, generateJSON } = require('../index.js');
3
+ const chalk = require('chalk');
4
+
5
+ const args = process.argv.slice(2);
6
+
7
+ // Dashboard / Help Menu Function
8
+ function showHelp() {
9
+ console.log(chalk.bold.magenta('\n' + '═'.repeat(60)));
10
+ console.log(chalk.bold.white(' šŸ§™ā€ā™‚ļø SEED WIZARD - THE ULTIMATE DATA GENERATOR'));
11
+ console.log(chalk.bold.magenta('═'.repeat(60)));
12
+
13
+ console.log(chalk.bold.cyan('\nšŸš€ QUICK START:'));
14
+ console.log(chalk.white(' seed-wizard <format> <filename> <columns> <count>'));
15
+
16
+ console.log(chalk.yellow('\nšŸ“‚ SUPPORTED FORMATS:'));
17
+ console.log(chalk.white(' sql ') + chalk.gray('āžœ Perfect for PostgreSQL, MySQL, Supabase'));
18
+ console.log(chalk.white(' json ') + chalk.gray('āžœ Perfect for MongoDB, Firebase, Frontend Mocks'));
19
+
20
+ console.log(chalk.yellow('\n✨ AVAILABLE DATA KEYWORDS:'));
21
+ console.log(chalk.white(' šŸ‘¤ ') + chalk.bold('Personal: ') + chalk.white('name, email, phone, age, gender, avatar'));
22
+ console.log(chalk.white(' šŸ“ ') + chalk.bold('Location: ') + chalk.white('city, address, country, zip'));
23
+ console.log(chalk.white(' šŸ’° ') + chalk.bold('Business: ') + chalk.white('balance, company, job, price, product'));
24
+ console.log(chalk.white(' āš™ļø ') + chalk.bold('System: ') + chalk.white('id, date, password, description'));
25
+
26
+ console.log(chalk.bold.cyan('\nšŸ“ REAL-WORLD EXAMPLES:'));
27
+ console.log(chalk.white(' 1. Create 50 Bank Customers (SQL):'));
28
+ console.log(chalk.green(' seed-wizard sql customers "name, balance, city, phone" 50'));
29
+
30
+ console.log(chalk.white('\n 2. Create 20 E-commerce Products (JSON):'));
31
+ console.log(chalk.green(' seed-wizard json products "product, price, description" 20'));
32
+
33
+ console.log(chalk.white('\n 3. Create Social Media Profiles (JSON):'));
34
+ console.log(chalk.green(' seed-wizard json profiles "name, avatar, age, gender" 100'));
35
+
36
+ console.log(chalk.bold.magenta('\n' + '═'.repeat(60) + '\n'));
37
+ process.exit(0);
38
+ }
39
+
40
+ // Logic to handle commands
41
+ if (args.includes('--help') || args.includes('-h') || args.length < 3) {
42
+ showHelp();
43
+ }
44
+
45
+ const [format, name, columns, count] = args;
46
+ const columnsArray = columns.split(/[ ,]+/).filter(Boolean);
47
+ const totalRecords = count ? parseInt(count) : 10;
48
+
49
+ if (format.toLowerCase() === 'sql') {
50
+ generateSQL(name, columnsArray, totalRecords);
51
+ } else if (format.toLowerCase() === 'json') {
52
+ generateJSON(name, columnsArray, totalRecords);
53
+ } else {
54
+ console.log(chalk.bold.red('\nāŒ Error: Unknown format "' + format + '"'));
55
+ showHelp();
56
+ }
package/index.js ADDED
@@ -0,0 +1,118 @@
1
+ const { faker } = require('@faker-js/faker');
2
+ const fs = require('fs');
3
+ const chalk = require('chalk');
4
+ const cliProgress = require('cli-progress');
5
+
6
+ /**
7
+ * Data Library: The "Stretchable" Core
8
+ * Add any new keywords here to expand the wizard's knowledge.
9
+ */
10
+ function getFakerData(type) {
11
+ const map = {
12
+ // Personal Info
13
+ name: () => faker.person.fullName(),
14
+ email: () => faker.internet.email(),
15
+ phone: () => faker.helpers.fromRegExp('+91 [6-9][0-9]{9}'), // Indian Mobile Format
16
+ age: () => faker.number.int({ min: 18, max: 75 }),
17
+ gender: () => faker.person.sex(),
18
+ avatar: () => faker.image.avatar(),
19
+
20
+ // Location
21
+ city: () => faker.location.city(),
22
+ address: () => faker.location.streetAddress(),
23
+ country: () => faker.location.country(),
24
+ zip: () => faker.location.zipCode(),
25
+
26
+ // Business & Finance
27
+ balance: () => faker.finance.amount(),
28
+ company: () => faker.company.name(),
29
+ job: () => faker.person.jobTitle(),
30
+ price: () => faker.commerce.price(),
31
+ product: () => faker.commerce.productName(),
32
+
33
+ // Tech & System
34
+ id: () => faker.string.uuid(),
35
+ date: () => faker.date.recent().toISOString(),
36
+ description: () => faker.commerce.productDescription(),
37
+ password: () => faker.internet.password(),
38
+ boolean: () => faker.datatype.boolean()
39
+ };
40
+
41
+ // Fallback: If type isn't found, return a random word
42
+ return map[type] ? map[type]() : faker.word.sample();
43
+ }
44
+
45
+ /**
46
+ * SQL Generator with Progress Bar and Type Safety
47
+ */
48
+ function generateSQL(tableName, columnsArray, count) {
49
+ const bar = new cliProgress.SingleBar({
50
+ format: chalk.magenta('SQL Generation') + ' |' + chalk.magenta('{bar}') + '| {percentage}% || {value}/{total} Rows',
51
+ barCompleteChar: '\u2588',
52
+ barIncompleteChar: '\u2591',
53
+ hideCursor: true
54
+ });
55
+
56
+ bar.start(count, 0);
57
+ let sql = `-- Seed data generated for table: ${tableName}\n`;
58
+
59
+ for (let i = 0; i < count; i++) {
60
+ const columns = columnsArray.join(', ');
61
+ const values = columnsArray.map(col => {
62
+ let data = getFakerData(col);
63
+
64
+ // Handle SQL Data Types
65
+ // Numbers (age, balance, price) should NOT have quotes
66
+ const isNumber = !isNaN(data) && typeof data !== 'boolean' && col !== 'phone';
67
+
68
+ if (typeof data === 'string') {
69
+ data = data.replace(/'/g, "''"); // Escape single quotes for SQL
70
+ return isNumber ? data : `'${data}'`;
71
+ }
72
+ return data;
73
+ }).join(', ');
74
+
75
+ sql += `INSERT INTO ${tableName} (${columns}) VALUES (${values});\n`;
76
+ bar.update(i + 1);
77
+ }
78
+
79
+ bar.stop();
80
+ fs.writeFileSync(`${tableName}.sql`, sql);
81
+ console.log(chalk.green(`\nāœ” Success! File "${tableName}.sql" created with ${count} records.`));
82
+ }
83
+
84
+ /**
85
+ * JSON Generator with Progress Bar
86
+ */
87
+ function generateJSON(collectionName, columnsArray, count) {
88
+ const bar = new cliProgress.SingleBar({
89
+ format: chalk.cyan('JSON Generation') + ' |' + chalk.cyan('{bar}') + '| {percentage}% || {value}/{total} Objects',
90
+ barCompleteChar: '\u2588',
91
+ barIncompleteChar: '\u2591',
92
+ hideCursor: true
93
+ });
94
+
95
+ bar.start(count, 0);
96
+ const data = [];
97
+
98
+ for (let i = 0; i < count; i++) {
99
+ const doc = {};
100
+ columnsArray.forEach(col => {
101
+ let val = getFakerData(col);
102
+
103
+ // Clean numeric strings for JSON objects
104
+ if (['balance', 'price', 'age'].includes(col)) {
105
+ val = parseFloat(val);
106
+ }
107
+ doc[col] = val;
108
+ });
109
+ data.push(doc);
110
+ bar.update(i + 1);
111
+ }
112
+
113
+ bar.stop();
114
+ fs.writeFileSync(`${collectionName}.json`, JSON.stringify(data, null, 2));
115
+ console.log(chalk.blue(`\nāœ” Success! File "${collectionName}.json" created with ${count} objects.`));
116
+ }
117
+
118
+ module.exports = { generateSQL, generateJSON };
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "seed-wizard",
3
+ "version": "1.0.0",
4
+ "description": "A dynamic CLI tool to generate realistic SQL and JSON seed data with progress bars.",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "seed-wizard": "bin/cli.js"
8
+ },
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1",
11
+ "start": "node bin/cli.js"
12
+ },
13
+ "keywords": [
14
+ "seed",
15
+ "faker",
16
+ "sql",
17
+ "mongodb",
18
+ "cli",
19
+ "data-generator"
20
+ ],
21
+ "author": "Saurabh Jadhav",
22
+ "license": "MIT",
23
+ "dependencies": {
24
+ "@faker-js/faker": "^9.9.0",
25
+ "chalk": "^4.1.2",
26
+ "cli-progress": "^3.12.0"
27
+ },
28
+ "engines": {
29
+ "node": ">=14.0.0"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/your-username/seed-wizard.git"
34
+ }
35
+ }