-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev-link.sh
More file actions
executable file
·39 lines (35 loc) · 942 Bytes
/
dev-link.sh
File metadata and controls
executable file
·39 lines (35 loc) · 942 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
EXAMPLE_DIR="$ROOT_DIR/example"
usage() {
echo "Usage: ./dev-link.sh [link|unlink]"
echo
echo "Commands:"
echo " link Link the local package into example/ (default)"
echo " unlink Restore example/ to the published package"
}
command="${1:-link}"
case "$command" in
link)
echo "Linking local package into example..."
(cd "$ROOT_DIR" && npm link)
(cd "$EXAMPLE_DIR" && npm link @dayhaysoos/convex-database-chat)
echo
echo "Done. For live rebuilds, run: npm run build:watch"
;;
unlink)
echo "Removing local link and restoring published package..."
(cd "$EXAMPLE_DIR" && npm unlink @dayhaysoos/convex-database-chat)
(cd "$EXAMPLE_DIR" && npm install)
echo "Done."
;;
-h|--help|help)
usage
;;
*)
echo "Unknown command: $command" >&2
usage >&2
exit 1
;;
esac