Skip to content

Commit 2157860

Browse files
committed
Add copy script
1 parent 8c07fc0 commit 2157860

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

scripts/pack-and-copy.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
5+
DEST="$HOME/work/core/shared/js/tldraw"
6+
PACKAGES=(tldraw editor)
7+
8+
mkdir -p "$DEST"
9+
10+
for pkg in "${PACKAGES[@]}"; do
11+
pkg_dir="$REPO_ROOT/packages/$pkg"
12+
pkg_json="$pkg_dir/package.json"
13+
14+
name=$(node -e "console.log(require('$pkg_json').name)")
15+
version=$(node -e "console.log(require('$pkg_json').version)")
16+
17+
# strip the @tldraw/ scope to get the short name
18+
short_name="${name#@tldraw/}"
19+
20+
echo "==> Packing $name@$version"
21+
(cd "$pkg_dir" && yarn pack-tarball)
22+
23+
src="$pkg_dir/package.tgz"
24+
dest_file="$DEST/tldraw-${short_name}-${version}.tgz"
25+
26+
echo " Copying -> $dest_file"
27+
cp "$src" "$dest_file"
28+
done
29+
30+
echo ""
31+
echo "Done. Files in $DEST:"
32+
ls "$DEST"

0 commit comments

Comments
 (0)