forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupgrade-express.sh
More file actions
57 lines (37 loc) · 1.84 KB
/
Copy pathupgrade-express.sh
File metadata and controls
57 lines (37 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
source scripts/qa/lib/bash/prelude.sh
# Create the next app in /tmp
UPGRADE_EXPRESS_PATH="/tmp/upgrade-express"
rm -rf $UPGRADE_EXPRESS_PATH
echo "Creating express app for testing upgrade in $UPGRADE_EXPRESS_PATH"
mkdir -p $UPGRADE_EXPRESS_PATH
npx create-next-app $UPGRADE_EXPRESS_PATH --ts --eslint --use-npm --no-tailwind --src-dir --app --import-alias="@/*"
echo "Fetching released versions of CopilotKit packages..."
released_packages=$(get_latest_copilotkit_versions)
echo "Latest released versions: $released_packages"
# write to .env
echo "OPENAI_API_KEY=$OPENAI_API_KEY" > $UPGRADE_EXPRESS_PATH/.env
(cd $UPGRADE_EXPRESS_PATH && npm install $released_packages --save)
(cd $UPGRADE_EXPRESS_PATH && npm install express)
(cd $UPGRADE_EXPRESS_PATH && npm i --save-dev @types/express)
echo "Using released CopilotKit packages: $released_packages"
echo "Testing upgrading to pre-release versions: $packages"
(cd $UPGRADE_EXPRESS_PATH && npm install -D typescript ts-node @types/node)
cp scripts/qa/lib/upgrade-express/old/page.tsx $UPGRADE_EXPRESS_PATH/src/app/page.tsx
cp scripts/qa/lib/upgrade-express/old/server.ts $UPGRADE_EXPRESS_PATH/server.ts
jq '. * {
"ts-node": {
"compilerOptions": {
"module": "commonjs"
}
}
}' $UPGRADE_EXPRESS_PATH/tsconfig.json > $UPGRADE_EXPRESS_PATH/temp.json && mv $UPGRADE_EXPRESS_PATH/temp.json $UPGRADE_EXPRESS_PATH/tsconfig.json
prompt "Check server.ts and page.tsx. Are they without errors in VSCode?"
echo "Upgrading packages"
(cd $UPGRADE_EXPRESS_PATH && npm install $packages --save)
cp scripts/qa/lib/upgrade-express/new/page.tsx $UPGRADE_EXPRESS_PATH/src/app/page.tsx
cp scripts/qa/lib/upgrade-express/new/server.ts $UPGRADE_EXPRESS_PATH/server.ts
prompt "Check server.ts and page.tsx again. Are they without errors in VSCode?"
echo "now run ts-node server.ts to test"
cleanup;
exit 0;