@openfeature/web-sdk 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
<img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.7.0&color=yellow&style=for-the-badge" />
|
|
17
17
|
</a>
|
|
18
18
|
<!-- x-release-please-start-version -->
|
|
19
|
-
<a href="https://github.com/open-feature/js-sdk/releases/tag/web-sdk-v1.0.
|
|
20
|
-
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.0.
|
|
19
|
+
<a href="https://github.com/open-feature/js-sdk/releases/tag/web-sdk-v1.0.1">
|
|
20
|
+
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.0.1&color=blue&style=for-the-badge" />
|
|
21
21
|
</a>
|
|
22
22
|
<!-- x-release-please-end -->
|
|
23
23
|
<br/>
|
|
@@ -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.
|
|
40
40
|
|
|
41
41
|
<!-- x-hide-in-docs-end -->
|
|
42
42
|
|
|
@@ -61,6 +61,11 @@ npm install --save @openfeature/web-sdk
|
|
|
61
61
|
yarn add @openfeature/web-sdk @openfeature/core
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
+
> [!NOTE]
|
|
65
|
+
> `@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.
|