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

chore: update peer deps to min and max version ranges #213

Merged
merged 6 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/openfeature-server-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"peerDependencies": {
"@openfeature/server-sdk": "^1.13.5",
"@spotify-confidence/sdk": "^0.1.4"
"@spotify-confidence/sdk": ">=0.1.4 <=0.2.2"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
Expand Down
2 changes: 1 addition & 1 deletion packages/openfeature-web-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"peerDependencies": {
"@openfeature/web-sdk": "^1.0.3",
"@spotify-confidence/sdk": "^0.1.4"
"@spotify-confidence/sdk": ">=0.1.4 <=0.2.2"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"module": "dist/index.esm.js"
},
"peerDependencies": {
"@spotify-confidence/sdk": "^0.1.4",
"@spotify-confidence/sdk": ">=0.1.4 <=0.2.2",
"react": "^18.2.0"
},
"devDependencies": {
Expand Down
11 changes: 8 additions & 3 deletions yarn.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@ module.exports = defineConfig({
// example apps should always use the workspace version
dep.update('workspace:*');
} else if (dep.type === 'peerDependencies') {
// peer dependencies should use a caret range
if (!dep.range.startsWith('^')) {
dep.error(`Expected peer dependency to use a caret (^) range.`);
// peer dependencies should use a GT & LT range
// example: ">=0.1.4 <=0.3.x" where 0.3.x is the next breaking version
const [minVersion] = dep.range.match(/^>=\d+\.\d+\.\d+/) || [];
if (!minVersion) {
dep.error(`Expected peer dependency to use a min version`);
}
// TODO maybe automatically set the max version to the next breaking version
// dep.workspace.set(['peerDependencies', dep.ident], `${minVersion} <=${workspace.pkg.version}`);

// peer dependencies should also have a dev dependency to the workspace
dep.workspace.set(['devDependencies', dep.ident], 'workspace:*');
} else if (dep.type === 'devDependencies') {
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3722,7 +3722,7 @@ __metadata:
rollup: "npm:4.24.0"
peerDependencies:
"@openfeature/server-sdk": ^1.13.5
"@spotify-confidence/sdk": ^0.1.4
"@spotify-confidence/sdk": ">=0.1.4 <=0.2.2"
languageName: unknown
linkType: soft

Expand All @@ -3738,7 +3738,7 @@ __metadata:
rollup: "npm:4.24.0"
peerDependencies:
"@openfeature/web-sdk": ^1.0.3
"@spotify-confidence/sdk": ^0.1.4
"@spotify-confidence/sdk": ">=0.1.4 <=0.2.2"
languageName: unknown
linkType: soft

Expand All @@ -3751,7 +3751,7 @@ __metadata:
react: "npm:^18.2.0"
rollup: "npm:4.24.0"
peerDependencies:
"@spotify-confidence/sdk": ^0.1.4
"@spotify-confidence/sdk": ">=0.1.4 <=0.2.2"
react: ^18.2.0
languageName: unknown
linkType: soft
Expand Down