Skip to content

Commit

Permalink
feat: created build script
Browse files Browse the repository at this point in the history
  • Loading branch information
celsodias12 committed Mar 26, 2023
1 parent fbd4df2 commit cb25251
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,5 @@ dist
.pnp.*

*.class

output
37 changes: 37 additions & 0 deletions package/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

check_if_dependencies_installed() {
local readonly dependencies=('shc')

for dependency in "${dependencies[@]}"; do
if (! [ -x "$(command -v $dependency)" ]); then
echo "error: $dependency is not installed"
exit 1
fi
done

}

build() {
local readonly package_filename='watch-files-changes'
local readonly current_path="$PWD"

shc -f "$current_path/$package_filename.sh"

if [ -f $package_filename.sh.x ]; then
local readonly output_folder='./output'

if [ ! -d "$output_folder" ]; then
mkdir "$output_folder"
fi

sleep 0.5

rm "$package_filename.sh.x.c"

mv "$package_filename.sh.x" "$output_folder/$package_filename"
fi
}

check_if_dependencies_installed &&
build
2 changes: 1 addition & 1 deletion package/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ check_if_package_dependencies_installed() {

for i in "${dependencies[@]}"; do
if (! [ -x "$(command -v $i)" ]); then
echo "Error: $i is not installed"
echo "error: $i is not installed"
exit 1
fi
done
Expand Down
2 changes: 1 addition & 1 deletion watch-files-changes.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/bash

trap "exit" INT TERM ERR
trap "kill 0" EXIT
Expand Down

0 comments on commit cb25251

Please sign in to comment.