Skip to content

Commit 8b967a5

Browse files
authored
chore: Prepare for browser client releases. (#612)
1 parent 7b68c71 commit 8b967a5

File tree

8 files changed

+69
-14
lines changed

8 files changed

+69
-14
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.23",
1313
"packages/shared/sdk-client": "1.9.0",
1414
"packages/sdk/react-native": "10.8.0",
15-
"packages/telemetry/node-server-sdk-otel": "1.0.15"
15+
"packages/telemetry/node-server-sdk-otel": "1.0.15",
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/contract-tests/entity/src/ClientEntity.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { init, LDClient, LDLogger, LDOptions } from '@launchdarkly/js-client-sdk';
1+
import { initialize, LDClient, LDLogger, LDOptions } from '@launchdarkly/js-client-sdk';
22

33
import { CommandParams, CommandType, ValueType } from './CommandParams';
44
import { CreateInstanceParams, SDKConfigParams } from './ConfigParams';
@@ -19,7 +19,6 @@ function makeSdkConfig(options: SDKConfigParams, tag: string) {
1919
withReasons: options.clientSide.evaluationReasons,
2020
logger: makeLogger(`${tag}.sdk`),
2121
// useReport: options.clientSide.useReport,
22-
// sendEventsOnlyForVariation: true,
2322
};
2423

2524
if (options.serviceEndpoints) {
@@ -198,7 +197,7 @@ export async function newSdkClientEntity(options: CreateInstanceParams) {
198197
options.configuration.clientSide?.initialUser ||
199198
options.configuration.clientSide?.initialContext ||
200199
makeDefaultInitialContext();
201-
const client = init(options.configuration.credential || 'unknown-env-id', sdkConfig);
200+
const client = initialize(options.configuration.credential || 'unknown-env-id', sdkConfig);
202201
let failed = false;
203202
try {
204203
await Promise.race([

packages/sdk/browser/contract-tests/entity/src/main.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
import './style.css';
33
import TestHarnessWebSocket from './TestHarnessWebSocket';
44

5-
// const client = init('618959580d89aa15579acf1d', AutoEnvAttributes.Enabled);
6-
75
async function runContractTests() {
86
const ws = new TestHarnessWebSocket('ws://localhost:8001');
97
ws.connect();

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: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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,
315
EvaluationSeriesContext,
@@ -52,7 +64,23 @@ export type {
5264
IdentifySeriesStatus,
5365
};
5466

55-
export function init(clientSideId: string, options?: LDOptions): LDClient {
67+
/**
68+
* Creates an instance of the LaunchDarkly client.
69+
*
70+
* Usage:
71+
* ```
72+
* import { initialize } from 'launchdarkly-js-client-sdk';
73+
* const client = initialize(envKey, context, options);
74+
* ```
75+
*
76+
* @param clientSideId
77+
* The client-side id, also known as the environment ID.
78+
* @param options
79+
* Optional configuration settings.
80+
* @return
81+
* The new client instance.
82+
*/
83+
export function initialize(clientSideId: string, options?: LDOptions): LDClient {
5684
// AutoEnvAttributes are not supported yet in the browser SDK.
5785
return new BrowserClient(clientSideId, AutoEnvAttributes.Disabled, options);
5886
}

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)