generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathdeploy.sh
executable file
·41 lines (35 loc) · 1011 Bytes
/
deploy.sh
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
#!/bin/bash
# This script builds, deploy, and reload Obsidian
# To reload Obsidian, you need to set Cmd+R to `Reload app without saving` action.
# This works only in mac.
function deploy(){
local dest=$1
mkdir -p $dest
cp -f main.js manifest.json styles.css $dest
echo deployed to $dest
}
function reloadObsidian() {
osascript <<EOS
activate application "Obsidian"
delay 0.5
tell application "System Events"
tell application process "Obsidian"
tell window (get name of first window whose name contains "obsidian-dev")
perform action "AXRaise"
repeat 10 times
-- ESC key to close modals of Obsidian
key code 53
end repeat
-- Reload Obsidian's window
keystroke "r" using {command down}
end tell
end tell
end tell
EOS
}
npm run dev
for target in $(cat deploy-targets.txt)
do
deploy "$target"
done
reloadObsidian