Skip to content

Commit b70015a

Browse files
authored
fix: semver util import error (#90)
* fix: downgrade to semver 7.4.0 to avoid require util error * chore: include instructions to turn on nodejs compat flag. * Update README.md * fix: npm and ci badges * chore: added comments why semver is pinned.
1 parent c13c125 commit b70015a

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

packages/sdk/cloudflare/README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# LaunchDarkly Cloudflare SDK
22

3-
[![NPM][sdk-server-cloudflare-npm-badge]][sdk-server-cloudflare-npm-link]
4-
[![Actions Status][sdk-server-cloudflare-ci-badge]][sdk-server-cloudflare-ci]
5-
[![Documentation](https://img.shields.io/static/v1?label=GitHub+Pages&message=API+reference&color=00add8)](https://launchdarkly.github.io/js-core/packages/sdk/server-cloudflare/docs/)
3+
[![NPM][sdk-cloudflare-npm-badge]][sdk-cloudflare-npm-link]
4+
[![Actions Status][sdk-cloudflare-ci-badge]][sdk-cloudflare-ci]
5+
[![Documentation](https://img.shields.io/static/v1?label=GitHub+Pages&message=API+reference&color=00add8)](https://launchdarkly.github.io/js-core/packages/sdk/cloudflare/docs/)
66

77
This library supports using Cloudflare [Workers KV](https://developers.cloudflare.com/workers/learning/how-kv-works) to replace the default in-memory feature store of the [LaunchDarkly Node.js SDK](https://github.com/launchdarkly/cloudflare-server-sdk).
88

@@ -17,7 +17,14 @@ npm i @launchdarkly/cloudflare-server-sdk
1717
or yarn:
1818

1919
```shell
20-
yarn add -D @launchdarkly/cloudflare-server-sdk
20+
yarn add @launchdarkly/cloudflare-server-sdk
21+
```
22+
23+
In `wrangler.toml` in your worker project turn on the Node.js compatibility flag.
24+
This allows the SDK to use `node:events`:
25+
26+
```toml
27+
compatibility_flags = [ "nodejs_compat" ]
2128
```
2229

2330
## Quickstart
@@ -55,3 +62,8 @@ yarn test
5562
- [docs.launchdarkly.com](https://docs.launchdarkly.com/ 'LaunchDarkly Documentation') for our documentation and SDK reference guides
5663
- [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ 'LaunchDarkly API Documentation') for our API documentation
5764
- [blog.launchdarkly.com](https://blog.launchdarkly.com/ 'LaunchDarkly Blog Documentation') for the latest product updates
65+
66+
[sdk-cloudflare-ci-badge]: https://github.com/launchdarkly/js-core/actions/workflows/cloudflare.yml/badge.svg
67+
[sdk-cloudflare-ci]: https://github.com/launchdarkly/js-core/actions/workflows/cloudflare.yml
68+
[sdk-cloudflare-npm-badge]: https://img.shields.io/npm/v/@launchdarkly/cloudflare-server-sdk.svg?style=flat-square
69+
[sdk-cloudflare-npm-link]: https://www.npmjs.com/package/@launchdarkly/cloudflare-server-sdk

packages/shared/sdk-server/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"license": "Apache-2.0",
2323
"dependencies": {
2424
"@launchdarkly/js-sdk-common": "0.3.0",
25-
"semver": "^7.3.8"
25+
"//": "Pinned because 7.5.0 introduced require('util') without the node: prefix",
26+
"semver": "7.4.0"
2627
},
2728
"devDependencies": {
2829
"@types/jest": "^29.4.0",

0 commit comments

Comments
 (0)