forked from jelmer-pe/OpenNotes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·56 lines (45 loc) · 1.54 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·56 lines (45 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# Build Open Notes as a proper .app bundle
set -e
cd "$(dirname "$0")"
# --- Check prerequisites ---
missing=()
if ! command -v swift &> /dev/null; then
missing+=("Swift (install Xcode or Xcode Command Line Tools)")
fi
if ! command -v node &> /dev/null; then
missing+=("Node.js (https://nodejs.org)")
fi
if [ ${#missing[@]} -ne 0 ]; then
echo "Missing prerequisites:"
for dep in "${missing[@]}"; do
echo " - $dep"
done
exit 1
fi
# --- Build web editor ---
echo "Building web editor..."
cd WebEditor
npm install --silent
npm run build --silent
cd ..
# --- Copy web editor assets into SPM resources ---
cp WebEditor/dist/editor.bundle.js LocalNotes/Resources/editor.bundle.js
cp WebEditor/src/editor.html LocalNotes/Resources/editor.html
cp WebEditor/src/editor.css LocalNotes/Resources/editor.css
# --- Build Swift app ---
echo "Building app..."
swift build -c release 2>&1 | tail -5
# --- Assemble .app bundle ---
APP_DIR="Open Notes.app/Contents"
mkdir -p "$APP_DIR/MacOS"
mkdir -p "$APP_DIR/Resources"
cp .build/release/LocalNotes "$APP_DIR/MacOS/LocalNotes"
cp LocalNotes/Info.plist "$APP_DIR/Info.plist"
cp .build/release/LocalNotes_LocalNotes.bundle/editor.html "$APP_DIR/Resources/"
cp .build/release/LocalNotes_LocalNotes.bundle/editor.bundle.js "$APP_DIR/Resources/"
cp .build/release/LocalNotes_LocalNotes.bundle/editor.css "$APP_DIR/Resources/"
echo ""
echo "Done! Built Open Notes.app"
echo " Run with: open \"Open Notes.app\""
echo " Or install to /Applications: cp -r \"Open Notes.app\" /Applications/"