faker icon indicating copy to clipboard operation
faker copied to clipboard

docs: split custom Faker instance example

Open pkuczynski opened this issue 4 months ago β€’ 7 comments

Currently two examples are joined and it looks quite confusing.

Screenshot 2025-08-05 at 12 27 39

pkuczynski avatar Aug 05 '25 10:08 pkuczynski

Deploy Preview for fakerjs ready!

Name Link
Latest commit 9352293f227e78a8e9e75a566839e15f593a6913
Latest deploy log https://app.netlify.com/projects/fakerjs/deploys/6891e931993e5f00083757f9
Deploy Preview https://deploy-preview-3585.fakerjs.dev
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Aug 05 '25 10:08 netlify[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 99.96%. Comparing base (61e4c45) to head (9352293). :warning: Report is 25 commits behind head on next.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #3585   +/-   ##
=======================================
  Coverage   99.96%   99.96%           
=======================================
  Files        2894     2894           
  Lines      222262   222262           
  Branches      930      931    +1     
=======================================
  Hits       222195   222195           
  Misses         67       67           
Files with missing lines Coverage Ξ”
src/faker.ts 100.00% <ΓΈ> (ΓΈ)
:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Aug 05 '25 10:08 codecov[bot]

Initial attempt does not look as intended:

Screenshot 2025-08-05 at 12 56 23

pkuczynski avatar Aug 05 '25 10:08 pkuczynski

Still not perfect, but I think a little bit more clear

image

Is there a way to split examples into two boxes?

pkuczynski avatar Aug 05 '25 11:08 pkuczynski

Removing second @example tag was the only way to achieve a bit of clarity. Still I think being able to break into two separate boxes would be best:

image

pkuczynski avatar Aug 05 '25 11:08 pkuczynski

Is there a way to split examples into two boxes?

Yes, that would require some changes to the api-docs scripts.

Class-Level:

https://github.com/faker-js/faker/blob/61e4c45ac9176823e5e2a01dc1cfb761d3bb01d5/scripts/apidocs/output/page.ts#L76

Method-Level:

https://github.com/faker-js/faker/blob/61e4c45ac9176823e5e2a01dc1cfb761d3bb01d5/scripts/apidocs/output/page.ts#L195

Note: The later might have impact on the refresh examples button.

ST-DDT avatar Aug 05 '25 11:08 ST-DDT

I think it's a bit tricky to read partly because of the other commented out code. (Like the CJS imports and the seed). So comments are being used both as a header and to show optional alternatives.

Maybe some of the commented lines could be removed or split to another example.

matthewmayer avatar Aug 06 '25 08:08 matthewmayer