Skip to content

Commit 7e453cc

Browse files
committed
Fix bundling errors
1 parent 2a04ff5 commit 7e453cc

File tree

9 files changed

+190
-11
lines changed

9 files changed

+190
-11
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Publish TypeScript Telemetry
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
publish:
10+
name: Build and Publish
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '22'
21+
registry-url: 'https://registry.npmjs.org'
22+
23+
- name: Install pnpm
24+
uses: pnpm/action-setup@v2
25+
with:
26+
version: 9
27+
28+
- name: Get pnpm store directory
29+
shell: bash
30+
run: |
31+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
32+
33+
- name: Setup pnpm cache
34+
uses: actions/cache@v3
35+
with:
36+
path: ${{ env.STORE_PATH }}
37+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
38+
restore-keys: |
39+
${{ runner.os }}-pnpm-store-
40+
41+
- name: Get package version
42+
id: get_version
43+
run: |
44+
CURRENT_VERSION=$(node -p "require('./packages/telemetry/typescript/package.json').version")
45+
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
46+
47+
- name: Check version on npm
48+
id: check_version
49+
run: |
50+
NPM_VERSION=$(npm view @latitude-data/telemetry version 2>/dev/null || echo "0.0.0")
51+
if [ "${{ steps.get_version.outputs.version }}" != "$NPM_VERSION" ]; then
52+
echo "should_publish=true" >> $GITHUB_OUTPUT
53+
else
54+
echo "should_publish=false" >> $GITHUB_OUTPUT
55+
fi
56+
57+
- name: Install dependencies
58+
if: steps.check_version.outputs.should_publish == 'true'
59+
run: pnpm install --filter=@latitude-data/telemetry...
60+
61+
- name: Build package (with workspace dependencies)
62+
if: steps.check_version.outputs.should_publish == 'true'
63+
run: pnpm exec turbo run build --filter=@latitude-data/telemetry...
64+
65+
- name: Run linter
66+
if: steps.check_version.outputs.should_publish == 'true'
67+
run: pnpm exec turbo run lint --filter=@latitude-data/telemetry...
68+
69+
- name: Run typescript checker
70+
if: steps.check_version.outputs.should_publish == 'true'
71+
run: pnpm exec turbo run tc --filter=@latitude-data/telemetry...
72+
73+
- name: Run tests
74+
if: steps.check_version.outputs.should_publish == 'true'
75+
run: pnpm exec turbo run test --filter=@latitude-data/telemetry...
76+
77+
- name: Publish to npm
78+
if: steps.check_version.outputs.should_publish == 'true'
79+
run: pnpm publish --access public --filter=@latitude-data/telemetry --no-git-checks
80+
81+
env:
82+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

apps/gateway/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"@latitude-data/constants": "workspace:^",
2323
"@latitude-data/core": "workspace:^",
2424
"@latitude-data/env": "workspace:^",
25+
"@latitude-data/telemetry": "workspace:*",
2526
"@latitude-data/sdk": "workspace:^",
2627
"@sentry/cli": "2.37.0",
2728
"@sentry/node": "9.9.0",

apps/web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"@latitude-data/constants": "workspace:*",
2323
"@latitude-data/core": "workspace:*",
2424
"@latitude-data/env": "workspace:^",
25+
"@latitude-data/telemetry": "workspace:*",
2526
"@latitude-data/sdk": "workspace:^",
2627
"@latitude-data/socket.io-react-hook": "2.4.5",
2728
"@latitude-data/web-ui": "workspace:*",

