-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Organize comprehensive templates in examples.ts with helper methods and combined template #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…amples and real-life scenarios Co-authored-by: streamich <[email protected]>
TemplateJson
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Move all new templates to
src/examples.ts
. - Crate a template which combines all templates using
or
template. - Make sure tests pass.
- Make sure linter and formatter pass.
… template Co-authored-by: streamich <[email protected]>
All changes implemented in commit d54454e: ✅ Moved all new templates to The comprehensive templates are now properly organized in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When done, make sure formatter passes.
src/index.ts
Outdated
@@ -3,3 +3,4 @@ export * from './RandomJson'; | |||
export * from './number'; | |||
export * from './string'; | |||
export * from './structured'; | |||
export * as examples from './examples'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the export * as examples from './examples';
line from src/index.ts
in commit 6a4fba8.
src/examples.ts
Outdated
tree(), | ||
comment(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tree(), | |
comment(), | |
tree, | |
comment, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the function calls to function references - changed tree(),
and comment(),
to tree,
and comment,
in commit 6a4fba8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add to this file (and export) methods for easy random JSON generation, such as getUser()
, genAddress()
, etc.
Mention these methods in README.md
.
DO NOT re-export anything from this file in main index.ts
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added helper methods for easy random JSON generation (like genUser()
, genAddress()
, etc.) to src/examples.ts
and documented them in README.md in commit 6a4fba8. These methods are not re-exported from main index.ts
as requested.
…ion calls, add helper methods Co-authored-by: streamich <[email protected]>
Formatter passes - confirmed with |
🎉 This PR is included in version 1.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR reorganizes the template structure by moving comprehensive templates to a dedicated
examples.ts
file and adding convenient helper methods for common data generation tasks.Changes Made
File Organization
src/structured/templates.ts
tosrc/examples.ts
src/structured/templates.ts
to contain only basic templates (nil
,tokensHelloWorld
,tokensObjectKey
,str
)src/index.ts
to keep the public API cleanCombined Template
Created
allExamples
template that uses theor
pattern to randomly select from all 34 comprehensive templates:Helper Methods for Easy Generation
Added convenient helper methods that eliminate the need to construct templates manually:
Available helper methods include:
genUser()
,genUserBasic()
- User profilesgenAddress()
,genLocation()
- Geographic datagenProduct()
,genOrder()
- E-commerce datagenTransaction()
,genBankAccount()
- Financial datagenSocialPost()
,genSocialProfile()
- Social media datagenPatient()
,genMedicalRecord()
- Medical datagenStudent()
,genCourse()
- Educational datagenSensorReading()
,genIotDevice()
- IoT datagenLogEntry()
,genMetricData()
- Monitoring datagenRandomExample()
- Random selection from all templatesTemplate Categories Available
Quality Assurance
This organization provides better separation of concerns while adding convenient helper methods for common use cases, making the library more approachable for developers who need quick data generation without template construction.
Fixes #4.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.