-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a650a22
commit 14a6344
Showing
1 changed file
with
11 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,26 @@ | ||
#!/usr/bin/env bash | ||
set -xe | ||
|
||
yarn purs-backend-es bundle-app --main Fluid --to dist/fluid/fluid.mjs --platform=node | ||
|
||
FLUID_EXECUTABLE="dist/fluid/fluid.mjs" | ||
|
||
yarn purs-backend-es bundle-app --main Fluid --to $FLUID_EXECUTABLE --platform=node | ||
yarn purs-backend-es bundle-app --main Test.Fluid --to dist/test/fluid/fluid.mjs --platform=node | ||
|
||
FILE="./dist/fluid/fluid.mjs" | ||
|
||
# Shebang line to add | ||
|
||
SHEBANG="#!/usr/bin/env node" | ||
|
||
# Check if the file exists | ||
if [[ ! -f "$FILE" ]]; then | ||
echo "Error: File $FILE not found." | ||
if [[ ! -f "$FLUID_EXECUTABLE" ]]; then | ||
echo "Error: File $FLUID_EXECUTABLE not found." | ||
exit 1 | ||
fi | ||
|
||
# Check if the shebang is already present | ||
if [[ $(head -n 1 "$FILE") != "$SHEBANG" ]]; then | ||
# Prepend the shebang | ||
echo "Adding shebang to $FILE" | ||
{ echo "$SHEBANG"; cat "$FILE"; } > "$FILE.tmp" && mv "$FILE.tmp" "$FILE" | ||
else | ||
echo "Shebang already present in $FILE" | ||
if [[ $(head -n 1 "$FLUID_EXECUTABLE") != "$SHEBANG" ]]; then | ||
{ echo "$SHEBANG"; cat "$FLUID_EXECUTABLE"; } > "$FLUID_EXECUTABLE.tmp" && mv "$FLUID_EXECUTABLE.tmp" "$FLUID_EXECUTABLE" | ||
fi | ||
|
||
# Ensure the file is executable | ||
chmod +x "$FILE" | ||
echo "File $FILE is now executable." | ||
chmod +x "$FLUID_EXECUTABLE" | ||
|
||
cp -r fluid dist/fluid | ||
cp -r fluid dist/fluid |