style: Run Prettier and fix up EditorConfig issues
This commit is contained in:
140
script/build.sh
140
script/build.sh
@@ -10,16 +10,16 @@ if [ ! -d "output" ]; then
|
||||
fi
|
||||
|
||||
if [[ "$OSTYPE" =~ ^linux ]]; then
|
||||
if [ ! -d "output/linux" ]; then
|
||||
mkdir output/linux
|
||||
fi
|
||||
if [ ! -d "output/linux" ]; then
|
||||
mkdir output/linux
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||
if [ ! -d "output/macos" ]; then
|
||||
mkdir output/macos
|
||||
fi
|
||||
if [ ! -d "output/macos" ]; then
|
||||
mkdir output/macos
|
||||
fi
|
||||
fi
|
||||
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
|
||||
# total app number, ignore first line
|
||||
@@ -34,89 +34,89 @@ old_url="https://weread.qq.com/"
|
||||
package_prefix="com-tw93"
|
||||
|
||||
if [[ "$OSTYPE" =~ ^linux ]]; then
|
||||
echo "==============="
|
||||
echo "Build for Linux"
|
||||
echo "==============="
|
||||
export sd=${SHELL_FOLDER}/sd-linux-x64
|
||||
chmod +x $sd
|
||||
# for linux, package name may be com.xxx.xxx
|
||||
echo "rename package name"
|
||||
export desktop_file="src-tauri/assets/${package_prefix}.weread.desktop"
|
||||
# sed -i "s/\"productName\": \"weread\"/\"productName\": \"${package_prefix}-weread\"/g" src-tauri/tauri.conf.json
|
||||
$sd "\"productName\": \"weread\"" "\"productName\": \"${package_prefix}-weread\"" src-tauri/tauri.conf.json
|
||||
echo "==============="
|
||||
echo "Build for Linux"
|
||||
echo "==============="
|
||||
export sd=${SHELL_FOLDER}/sd-linux-x64
|
||||
chmod +x $sd
|
||||
# for linux, package name may be com.xxx.xxx
|
||||
echo "rename package name"
|
||||
export desktop_file="src-tauri/assets/${package_prefix}.weread.desktop"
|
||||
# sed -i "s/\"productName\": \"weread\"/\"productName\": \"${package_prefix}-weread\"/g" src-tauri/tauri.conf.json
|
||||
$sd "\"productName\": \"weread\"" "\"productName\": \"${package_prefix}-weread\"" src-tauri/tauri.conf.json
|
||||
|
||||
fi
|
||||
|
||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||
echo "==============="
|
||||
echo "Build for MacOS"
|
||||
echo "==============="
|
||||
echo "==============="
|
||||
echo "Build for MacOS"
|
||||
echo "==============="
|
||||
|
||||
export sd=${SHELL_FOLDER}/sd-apple-x64
|
||||
chmod +x $sd
|
||||
echo "rename package name"
|
||||
$sd "\"productName\": \"weread\"" "\"productName\": \"WeRead\"" src-tauri/tauri.conf.json
|
||||
export sd=${SHELL_FOLDER}/sd-apple-x64
|
||||
chmod +x $sd
|
||||
echo "rename package name"
|
||||
$sd "\"productName\": \"weread\"" "\"productName\": \"WeRead\"" src-tauri/tauri.conf.json
|
||||
fi
|
||||
|
||||
tail -n +2 app.csv | while IFS=, read -r -a arr;
|
||||
do
|
||||
package_name=${arr[0]}
|
||||
package_title=${arr[1]}
|
||||
package_zh_name=${arr[2]}
|
||||
url=${arr[3]}
|
||||
echo "update package name and url"
|
||||
# replace package info
|
||||
$sd ${old_url} ${url} src-tauri/tauri.conf.json
|
||||
$sd ${old_name} ${package_name} src-tauri/tauri.conf.json
|
||||
echo "update ico with 32x32 pictue"
|
||||
$sd ${old_name} ${package_name} src-tauri/src/main.rs
|
||||
package_name=${arr[0]}
|
||||
package_title=${arr[1]}
|
||||
package_zh_name=${arr[2]}
|
||||
url=${arr[3]}
|
||||
echo "update package name and url"
|
||||
# replace package info
|
||||
$sd ${old_url} ${url} src-tauri/tauri.conf.json
|
||||
$sd ${old_name} ${package_name} src-tauri/tauri.conf.json
|
||||
echo "update ico with 32x32 pictue"
|
||||
$sd ${old_name} ${package_name} src-tauri/src/main.rs
|
||||
|
||||
# for apple, need replace title
|
||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||
$sd ${old_title} ${package_title} src-tauri/tauri.conf.json
|
||||
fi
|
||||
|
||||
# echo "update ico with 32x32 pictue"
|
||||
# cp "src-tauri/png/${package_name}_32.ico" "src-tauri/icons/icon.ico"
|
||||
# for apple, need replace title
|
||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||
$sd ${old_title} ${package_title} src-tauri/tauri.conf.json
|
||||
fi
|
||||
|
||||
if [[ "$OSTYPE" =~ ^linux ]]; then
|
||||
echo "update desktop"
|
||||
old_desktop="src-tauri/assets/${package_prefix}-${old_name}.desktop"
|
||||
new_desktop="src-tauri/assets/${package_prefix}-${package_name}.desktop"
|
||||
mv ${old_desktop} ${new_desktop}
|
||||
$sd ${old_zh_name} ${package_zh_name} ${new_desktop}
|
||||
$sd ${old_name} ${package_name} ${new_desktop}
|
||||
fi
|
||||
# echo "update ico with 32x32 pictue"
|
||||
# cp "src-tauri/png/${package_name}_32.ico" "src-tauri/icons/icon.ico"
|
||||
|
||||
# update package info
|
||||
old_name=${package_name}
|
||||
old_title=${package_title}
|
||||
old_zh_name=${package_zh_name}
|
||||
old_url=${url}
|
||||
if [[ "$OSTYPE" =~ ^linux ]]; then
|
||||
echo "update desktop"
|
||||
old_desktop="src-tauri/assets/${package_prefix}-${old_name}.desktop"
|
||||
new_desktop="src-tauri/assets/${package_prefix}-${package_name}.desktop"
|
||||
mv ${old_desktop} ${new_desktop}
|
||||
$sd ${old_zh_name} ${package_zh_name} ${new_desktop}
|
||||
$sd ${old_name} ${package_name} ${new_desktop}
|
||||
fi
|
||||
|
||||
echo "building package ${index}/${total}"
|
||||
echo "package name is ${package_name} (${package_zh_name})"
|
||||
npm run tauri build
|
||||
echo "package build success!"
|
||||
index=$(($index+1))
|
||||
# update package info
|
||||
old_name=${package_name}
|
||||
old_title=${package_title}
|
||||
old_zh_name=${package_zh_name}
|
||||
old_url=${url}
|
||||
|
||||
if [[ "$OSTYPE" =~ ^linux ]]; then
|
||||
mv src-tauri/target/release/bundle/deb/*.deb output/linux
|
||||
fi
|
||||
echo "building package ${index}/${total}"
|
||||
echo "package name is ${package_name} (${package_zh_name})"
|
||||
npm run tauri build
|
||||
echo "package build success!"
|
||||
index=$(($index+1))
|
||||
|
||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||
mv src-tauri/target/release/bundle/dmg/*.dmg output/macos
|
||||
echo ""
|
||||
fi
|
||||
if [[ "$OSTYPE" =~ ^linux ]]; then
|
||||
mv src-tauri/target/release/bundle/deb/*.deb output/linux
|
||||
fi
|
||||
|
||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||
mv src-tauri/target/release/bundle/dmg/*.dmg output/macos
|
||||
echo ""
|
||||
fi
|
||||
done
|
||||
|
||||
echo "build all package success!"
|
||||
if [[ "$OSTYPE" =~ ^linux ]]; then
|
||||
echo "result file in output/linux"
|
||||
echo "result file in output/linux"
|
||||
fi
|
||||
|
||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||
# replace again
|
||||
$sd "\"productName\": \"WeRead\"" "\"productName\": \"weread\"" src-tauri/tauri.conf.json
|
||||
echo "result file in output/macos"
|
||||
fi
|
||||
# replace again
|
||||
$sd "\"productName\": \"WeRead\"" "\"productName\": \"weread\"" src-tauri/tauri.conf.json
|
||||
echo "result file in output/macos"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user