Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -75,7 +75,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: 'open-feature-community-js-client',
wrapperVersion: '0.3.2', // {{ x-release-please-version }}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

A couple of suggestions to improve maintainability here:

  1. Avoid magic strings: The wrapperName could be defined as a constant at the top of the file for better readability and easier maintenance.
  2. Single source of truth for version: Instead of hardcoding wrapperVersion and relying on release-please to update it, you could import it from package.json. This would make package.json the single source of truth and you could remove the extra-files config from release-please-config.json.

Here's how you could implement these changes:

At the top of the file, add:

import { version } from '../../package.json';

const WRAPPER_NAME = 'open-feature-community-js-client';

Then update this block to:

Suggested change
this.ldOptions = {
...ldOptions,
logger: this.logger,
wrapperName: 'open-feature-community-js-client',
wrapperVersion: '0.3.2', // {{ x-release-please-version }}
};
this.ldOptions = {
...ldOptions,
logger: this.logger,
wrapperName: WRAPPER_NAME,
wrapperVersion: 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
Loading