Skip to content

Commit f04de7f

Browse files
committed
chore: Prepare for browser client releases.
1 parent 35fa033 commit f04de7f

File tree

6 files changed

+102
-9
lines changed

6 files changed

+102
-9
lines changed

.github/workflows/release-please.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
package-node-server-sdk-otel-release: ${{ steps.release.outputs['packages/telemetry/node-server-sdk-otel--release_created'] }}
2525
package-tooling-jest-release: ${{ steps.release.outputs['packages/tooling/jest--release_created'] }}
2626
package-react-universal-release: ${{ steps.release.outputs['packages/sdk/react-universal--release_created'] }}
27+
package-browser-released: ${{ steps.release.outputs['packages/sdk/browser--release_created'] }}
2728
steps:
2829
- uses: googleapis/release-please-action@v4
2930
id: release
@@ -170,6 +171,27 @@ jobs:
170171
workspace_path: packages/sdk/react-native
171172
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
172173

174+
release-browser:
175+
runs-on: ubuntu-latest
176+
needs: ['release-please', 'release-sdk-client']
177+
permissions:
178+
id-token: write
179+
contents: write
180+
if: ${{ always() && !failure() && !cancelled() && needs.release-please.outputs.package-browser-released == 'true'}}
181+
steps:
182+
- uses: actions/checkout@v4
183+
- uses: actions/setup-node@v4
184+
with:
185+
node-version: 20.x
186+
registry-url: 'https://registry.npmjs.org'
187+
- id: release-react-native
188+
name: Full release of packages/sdk/browser
189+
uses: ./actions/full-release
190+
with:
191+
workspace_path: packages/sdk/browser
192+
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
193+
194+
173195
release-server-node:
174196
runs-on: ubuntu-latest
175197
needs: ['release-please', 'release-sdk-server']

.release-please-manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
"packages/store/node-server-sdk-redis": "4.1.22",
1313
"packages/shared/sdk-client": "1.8.0",
1414
"packages/sdk/react-native": "10.7.0",
15-
"packages/telemetry/node-server-sdk-otel": "1.0.14"
15+
"packages/telemetry/node-server-sdk-otel": "1.0.14",
16+
"packages/sdk/browser": "0.0.0"
1617
}

packages/sdk/browser/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
88
[![NPM][browser-sdk-dt-badge]][browser-sdk-npm-link]
99
-->
1010

11+
# ⛔️⛔️⛔️⛔️
1112
> [!CAUTION]
12-
> This library is a beta version and should not be considered ready for production use while this message is visible.
13+
> This library is a alpha version and should not be considered ready for production use while this message is visible.
14+
15+
# ☝️☝️☝️☝️☝️☝️
1316

1417
<!--
1518
## Install

packages/sdk/browser/src/BrowserClient.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,19 @@ import BrowserPlatform from './platform/BrowserPlatform';
3131
* Applications should configure the client at page load time and reuse the same instance.
3232
*
3333
* For more information, see the [SDK Reference Guide](https://docs.launchdarkly.com/sdk/client-side/javascript).
34-
*
35-
* @ignore Implementation Note: We are not supporting dynamically setting the connection mode on the LDClient.
36-
* @ignore Implementation Note: The SDK does not support offline mode. Instead bootstrap data can be used.
37-
* @ignore Implementation Note: The browser SDK has different identify options, so omits the base implementation
38-
* @ignore from the interface.
3934
*/
4035
export type LDClient = Omit<
4136
CommonClient,
4237
'setConnectionMode' | 'getConnectionMode' | 'getOffline' | 'identify'
4338
> & {
39+
/**
40+
* @ignore
41+
* Implementation Note: We are not supporting dynamically setting the connection mode on the LDClient.
42+
* Implementation Note: The SDK does not support offline mode. Instead bootstrap data can be used.
43+
* Implementation Note: The browser SDK has different identify options, so omits the base implementation
44+
* from the interface.
45+
*/
46+
4447
/**
4548
* Specifies whether or not to open a streaming connection to LaunchDarkly for live flag updates.
4649
*

packages/sdk/browser/src/index.ts

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1+
/**
2+
* This is the API reference for the LaunchDarkly Client-Side SDK for JavaScript.
3+
*
4+
* This SDK is intended for use in browser environments.
5+
*
6+
* In typical usage, you will call {@link initialize} once at startup time to obtain an instance of
7+
* {@link LDClient}, which provides access to all of the SDK's functionality.
8+
*
9+
* For more information, see the SDK reference guide.
10+
*
11+
* @packageDocumentation
12+
*/
113
import {
214
AutoEnvAttributes,
15+
BasicLogger,
316
EvaluationSeriesContext,
417
EvaluationSeriesData,
518
Hook,
@@ -52,7 +65,57 @@ export type {
5265
IdentifySeriesStatus,
5366
};
5467

55-
export function init(clientSideId: string, options?: LDOptions): LDClient {
68+
/**
69+
* Creates an instance of the LaunchDarkly client.
70+
*
71+
* The client will begin attempting to connect to LaunchDarkly as soon as it is created. To
72+
* determine when it is ready to use, call [[LDClient.waitForInitialization]], or register an
73+
* event listener for the `"ready"` event using [[LDClient.on]].
74+
*
75+
* Usage:
76+
* ```
77+
* import { initialize } from 'launchdarkly-js-client-sdk';
78+
* const client = initialize(envKey, context, options);
79+
* ```
80+
*
81+
* @param clientSideId
82+
* The client-side id, also known as the environment ID.
83+
* @param options
84+
* Optional configuration settings.
85+
* @return
86+
* The new client instance.
87+
*/
88+
export function initialize(clientSideId: string, options?: LDOptions): LDClient {
5689
// AutoEnvAttributes are not supported yet in the browser SDK.
5790
return new BrowserClient(clientSideId, AutoEnvAttributes.Disabled, options);
5891
}
92+
93+
/**
94+
* Provides a simple {@link LDLogger} implementation.
95+
*
96+
* This logging implementation uses a simple format that includes only the log level
97+
* and the message text. By default, output is written to `console` methods (`console.info`
98+
* for normal informational messages, `console.warn` for warnings, `console.error` for
99+
* errors, and `console.log` for debug output) and the default minimum level is `info`
100+
* (that is, debug output is suppressed). You can filter by log level or change the output
101+
* destination with [[BasicLoggerOptions]].
102+
*
103+
* To use the logger created by this function, put it into [[LDOptions.logger]]. If
104+
* you do not set [[LDOptions.logger]] to anything, the SDK uses a default logger
105+
* that is equivalent to `ld.basicLogger({ level: 'info' })`.
106+
*
107+
* @param options Configuration for the logger. If no options are specified, the
108+
* logger uses `{ level: 'info' }`.
109+
*
110+
* @example
111+
* This example shows how to use `basicLogger` in your SDK options to enable console
112+
* logging only at `warn` and `error` levels.
113+
* ```javascript
114+
* const ldOptions = {
115+
* logger: ld.basicLogger({ level: 'warn' }),
116+
* };
117+
* ```
118+
*/
119+
export function basicLogger(options: BasicLoggerOptions): LDLogger {
120+
return new BasicLogger(options);
121+
}

release-please-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
},
2929
"packages/store/node-server-sdk-dynamodb": {},
3030
"packages/store/node-server-sdk-redis": {},
31-
"packages/telemetry/node-server-sdk-otel": {}
31+
"packages/telemetry/node-server-sdk-otel": {},
32+
"packages/sdk/browser": {}
3233
},
3334
"plugins": [
3435
{

0 commit comments

Comments
 (0)