Skip to content

Commit

Permalink
Add build.sh and entrypoint.sh for building and packing packages
Browse files Browse the repository at this point in the history
  • Loading branch information
HuakunShen committed May 23, 2024
1 parent bafc30a commit 15660a9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,4 @@ dist
# Finder (MacOS) folder config
.DS_Store
.turbo
.vscode
13 changes: 13 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
for ext in $(ls extensions); do
# Check if ext is a directory and contains package.json
if [ ! -d "extensions/$ext" ] || [ ! -f "extensions/$ext/package.json" ]; then
echo "Skipping $ext"
continue
fi
echo "Building $ext"
docker run -v $(pwd)/entrypoint.sh:/entrypoint.sh \
-v $(pwd)/extensions/$ext:/workspace \
-w /workspace --rm \
--platform=linux/amd64 \
node:20 /entrypoint.sh
done
14 changes: 14 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cd /workspace
rm *.tgz
cp -r /workspace /workspace-copy
cd /workspace-copy
npm i
npm run build
npm pack
# check number of *.tgz file in current directory
# if more than 1, then exit with error
if [ $(ls -1 *.tgz 2>/dev/null | wc -l) -gt 1 ]; then
echo "More than one tgz file found"
exit 1
fi
cp *.tgz /workspace

0 comments on commit 15660a9

Please sign in to comment.