Skip to content

Commit

Permalink
fix: Include name and version in platform. (#453)
Browse files Browse the repository at this point in the history
This embeds the package name and version directly into the source
instead of attempting to import the package.json. This has greater
compatibility and depends on release-please to update the version.
  • Loading branch information
kinyoklion authored Apr 29, 2024
1 parent 5bfeaba commit 3b4e212
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
9 changes: 3 additions & 6 deletions packages/sdk/cloudflare/src/createPlatformInfo.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import type { Info, PlatformData, SdkData } from '@launchdarkly/js-server-sdk-common-edge';

// @ts-ignore
// eslint-disable-next-line prettier/prettier
import * as packageJson from '../package.json' assert { type: "json" }

const { name, version } = packageJson
const name = '@launchdarkly/cloudflare-server-sdk';
const version = '2.5.3'; // x-release-please-version

class CloudflarePlatformInfo implements Info {
platformData(): PlatformData {
Expand All @@ -22,6 +19,6 @@ class CloudflarePlatformInfo implements Info {
}
}

const createPlatformInfo = (): CloudflarePlatformInfo => new CloudflarePlatformInfo()
const createPlatformInfo = (): CloudflarePlatformInfo => new CloudflarePlatformInfo();

export default createPlatformInfo;
3 changes: 2 additions & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"type": "json",
"path": "jsr.json",
"jsonpath": "$.version"
}
},
"src/createPlatformInfo.ts"
]
},
"packages/sdk/react-native": {},
Expand Down

0 comments on commit 3b4e212

Please sign in to comment.