Skip to content
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

Support specification of array fields #243

Open
turbocrime opened this issue Sep 6, 2024 · 1 comment
Open

Support specification of array fields #243

turbocrime opened this issue Sep 6, 2024 · 1 comment

Comments

@turbocrime
Copy link

turbocrime commented Sep 6, 2024

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	| [email protected]
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.

@JamieMason
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants