fast-check icon indicating copy to clipboard operation
fast-check copied to clipboard

Adopt better file layouting

Open dubzzz opened this issue 5 years ago • 6 comments

One should be able to import nat from 'fast-check/arbitraries/nat'. Revamping the file layouting may allow such imports.

For reference: rxjs or MaterialUI are great libs allowing this kind of imports.

dubzzz avatar Jul 02 '19 23:07 dubzzz

See exports field in package.json - https://nodejs.org/api/esm.html#esm_package_exports

dubzzz avatar Oct 06 '19 22:10 dubzzz

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 28 '20 21:08 stale[bot]

Work in Progress

  • arbitraries
    • numeric
      • internals
      • integer
        • internals
      • nat
    • string
      • hexa
      • base64
  • runners

dubzzz avatar Feb 17 '21 22:02 dubzzz

Or like ramda:

  • arbitrary/ - something that implements Arbitrary
    • _internals/
    • nat
    • integer
    • string
  • property/
    • property
    • asyncProperty
  • runner/ - something that consumes properties
    • _internals/
    • check
    • assert
    • sample
    • statistics
  • utils/
    • _internals/
    • modelRun
    • stringify
    • hash
    • pre
    • stream
    • random

Where do we put the interfaces, types...? Some like constraints on strings are used by many instances. Do duplicate them? Share them from one of the instance? Put all the instances together? Always put constraints outside in a separate file?

dubzzz avatar Feb 19 '21 18:02 dubzzz

Circular imports might be detected by https://www.npmjs.com/package/dpdm. It may help to detect wrongly placed files or (in the future) avoid introducing circular dependencies.

dubzzz avatar Jun 27 '21 18:06 dubzzz

another good example potentially is lodash / https://www.npmjs.com/package/lodash-es:

import { at } from "lodash/at";

  • https://github.com/rayepps/radash might be a younger project to see what a recent impl of this pattern looks like

jasikpark avatar Sep 12 '22 18:09 jasikpark