-
-
Notifications
You must be signed in to change notification settings - Fork 192
add prebuild script to collect peerdeps #765
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
base: master
Are you sure you want to change the base?
Conversation
The question of #747 pops to mind here. If the official stance of this library is that there is a hard dependency on standard schemas with the view of eventually making it the only option once ecosystem adoption grows then great, we keep it in. We should probably also add |
@@ -317,9 +318,91 @@ | |||
"zod": "^3.24.2" | |||
}, | |||
"peerDependencies": { | |||
"react-hook-form": "^7.55.0" | |||
"react-hook-form": "^7.55.0", | |||
"@hookform/resolvers": "^2.0.0", |
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.
why are you depending on the package itself?
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.
This is how we can make sure we're not depending on ourselves.
const peerDependencies = Object.fromEntries( | ||
packageJsons.flatMap((pj) => Object.entries(pj?.peerDependencies ?? {})), | ||
); |
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.
const peerDependencies = Object.fromEntries( | |
packageJsons.flatMap((pj) => Object.entries(pj?.peerDependencies ?? {})), | |
); | |
const topLevelPackageJson = JSON.parse(await fs.readFile('package.json')) | |
const peerDependencies = Object.fromEntries( | |
packageJsons | |
.flatMap((pj) => Object.entries(pj?.peerDependencies ?? {})) | |
.filter(([name]) => name !== topLevelPackageJson.name), | |
) |
); | ||
|
||
const packageJson = { | ||
...JSON.parse(await fs.readFile('package.json')), |
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.
...JSON.parse(await fs.readFile('package.json')), | |
...topLevelPackageJson, |
This adds a simple js script that is run before builds and commits that collects all peerDependencies from all subfolders together and inserts them into the root package.json. This closes #762