Skip to content
This repository was archived by the owner on Aug 5, 2025. It is now read-only.

Commit 28fc8c4

Browse files
authored
feat(ops): fix Github action to publish on NPM (#45)
1 parent 6640786 commit 28fc8c4

File tree

5 files changed

+39
-4
lines changed

5 files changed

+39
-4
lines changed

.github/workflows/publish.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ jobs:
1212
needs: [tests]
1313
steps:
1414
- uses: actions/checkout@v4
15-
# Setup .npmrc file to publish to npm
1615
- uses: actions/setup-node@v3
1716
with:
1817
node-version: '19.x'

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"scripts": {
1616
"build": "tsup ./src",
1717
"test": "jest --detectOpenHandles --runInBand --watchAll=false",
18-
"prepare": "husky install"
18+
"prepare": "husky install",
19+
"release": "./release.sh"
1920
},
2021
"author": "Literal AI",
2122
"license": "Apache-2.0",

release.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#! /bin/sh
2+
3+
GREEN='\033[0;32m'
4+
YELLOW='\033[0;33m'
5+
NC='\033[0m'
6+
7+
echo "🪜 Incrementing version number"
8+
npm version patch
9+
10+
NEW_VERSION=$(npm pkg get version | tr -d '"')
11+
12+
echo "🌿 Creating release branch for v$NEW_VERSION"
13+
git checkout -b release/$NEW_VERSION
14+
git add .
15+
git commit -m "chore: bump to $NEW_VERSION"
16+
git push origin release/$NEW_VERSION
17+
18+
echo
19+
echo
20+
echo -e "----------------------------------------"
21+
echo -e "|| ${GREEN} Your release is ready for review ${NC} ||"
22+
echo -e "----------------------------------------"
23+
echo -e "1️⃣ Go to ${YELLOW}https://github.com/Chainlit/typescript-client/compare/main...release/$NEW_VERSION${NC}"
24+
echo -e "2️⃣ Create a pull request and merge it to main"
25+
echo -e "3️⃣ Go to ${YELLOW}https://github.com/Chainlit/typescript-client/actions/workflows/publish.yaml${NC}"
26+
echo -e "4️⃣ Click on 'Run workflow'"
27+
echo -e "5️⃣ Rock'n'roll 🎸"

tests/api.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ describe('End to end tests for the SDK', function () {
182182
})
183183
.send();
184184

185+
await new Promise((resolve) => setTimeout(resolve, 1000));
186+
185187
const fetchedStep = await client.api.getStep(step.id!);
186188
expect(fetchedStep?.id).toBe(step.id);
187189
expect(fetchedStep?.error).toBe('test');
@@ -214,6 +216,8 @@ describe('End to end tests for the SDK', function () {
214216
})
215217
.send();
216218

219+
await new Promise((resolve) => setTimeout(resolve, 1000));
220+
217221
const fetchedStep = await client.api.getStep(step.id!);
218222
expect(fetchedStep?.id).toBe(step.id);
219223
expect(fetchedStep?.error).toBe('test');
@@ -241,6 +245,8 @@ describe('End to end tests for the SDK', function () {
241245
throw new Error('Step id is null');
242246
}
243247

248+
await new Promise((resolve) => setTimeout(resolve, 1000));
249+
244250
const steps = await client.api.getSteps({
245251
filters: [
246252
{

tests/integration/openai.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,8 @@ describe('OpenAI Instrumentation', () => {
290290
});
291291
});
292292

293+
await new Promise((resolve) => setTimeout(resolve, 1000));
294+
293295
const {
294296
data: [step]
295297
} = await client.api.getSteps({
@@ -305,7 +307,7 @@ describe('OpenAI Instrumentation', () => {
305307

306308
expect(step?.threadId).toBe(threadId);
307309
expect(step?.parentId).toBe(parentId);
308-
});
310+
}, 30_000);
309311

310312
it("doesn't mix up threads and steps", async () => {
311313
const testId = uuidv4();
@@ -399,6 +401,6 @@ describe('OpenAI Instrumentation', () => {
399401
expect(firstGeneration?.parentId).toEqual(firstStep?.id);
400402
expect(secondGeneration?.threadId).toEqual(secondThreadId);
401403
expect(secondGeneration?.parentId).toEqual(secondStep?.id);
402-
}, 30000);
404+
}, 30_000);
403405
});
404406
});

0 commit comments

Comments
 (0)