1
1
#! /bin/bash
2
2
3
+ set -e
4
+
5
+ # Check if required commands are available
6
+ command_exists () {
7
+ command -v " $1 " > /dev/null 2>&1
8
+ }
9
+
10
+ for cmd in yarn jq zip cordova electron-builder webpack; do
11
+ if ! command_exists " $cmd " ; then
12
+ echo " Error: $cmd not found. Please install it before running this script."
13
+ exit 1
14
+ fi
15
+ done
16
+
17
+ # Define version for chrome extension zip
18
+ version=$( jq -r .version package.json)
19
+
20
+ # Clean and prepare directories
3
21
yarn clean
4
- mkdir dist
22
+ mkdir -p dist
5
23
rm -rf dist-electron/*
6
24
rm -rf cordova/www/*
25
+ rm -rf compiled_files/*
26
+
27
+ # Run the script to create an empty thunk (assuming it doesn't need special permissions)
7
28
./scripts/create-empty-thunk.sh
29
+
30
+ # Build the application with Webpack
8
31
webpack --progress --config webpack.prod.config.js
32
+
33
+ # Copy the build output to the Cordova www directory
9
34
cp -R dist/* cordova/www
35
+
36
+ # Change to the Cordova directory and build the Android app
10
37
cd cordova
11
38
cordova build android
12
- cordova build android --release
39
+ cordova build android --release --buildConfig=build.json
13
40
cd ..
14
- electron-builder --win --linux -c electron-builder-config.js
41
+
42
+ # Build the Electron app for Windows and Linux
43
+ electron-builder --win --linux -c electron-builder-config.js
44
+
45
+ # Create the zip file for the Chrome extension
46
+ zip -r " Runebase-Lite-Wallet-$version .zip" dist/*
47
+
48
+ # Create a directory for compiled files
49
+ compiled_dir=" compiled_files"
50
+ mkdir -p " $compiled_dir "
51
+
52
+ # Copy relevant compiled files to the new directory with renamed files
53
+ cp -r cordova/platforms/android/app/build/outputs/apk/debug/app-debug.apk " $compiled_dir /Runebase-Lite-Wallet-v$version -debug.apk"
54
+ cp -r cordova/platforms/android/app/build/outputs/bundle/release/app-release.aab " $compiled_dir /Runebase-Lite-Wallet-v$version -release.aab"
55
+ cp -r dist-electron/* .AppImage " $compiled_dir "
56
+ cp -r dist-electron/* .exe " $compiled_dir "
57
+ cp " Runebase-Lite-Wallet-$version .zip" " $compiled_dir "
58
+
59
+ # Display a message indicating where the compiled files are located
60
+ echo " Compiled files are in the '$compiled_dir ' directory."
0 commit comments