Skip to content

Commit

Permalink
Add update:examples script
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerwins committed Jul 25, 2024
1 parent 3de5b54 commit 2004f35
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"test:ci": "vitest run --coverage",
"test:yorkie.dev": "TEST_RPC_ADDR=https://api.yorkie.dev vitest run --coverage",
"lint": "eslint . --fix --max-warnings=0 --ext .ts",
"update:examples": "./scripts/update-examples.sh",
"prepare": "npm run build"
},
"engines": {
Expand Down
17 changes: 9 additions & 8 deletions build_examples.sh → scripts/update-examples.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
#!/bin/bash

# 버전을 입력받기
# Get the version of yorkie-js-sdk
read -p "Enter the yorkie-js-sdk version: " version

# examples 폴더로 이동
# Change the directory to the examples folder
cd examples

# 모든 예제 폴더들에 대해 반복
# Loop through all example folders
for dir in */; do
# 디렉토리인지 확인하고 dist 폴더는 제외
# Check if it is a directory and exclude the dist folder
echo $dir
if [ -d "$dir" ] && [ "$dir" != "dist/" ]; then
# 예제 폴더로 이동
# Move to the example folder
cd "$dir"

# npm i와 npm run build 실행
# Execute npm i and npm run build
npm i "yorkie-js-sdk@$version" && npm run build

# 실행 결과 확인
# Check the result of the execution
if [ $? -ne 0 ]; then
echo "Error occurred in $dir"
else
echo "$dir build succeeded"
fi

# 원래 디렉토리로 돌아오기
# Move back to the examples folder
cd ..
fi
done

0 comments on commit 2004f35

Please sign in to comment.