Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ describe('LaunchDarklyClientProvider', () => {

const provider = new LaunchDarklyClientProvider(envKey, { logger, ...ldOptionsMock });

expect(provider['ldOptions']).toStrictEqual({ ...ldOptionsMock, logger });
expect(provider['ldOptions']).toStrictEqual({
...ldOptionsMock,
logger,
wrapperName: 'open-feature-community-js-client',
wrapperVersion: expect.any(String),
});
});
});

Expand All @@ -81,7 +86,15 @@ describe('LaunchDarklyClientProvider', () => {
await provider.initialize();
expect(initialize).toHaveBeenCalledTimes(1);
/* when not set in open feauture LD sdk initialize should be called with the anonymous context*/
expect(initialize).toHaveBeenCalledWith(envKey, { anonymous: true }, { logger });
expect(initialize).toHaveBeenCalledWith(
envKey,
{ anonymous: true },
{
logger,
wrapperName: 'open-feature-community-js-client',
wrapperVersion: expect.any(String),
},
);
expect(ldClientMock.waitForInitialization).toHaveBeenCalledWith(undefined);
});

Expand All @@ -90,7 +103,15 @@ describe('LaunchDarklyClientProvider', () => {
await provider.initialize();
expect(initialize).toHaveBeenCalledTimes(1);
/* when not set in open feauture LD sdk initialize should be called with the anonymous context*/
expect(initialize).toHaveBeenCalledWith(envKey, { anonymous: true }, { logger });
expect(initialize).toHaveBeenCalledWith(
envKey,
{ anonymous: true },
{
logger,
wrapperName: 'open-feature-community-js-client',
wrapperVersion: expect.any(String),
},
);
expect(ldClientMock.waitForInitialization).toHaveBeenCalledTimes(1);
expect(ldClientMock.waitForInitialization).toHaveBeenCalledWith(5);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import type { LaunchDarklyProviderOptions } from './launchdarkly-provider-option
import translateContext from './translate-context';
import translateResult from './translate-result';

const WRAPPER_NAME = 'open-feature-community-js-client';
const WRAPPER_VERSION = '0.3.2'; // {{ x-release-please-version }}
Copy link
Member Author

@kinyoklion kinyoklion Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know gemini will be a bit grumpy about this, but generally I find this to be much better than attempting to import the package.json. As it sounds nice, but importing the package.json, and also allowing the package to be easily exported in multiple forms (esm, cjs, iife) is much harder.

The single source of truth is release-please.


/**
* Create a ResolutionDetails for an evaluation that produced a type different
* from the expected type.
Expand Down Expand Up @@ -75,7 +78,12 @@ export class LaunchDarklyClientProvider implements Provider {
this.logger = basicLogger({ level: 'info' });
}
this.initializationTimeout = initializationTimeout;
this.ldOptions = { ...ldOptions, logger: this.logger };
this.ldOptions = {
...ldOptions,
logger: this.logger,
wrapperName: WRAPPER_NAME,
wrapperVersion: WRAPPER_VERSION,
};
}

private get client(): LDClient {
Expand Down
5 changes: 4 additions & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@
"prerelease": false,
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"versioning": "default"
"versioning": "default",
"extra-files": [
"src/lib/launchdarkly-client-provider.ts"
]
},
"libs/providers/go-feature-flag-web": {
"release-type": "node",
Expand Down