JamieMason/syncpack

Support specification of array fields

Opened this issue · 1 comments

Description

I have a monorepo in which an identifiable subset of packages should contain specific globs within their files array.

I'd like to use syncpack to specify this, but it does not seem possible to configure customTypes for a strategy that permits an array.

https://jamiemason.github.io/syncpack/config/custom-types/#namestrategy

Name		| Example
-------------------------
name@version	| pnpm@7.27.0
version		| 12.4.2
versionsByName	| {"pnpm":"7.27.0", "semver": "7.3.8"}

Suggested Solution

Add or document some way to specify array fields. I'm interested in features like:

  1. require presence or absence of the field
  2. specify allowed length range
  3. exclude or include string members by regex
  4. exclude or include other primitive members

And, I would like to conditionally apply all of the above.

Features (1) and (2) might consider a zero-length array to be 'absent' by default.

Out of scope

I think it is easiest to only support arrays of similar primitive values first.

  • Don't worry about mixed-member arrays.
  • Don't worry about object members.

If the path feature of customTypes can or does support array indexing (i haven't looked into that) then that would be the solution for object members of arrays.

From an end user point of view, what would your syncpack config look like?