-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathupdate_node_examples.sh
More file actions
executable file
·70 lines (61 loc) · 3.21 KB
/
Copy pathupdate_node_examples.sh
File metadata and controls
executable file
·70 lines (61 loc) · 3.21 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
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
set -eufx -o pipefail
NEW_VERSION=$1
SELF_PATH=${BASH_SOURCE[0]:-"$(command -v -- "$0")"}
PROJECT_ROOT="$(dirname "$SELF_PATH")/.."
function bump_restate_sdk_deps() {
pushd $1
local project_dir=$1
local package_json="./package.json"
# Check if package.json exists
if [ ! -f "$package_json" ]; then
echo "No package.json found in $project_dir"
return
fi
# Extract dependencies that start with @restatedev/restate-sdk
local deps=$(node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('$package_json', 'utf8'));
const deps = pkg.dependencies || {};
const restateDeps = Object.keys(deps).filter(dep => dep.startsWith('@restatedev/restate-sdk'));
console.log(restateDeps.join(' '));
")
# Install each dependency with the new version
for dep in $deps; do
echo "Installing $dep@^$NEW_VERSION in $project_dir"
npm install $dep@^$NEW_VERSION
done
# If this is a template directory and has existing agents documentation, update it
if [[ "$project_dir" == *"/templates/"* ]] && [ -f "./.cursor/rules/AGENTS.md" ]; then
echo "Updating agents documentation for template in $project_dir"
wget -O "./.cursor/rules/AGENTS.md" https://docs.restate.dev/develop/ts/agents.md
fi
if [[ "$project_dir" == *"/templates/"* ]] && [ -f "./.claude/CLAUDE.md" ]; then
echo "Updating agents documentation for template in $project_dir"
wget -O "./.claude/CLAUDE.md" https://docs.restate.dev/develop/ts/agents.md
fi
popd
}
# Update all projects with package.json
bump_restate_sdk_deps $PROJECT_ROOT/typescript/basics
bump_restate_sdk_deps $PROJECT_ROOT/typescript/templates/node
bump_restate_sdk_deps $PROJECT_ROOT/typescript/templates/lambda
bump_restate_sdk_deps $PROJECT_ROOT/typescript/templates/typescript-testing
bump_restate_sdk_deps $PROJECT_ROOT/typescript/templates/bun
bump_restate_sdk_deps $PROJECT_ROOT/typescript/templates/nextjs
bump_restate_sdk_deps $PROJECT_ROOT/typescript/templates/vercel
bump_restate_sdk_deps $PROJECT_ROOT/typescript/templates/cloudflare-worker
bump_restate_sdk_deps $PROJECT_ROOT/typescript/integrations/deployment-lambda-cdk
bump_restate_sdk_deps $PROJECT_ROOT/typescript/integrations/opentelemetry
bump_restate_sdk_deps $PROJECT_ROOT/typescript/tutorials/tour-of-orchestration-typescript
bump_restate_sdk_deps $PROJECT_ROOT/typescript/tutorials/tour-of-workflows-typescript
bump_restate_sdk_deps $PROJECT_ROOT/typescript/patterns-use-cases
bump_restate_sdk_deps $PROJECT_ROOT/typescript/end-to-end-applications/ai-image-workflows
bump_restate_sdk_deps $PROJECT_ROOT/typescript/end-to-end-applications/food-ordering/app
bump_restate_sdk_deps $PROJECT_ROOT/typescript/end-to-end-applications/food-ordering/webui
bump_restate_sdk_deps $PROJECT_ROOT/typescript/end-to-end-applications/chat-bot
# deno bump - it doesn't use a package.json, only import strings
# -i works differently in gnu sed and mac (bsd) sed - best avoided
tmp=$(mktemp)
sed "s#\"npm:@restatedev/restate-sdk@^.*/fetch\"#\"npm:@restatedev/restate-sdk@^${NEW_VERSION}/fetch\"#g" $PROJECT_ROOT/typescript/templates/deno/main.ts > $tmp
mv $tmp $PROJECT_ROOT/typescript/templates/deno/main.ts