apps/websockets/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"dependencies": {
1616
"@latitude-data/core": "workspace:^",
1717
"@latitude-data/env": "workspace:^",
18+
"@latitude-data/telemetry": "workspace:*",
1819
"cookie-parser": "1.4.6",
1920
"express": "4.21.0",
2021
"socket.io": "4.7.5"

apps/workers/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@bull-board/express": "6.7.9",
1919
"@latitude-data/core": "workspace:^",
2020
"@latitude-data/env": "workspace:^",
21+
"@latitude-data/telemetry": "workspace:*",
2122
"@sentry/cli": "2.37.0",
2223
"@sentry/node": "9.9.0",
2324
"@t3-oss/env-core": "*",

packages/sdks/python/README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ await sdk.prompts.run("joke-teller", RunPromptOptions(
2727
))
2828
```
2929

30-
Find more [examples](https://github.com/latitude-dev/latitude-llm/tree/main/examples/sdks/python).
30+
Find more [examples](https://docs.latitude.so/examples/sdk).
3131

3232
## Development
3333

@@ -41,7 +41,9 @@ Requires uv `0.5.10` or higher.
4141
- Build package: `uv build`
4242
- Publish package: `uv publish`
4343

44-
## Run only one test
44+
### Running only a specific test
45+
46+
Mark the test with an `only` marker:
4547

4648
```python
4749
import pytest
@@ -51,18 +53,18 @@ async def my_test(self):
5153
# ... your code
5254
```
5355

54-
And then run the tests with the marker `only`:
56+
...and then run the tests with the marker `only`:
5557

5658
```sh
5759
uv run scripts/test.py -m only
5860
```
5961

60-
Other way is all in line:
62+
Another way is to specify the test in line:
6163

6264
```python
6365
uv run scripts/test.py <test_path>::<test_case>::<test_name>
6466
```
6567

6668
## License
6769

68-
The SDK is licensed under the [LGPL-3.0 License](https://opensource.org/licenses/LGPL-3.0) - read the [LICENSE](/LICENSE) file for details.
70+
The SDK is licensed under the [MIT License](https://opensource.org/licenses/MIT) - read the [LICENSE](/LICENSE) file for details.

packages/sdks/typescript/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ Go to the [documentation](https://docs.latitude.so/guides/sdk/typescript) to lea
1010

1111
## Usage
1212

13-
### SDK Usage
14-
1513
```typescript
1614
import { Latitude, LatitudeOptions, RunPromptOptions } from '@latitude-data/sdk'
1715

@@ -29,6 +27,8 @@ await sdk.prompts.run('joke-teller', {
2927
})
3028
```
3129

30+
Find more [examples](https://docs.latitude.so/examples/sdk).
31+
3232
## Development
3333

3434
Requires npm `0.5.10` or higher.
@@ -42,4 +42,4 @@ Requires npm `0.5.10` or higher.
4242

4343
## License
4444

45-
The SDK is licensed under the [LGPL-3.0 License](https://opensource.org/licenses/LGPL-3.0) - read the [LICENSE](/LICENSE) file for details.
45+
The SDK is licensed under the [MIT License](https://opensource.org/licenses/MIT) - read the [LICENSE](/LICENSE) file for details.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Latitude Telemetry for Typescript & Javascript
2+
3+
```sh
4+
npm install @latitude-data/telemetry
5+
```
6+
7+
Requires Node.js `20` or higher.
8+
9+
Go to the [documentation](https://docs.latitude.so/guides/sdk/typescript) to learn more.
10+
11+
## Usage
12+
13+
```typescript
14+
import { LatitudeTelemetry } from '@latitude-data/telemetry'
15+
import { Latitude } from '@latitude-data/sdk'
16+
import { OpenAI } from 'openai'
17+
18+
const telemetry = new LatitudeTelemetry('my-api-key', {
19+
instrumentations: {
20+
latitude: Latitude,
21+
openai: OpenAI,
22+
},
23+
})
24+
25+
// Automatically instrumented
26+
const sdk = new Latitude('my-api-key', {
27+
projectId: 'my-project-id',
28+
versionUuid: 'my-version-uuid',
29+
})
30+
31+
// Automatically instrumented
32+
const openai = new OpenAI({
33+
apiKey: 'my-api-key',
34+
})
35+
```
36+
37+
Find more [examples](https://docs.latitude.so/examples/sdk).
38+
39+
## Development
40+
41+
Requires npm `0.5.10` or higher.
42+
43+
- Install dependencies: `npm install`
44+
- Add [dev] dependencies: `npm install <package> [--save-dev]`
45+
- Run linter: `npm run lint`
46+
- Run formatter: `npm run format`
47+
- Run tests: `npm run test`
48+
- Build package: `npm run build`
49+
50+
## License
51+
52+
The SDK is licensed under the [MIT License](https://opensource.org/licenses/MIT) - read the [LICENSE](/LICENSE) file for details.

pnpm-lock.yaml

Lines changed: 42 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)