Skip to content

Commit

Permalink
use @flags-sdk/launchdarkly
Browse files Browse the repository at this point in the history
  • Loading branch information
dferber90 committed Jan 24, 2025
1 parent d371749 commit 1a4bb69
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 76 deletions.
71 changes: 0 additions & 71 deletions examples/snippets/app/examples/adapter-launchdarkly/adapter.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { flag } from '@vercel/flags/next';
import { launchDarkly } from './adapter';
import { launchDarkly } from '@flags-sdk/launchdarkly';

export const summerSaleFlag = flag({
key: 'summer-sale',
Expand Down
1 change: 1 addition & 0 deletions examples/snippets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"start": "next start"
},
"dependencies": {
"@flags-sdk/launchdarkly": "workspace:*",
"@launchdarkly/vercel-server-sdk": "1.3.21",
"@radix-ui/react-dialog": "1.1.2",
"@radix-ui/react-separator": "1.1.0",
Expand Down
4 changes: 3 additions & 1 deletion packages/adapter-launchdarkly/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"type-check": "tsc --noEmit"
},
"dependencies": {
"@launchdarkly/vercel-server-sdk": "1.3.21",
"@vercel/edge-config": "1.2.0"
},
"devDependencies": {
Expand All @@ -51,6 +50,9 @@
"vite": "5.1.1",
"vitest": "1.4.0"
},
"peerDependencies": {
"@launchdarkly/vercel-server-sdk": "^1.3.21"
},
"publishConfig": {
"access": "public"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/adapter-launchdarkly/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ export function createLaunchDarklyAdapter({
origin(key) {
return `https://app.launchdarkly.com/projects/${ldProject}/flags/${key}/`;
},
async decide({ key, entities, defaultValue }): Promise<ValueType> {
async decide({ key, entities }): Promise<ValueType> {
await ldClient.waitForInitialization();
return ldClient.variation(
key,
entities!,
options.defaultValue ?? defaultValue,
options.defaultValue,
) as ValueType;
},
};
Expand Down
5 changes: 4 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1a4bb69

Please sign in to comment.