You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds a blurb out peer deps and lib development, installation.
@beeme1mr I also added a bit about `--legacy-peer-deps` after the
closure of #834
---------
Signed-off-by: Todd Baert <[email protected]>
Copy file name to clipboardExpand all lines: packages/client/README.md
+14-1Lines changed: 14 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@
36
36
</p>
37
37
<!-- x-hide-in-docs-start -->
38
38
39
-
[OpenFeature](https://openfeature.dev) is an open specification that provides a vendor-agnostic, community-driven API for feature flagging that works with your favorite feature flag management tool.
39
+
[OpenFeature](https://openfeature.dev) is an open specification that provides a vendor-agnostic, community-driven API for feature flagging that works with your favorite feature flag management tool or in-house solution.
> `@openfeature/core` contains common components used by all OpenFeature JavaScript implementations.
66
+
> Every SDK version has a requirement on a single, specific version of this dependency.
67
+
> For more information, and similar implications on libraries developed with OpenFeature see [considerations when extending](#considerations).
68
+
64
69
### Usage
65
70
66
71
```ts
@@ -336,3 +341,11 @@ export class MyHook implements Hook {
336
341
```
337
342
338
343
> Built a new hook? [Let us know](https://github.com/open-feature/openfeature.dev/issues/new?assignees=&labels=hook&projects=&template=document-hook.yaml&title=%5BHook%5D%3A+) so we can add it to the docs!
344
+
345
+
### Considerations
346
+
347
+
When developing a library based on OpenFeature components, it's important to list the `@openfeature/web-sdk` as a `peerDependency` of your package.
348
+
This is a general best-practice when developing JavaScript libraries that have dependencies in common with their consuming application.
349
+
Failing to do this can result in multiple copies of the OpenFeature SDK in the consumer, which can lead to type errors, and broken singleton behavior.
350
+
The `@openfeature/core` package itself follows this pattern: the `@openfeature/web-sdk` has a peer dependency on `@openfeature/core`, and uses whatever copy of that module the consumer has installed (note that NPM installs peers automatically unless `--legacy-peer-deps` is set, while yarn does not, and PNPM does so based on its configuration).
351
+
When developing such libraries, it's NOT necessary to add a `peerDependency` on `@openfeature/core`, since the `@openfeature/web-sdk` establishes that dependency itself transitively.
Copy file name to clipboardExpand all lines: packages/server/README.md
+14-1Lines changed: 14 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@
36
36
</p>
37
37
<!-- x-hide-in-docs-start -->
38
38
39
-
[OpenFeature](https://openfeature.dev) is an open specification that provides a vendor-agnostic, community-driven API for feature flagging that works with your favorite feature flag management tool.
39
+
[OpenFeature](https://openfeature.dev) is an open specification that provides a vendor-agnostic, community-driven API for feature flagging that works with your favorite feature flag management tool or in-house solution.
> `@openfeature/core` contains common components used by all OpenFeature JavaScript implementations.
66
+
> Every SDK version has a requirement on a single, specific version of this dependency.
67
+
> For more information, and similar implications on libraries developed with OpenFeature see [considerations when extending](#considerations).
68
+
64
69
### Usage
65
70
66
71
```ts
@@ -362,3 +367,11 @@ export class MyHook implements Hook {
362
367
```
363
368
364
369
> Built a new hook? [Let us know](https://github.com/open-feature/openfeature.dev/issues/new?assignees=&labels=hook&projects=&template=document-hook.yaml&title=%5BHook%5D%3A+) so we can add it to the docs!
370
+
371
+
### Considerations
372
+
373
+
When developing a library based on OpenFeature components, it's important to list the `@openfeature/server-sdk` as a `peerDependency` of your package.
374
+
This is a general best-practice when developing JavaScript libraries that have dependencies in common with their consuming application.
375
+
Failing to do this can result in multiple copies of the OpenFeature SDK in the consumer, which can lead to type errors, and broken singleton behavior.
376
+
The `@openfeature/core` package itself follows this pattern: the `@openfeature/server-sdk` has a peer dependency on `@openfeature/core`, and uses whatever copy of that module the consumer has installed (note that NPM installs peers automatically unless `--legacy-peer-deps` is set, while yarn does not, and PNPM does so based on its configuration).
377
+
When developing such libraries, it's NOT necessary to add a `peerDependency` on `@openfeature/core`, since the `@openfeature/server-sdk` establishes that dependency itself transitively.
0 commit comments