-
Notifications
You must be signed in to change notification settings - Fork 31
feat: JSR support for Cloudflare SDK. #415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ild to latest version. Set cf sdk to jsr.
|
This pull request has been linked to Shortcut Story #236785: Investigate publishing to JSR. |
| import { name, version } from '../package.json'; | ||
| // @ts-ignore | ||
| // eslint-disable-next-line prettier/prettier | ||
| import * as packageJson from '../package.json' assert { type: "json" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This import assertion is new-ish and is not yet fully supported by jest and prettier. I took a shortcut here and ignore this for now to save time. Hopefully in time we can just remove these ignores.
| "@cloudflare/workers-types": "^4.20230321.0", | ||
| "@types/jest": "^29.5.5", | ||
| "esbuild": "^0.14.41", | ||
| "esbuild": "0.20.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentionally pinned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've carot'd it.
| .vscode | ||
| **/*/CHANGELOG.md | ||
| packages/sdk/akamai-edgekv/src/edgekv/edgekv.js | ||
| packages/sdk/cloudflare/src/createPlatformInfo.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trivago/prettier-plugin-sort-imports doesn't like the new-ish import assertion syntax. See my comments here.
| "@cloudflare/workers-types": "^4.20230321.0", | ||
| "@types/jest": "^29.5.5", | ||
| "esbuild": "^0.14.41", | ||
| "esbuild": "0.20.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the latest version of esbuild to get import assertion support.
| export default { | ||
| async fetch(request: Request, env: Bindings, ctx: ExecutionContext): Promise<Response> { | ||
| const clientSideID = 'test-client-side-id'; | ||
| const clientSideID = 'test-sdk-key'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was inconsistent with the README so it's kinda like a bugfix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the jsr equivalent of package.json. It's used during publishing. The version is hardcoded atm, but I'll submit a separate PR to implement publishing through release-please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JSR publish command complained about these so I corrected them.
| @@ -0,0 +1,9 @@ | |||
| { | |||
| "name": "@launchdarkly/cloudflare-server-sdk", | |||
| "version": "0.0.3", | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Release please will need to be able to update this. If it is fine for it to re-write the file each time, then you can use the JSON updater.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be like this.
{
"extra-files": [
{
"type": "json",
"path": "jsr.json",
"jsonpath": "$.version"
}
]
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you are right. I was going to submit a separate PR for the RP work. Maybe i'll just do it together in this PR now that you mentioned it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will do this in a separate pr focussed on publishing in CI.
| 5. Edit [index.ts](https://github.com/launchdarkly/js-core/blob/main/packages/sdk/cloudflare/example/src/index.ts#L6) to use your clientSideID and a valid flag key from the test data you just inserted. | ||
|
|
||
| ```ts | ||
| const clientSideID = 'test-sdk-key'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My assumption is that there is clear documentation somewhere explaining this (as SDK Key is the terminology we typically use for Server-Side) - we need the Client-side ID for the events here, is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need the clientSideID yes. I will correct them all to clientSideID to be consistent.
🤖 I have created a release *beep* *boop* --- <details><summary>akamai-edgeworker-sdk-common: 1.1.3</summary> ## [1.1.3](akamai-edgeworker-sdk-common-v1.1.2...akamai-edgeworker-sdk-common-v1.1.3) (2024-04-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from ^2.2.2 to ^2.2.3 </details> <details><summary>akamai-server-base-sdk: 2.1.3</summary> ## [2.1.3](akamai-server-base-sdk-v2.1.2...akamai-server-base-sdk-v2.1.3) (2024-04-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^1.1.2 to ^1.1.3 * @launchdarkly/js-server-sdk-common bumped from ^2.2.2 to ^2.2.3 </details> <details><summary>akamai-server-edgekv-sdk: 1.1.3</summary> ## [1.1.3](akamai-server-edgekv-sdk-v1.1.2...akamai-server-edgekv-sdk-v1.1.3) (2024-04-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^1.1.2 to ^1.1.3 * @launchdarkly/js-server-sdk-common bumped from ^2.2.2 to ^2.2.3 </details> <details><summary>cloudflare-server-sdk: 2.5.0</summary> ## [2.5.0](cloudflare-server-sdk-v2.4.2...cloudflare-server-sdk-v2.5.0) (2024-04-09) ### Features * JSR support for Cloudflare SDK. ([#415](#415)) ([30866f3](30866f3)) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/js-server-sdk-common-edge bumped from 2.2.2 to 2.2.3 </details> <details><summary>js-client-sdk-common: 1.1.0</summary> ## [1.1.0](js-client-sdk-common-v1.0.3...js-client-sdk-common-v1.1.0) (2024-04-09) ### Features * Add identify timeout to client-sdk. ([#420](#420)) ([5d73dfe](5d73dfe)) ### Bug Fixes * Identify incorrectly rejected in client-sdk ([#426](#426)) ([a019dd6](a019dd6)) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-sdk-common bumped from 2.3.1 to 2.4.0 </details> <details><summary>js-sdk-common: 2.4.0</summary> ## [2.4.0](js-sdk-common-v2.3.1...js-sdk-common-v2.4.0) (2024-04-09) ### Features * Add identify timeout to client-sdk. ([#420](#420)) ([5d73dfe](5d73dfe)) ### Bug Fixes * Identify incorrectly rejected in client-sdk ([#426](#426)) ([a019dd6](a019dd6)) </details> <details><summary>js-server-sdk-common: 2.2.3</summary> ## [2.2.3](js-server-sdk-common-v2.2.2...js-server-sdk-common-v2.2.3) (2024-04-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-sdk-common bumped from 2.3.1 to 2.4.0 </details> <details><summary>js-server-sdk-common-edge: 2.2.3</summary> ## [2.2.3](js-server-sdk-common-edge-v2.2.2...js-server-sdk-common-edge-v2.2.3) (2024-04-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from 2.2.2 to 2.2.3 </details> <details><summary>node-server-sdk: 9.2.3</summary> ## [9.2.3](node-server-sdk-v9.2.2...node-server-sdk-v9.2.3) (2024-04-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from 2.2.2 to 2.2.3 </details> <details><summary>node-server-sdk-dynamodb: 6.1.6</summary> ## [6.1.6](node-server-sdk-dynamodb-v6.1.5...node-server-sdk-dynamodb-v6.1.6) (2024-04-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/node-server-sdk bumped from 9.2.2 to 9.2.3 * peerDependencies * @launchdarkly/node-server-sdk bumped from 9.2.1 to 9.2.3 </details> <details><summary>node-server-sdk-redis: 4.1.6</summary> ## [4.1.6](node-server-sdk-redis-v4.1.5...node-server-sdk-redis-v4.1.6) (2024-04-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/node-server-sdk bumped from 9.2.2 to 9.2.3 * peerDependencies * @launchdarkly/node-server-sdk bumped from 9.2.1 to 9.2.3 </details> <details><summary>react-native-client-sdk: 10.1.0</summary> ## [10.1.0](react-native-client-sdk-v10.0.5...react-native-client-sdk-v10.1.0) (2024-04-09) ### Features * Add identify timeout to client-sdk. ([#420](#420)) ([5d73dfe](5d73dfe)) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-client-sdk-common bumped from 1.0.3 to 1.1.0 </details> <details><summary>vercel-server-sdk: 1.3.4</summary> ## [1.3.4](vercel-server-sdk-v1.3.3...vercel-server-sdk-v1.3.4) (2024-04-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common-edge bumped from 2.2.2 to 2.2.3 </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Yusinto Ngadiman <yusinto@gmail.com>
No description provided.