-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
68b55ce
commit 6790048
Showing
3 changed files
with
162 additions
and
10 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env bash | ||
|
||
if ! command -v npm &> /dev/null | ||
then | ||
echo "npm could not be found. Executing 'nvm use 18'" | ||
nvm use 18 | ||
fi | ||
|
||
unameOut="$(uname -s)" | ||
case "${unameOut}" in | ||
Linux*) platform=Linux;; | ||
Darwin*) platform=Mac;; | ||
*) platform="${unameOut}" | ||
esac | ||
|
||
echo "Detected platform: ${platform}" | ||
|
||
if [ "${platform}" == "Linux" ]; then | ||
echo "Building Tauri app for Linux..." | ||
npx tauri build -c src-tauri/tauri.conf.linux-x64.json5 --target x86_64-unknown-linux-gnu | ||
elif [ "${platform}" == "Mac" ]; then | ||
echo "Building Tauri app for Mac..." | ||
npx tauri build -c src-tauri/tauri.conf.macos.json5 --target aarch64-apple-darwin | ||
fi | ||
|
||
|
||
# CHANGE Port | ||
|
||
# Windows: | ||
# npx tauri build -c src-tauri/tauri.conf.win-x64.json5 --target x86_64-pc-windows-msvc | ||
|
||
# Linux: | ||
# npx tauri build -c src-tauri/tauri.conf.linux-x64.json5 --target x86_64-unknown-linux-gnu | ||
# Had to zip a standalone: zip -r "standalone.zip" "netpad-vnext" "resources" | ||
|
||
# macOS x64: | ||
# npx tauri build -c src-tauri/tauri.conf.mac-x64.json5 --target x86_64-apple-darwin | ||
|
||
# macOS arm64: | ||
# npx tauri build -c src-tauri/tauri.conf.mac-arm64.json5 --target aarch64-apple-darwin |
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
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 |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o nounset | ||
set -o errexit | ||
|
||
RED="\033[0;31m" | ||
GREEN="\033[0;32m" | ||
LCYAN="\033[1;36m" | ||
NC="\033[0m" | ||
|
||
if ! command -v dotnet &> /dev/null; then | ||
echo "Could not find 'dotnet'." | ||
exit 1 | ||
fi | ||
|
||
if ! command -v npm &> /dev/null; then | ||
echo "Could not find 'npm'." | ||
exit 1 | ||
fi | ||
|
||
if ! command -v cargo &> /dev/null; then | ||
echo "Could not find 'cargo'." | ||
exit 1 | ||
fi | ||
|
||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) | ||
APP_DIR=$(cd "$SCRIPT_DIR/../src/Apps/NetPad.Apps.Shells.Tauri/TauriApp" && pwd) | ||
SPA_APP_DIR=$(cd "$SCRIPT_DIR/../src/Apps/NetPad.Apps.App/App" && pwd) | ||
PACKAGES_SOURCE_DIR="$APP_DIR/src-tauri/target/x86_64-unknown-linux-gnu/release" | ||
PACKAGES_DEST_DIR="$SCRIPT_DIR/../dist/tauri" | ||
|
||
if [ -z "$SCRIPT_DIR" ]; then | ||
echo "Could not determine script dir" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$APP_DIR" ]; then | ||
echo "Could not determine app dir" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$SPA_APP_DIR" ]; then | ||
echo "Could not determine SPA app dir" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$PACKAGES_DEST_DIR" ]; then | ||
echo "Could not determine destination package dir" | ||
exit 1 | ||
fi | ||
|
||
printf "%b" "${GREEN}# SCRIPT_DIR:${NC} $SCRIPT_DIR\n" | ||
printf "%b" "${GREEN}# APP_DIR:${NC} $APP_DIR\n" | ||
printf "%b" "${GREEN}# SPA_APP_DIR:${NC} $SPA_APP_DIR\n" | ||
printf "%b" "${GREEN}# PACKAGES_SOURCE_DIR:${NC} $PACKAGES_DEST_DIR\n" | ||
printf "%b" "${GREEN}# PACKAGES_DEST_DIR:${NC} $PACKAGES_DEST_DIR\n" | ||
|
||
# Create the DEST directory | ||
# if [[ "$clean" == "true" ]]; then | ||
# rm -rf "$PACKAGES_DEST_DIR" | ||
# fi | ||
|
||
mkdir -p "$PACKAGES_DEST_DIR" | ||
|
||
print_section_div() { | ||
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = | ||
} | ||
|
||
copy() { | ||
local dir="$1" | ||
|
||
for filename in "$dir"/*; do | ||
if [[ -d $filename ]]; then | ||
continue | ||
fi | ||
|
||
if [[ $filename != *.zip ]] && [[ $filename != *.pacman ]] && [[ $filename != *.AppImage ]] && [[ $filename != *.deb ]] && [[ $filename != *.rpm ]] && [[ $filename != *.flatpak ]] && [[ $filename != *.snap ]]; then | ||
continue | ||
fi | ||
|
||
echo " - Copying: $filename" | ||
mv "$filename" "$PACKAGES_DEST_DIR/" | ||
done | ||
} | ||
|
||
# Ensure npm packages are installed | ||
printf "\n1. ${LCYAN}Installing npm packages in: $APP_DIR${NC}\n" | ||
npm install --prefix "$APP_DIR" | ||
print_section_div | ||
|
||
printf "\n2. ${LCYAN}Installing npm packages in: $SPA_APP_DIR${NC}\n" | ||
npm install --prefix "$SPA_APP_DIR" | ||
print_section_div | ||
|
||
cd "$APP_DIR" | ||
|
||
printf "\n3. ${LCYAN}Packaging Tauri app${NC}\n" | ||
#npx tauri build -c src-tauri/tauri.conf.linux-x64.json5 --target x86_64-unknown-linux-gnu | ||
print_section_div | ||
|
||
printf "\n4. ${LCYAN}Copying generated bundles${NC}\n" | ||
copy "$PACKAGES_SOURCE_DIR/bundle/deb" | ||
copy "$PACKAGES_SOURCE_DIR/bundle/rpm" | ||
print_section_div | ||
|
||
printf "\n5. ${LCYAN}Zipping standalone app${NC}\n" | ||
cd "$PACKAGES_SOURCE_DIR" | ||
zip -q -r "$PACKAGES_DEST_DIR/NetPad-vNext-0.8.0-linux-x86_64.zip" "NetPad vNext" "resources" | ||
cd "$APP_DIR" | ||
print_section_div | ||
|
||
cd "$SCRIPT_DIR" |