From cea9f20c9677c52713f47fd1235a81909385f175 Mon Sep 17 00:00:00 2001 From: Asadhu Shujaau Date: Tue, 28 Jan 2025 13:52:40 +0500 Subject: [PATCH] refactor: rename package to @shujau/mockingjs --- README.md | 22 +++++++++++----------- package.json | 6 +++--- src/index.js | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index ef5d994..4e4423b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# shujau-mock-factory +# @shujau/mockingjs -![CI](https://github.com/asadhshujau/mock-factory/workflows/CI/badge.svg) -[![npm version](https://badge.fury.io/js/shujau-mock-factory.svg)](https://badge.fury.io/js/shujau-mock-factory) +![CI](https://github.com/asadhshujau/mockingjs/workflows/CI/badge.svg) +[![npm version](https://badge.fury.io/js/@shujau%2Fmockingjs.svg)](https://badge.fury.io/js/@shujau%2Fmockingjs) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) A flexible and powerful mock data generator built on top of Faker.js, designed to streamline the creation of realistic test data for your JavaScript applications. @@ -21,18 +21,18 @@ A flexible and powerful mock data generator built on top of Faker.js, designed t Using npm: ```bash -npm install shujau-mock-factory +npm install @shujau/mockingjs ``` Using yarn: ```bash -yarn add shujau-mock-factory +yarn add @shujau/mockingjs ``` ## Quick Start ```javascript -import factory from 'shujau-mock-factory'; +import factory from '@shujau/mockingjs'; const users = factory({ id: 'uniqueInt', @@ -135,7 +135,7 @@ You can set a seed to generate consistent data across multiple runs. This can be 1. Using the `setSeed` function: ```javascript -import { factory, setSeed } from 'shujau-mock-factory'; +import { factory, setSeed } from '@shujau/mockingjs'; setSeed(123); const users = factory({ name: 'fullName', email: 'email' }, { quantity: 2 }); @@ -144,7 +144,7 @@ const users = factory({ name: 'fullName', email: 'email' }, { quantity: 2 }); 2. Using the `seed` option in the `factory` function (recommended): ```javascript -import { factory } from 'shujau-mock-factory'; +import { factory } from '@shujau/mockingjs'; const users = factory( { name: 'fullName', email: 'email' }, @@ -159,7 +159,7 @@ Using the `seed` option is recommended as it allows for more localized control o #### Custom Type Definitions ```javascript -import { factory, defineType } from 'shujau-mock-factory'; +import { factory, defineType } from '@shujau/mockingjs'; defineType('customEmail', () => `user_${Math.random().toString(36).substr(2, 5)}@example.com`); @@ -172,7 +172,7 @@ const users = factory({ #### Schema Inference from Sample Data ```javascript -import { factory } from 'shujau-mock-factory'; +import { factory } from '@shujau/mockingjs'; const sampleUser = { id: 1, @@ -187,7 +187,7 @@ const users = factory(sampleUser, { quantity: 3, isSample: true }); #### Unique Integer Management ```javascript -import { factory, setUniqueIntStart, resetUniqueIntCounter } from 'shujau-mock-factory'; +import { factory, setUniqueIntStart, resetUniqueIntCounter } from '@shujau/mockingjs'; setUniqueIntStart(1000); const users = factory({ id: 'uniqueInt', name: 'fullName' }, { quantity: 2 }); diff --git a/package.json b/package.json index 301a1ce..d279ef5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "shujau-mock-factory", + "name": "@shujau/mockingjs", "version": "2.0.1", - "description": "A flexible fake data generator based on Faker.js", + "description": "A flexible fake data generator based on Faker.js (formerly shujau-mock-factory)", "main": "src/index.js", "type": "module", "engines": { @@ -9,7 +9,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/asadhshujau/mock-factory.git" + "url": "git+https://github.com/asadhshujau/mockingjs.git" }, "files": [ "src/index.js", diff --git a/src/index.js b/src/index.js index 13a8941..63fe196 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,6 @@ /** * @module index - * @description Main entry point for the shujau-mock-factory package + * @description Main entry point for the @shujau/mockingjs package */ import factory, { defineType, normalizeSchema, setSeed } from './factory.js'