Initial import of verae-bootstrap from zapier monorepo
This commit is contained in:
commit
e6bbbaffe8
18 changed files with 353 additions and 0 deletions
22
scripts/clone.sh
Executable file
22
scripts/clone.sh
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
# Clone Forgejo modules listed in a repos file.
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
GITSSH="${GITSSH:-ssh://git@git.georgelambert.org:2223/marchon}"
|
||||
DEST="${VERAE_SRC:-$HOME/verae-src}"
|
||||
LIST="${1:-$ROOT/repos.txt}"
|
||||
export GIT_SSH_COMMAND="${GIT_SSH_COMMAND:-ssh -o StrictHostKeyChecking=accept-new -p 2223}"
|
||||
mkdir -p "$DEST"
|
||||
while read -r name; do
|
||||
[[ -z "$name" || "$name" == \#* ]] && continue
|
||||
if [[ -d "$DEST/$name/.git" ]]; then
|
||||
echo "fetch $name"
|
||||
git -C "$DEST/$name" fetch --prune origin
|
||||
git -C "$DEST/$name" checkout -q main 2>/dev/null || git -C "$DEST/$name" checkout -q master
|
||||
git -C "$DEST/$name" pull --ff-only || true
|
||||
else
|
||||
echo "clone $name"
|
||||
git clone "$GITSSH/${name}.git" "$DEST/$name"
|
||||
fi
|
||||
done < "$LIST"
|
||||
echo "cloned into $DEST"
|
||||
12
scripts/fetch.sh
Executable file
12
scripts/fetch.sh
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
TYPE="${1:-}"
|
||||
LIST="$ROOT/repos.txt"
|
||||
if [[ -n "$TYPE" ]]; then
|
||||
LIST="$ROOT/types/$TYPE/repos.txt"
|
||||
[[ -f "$LIST" ]] || { echo "unknown type $TYPE" >&2; exit 1; }
|
||||
fi
|
||||
bash "$ROOT/scripts/clone.sh" "$LIST"
|
||||
bash "$ROOT/scripts/install-deps.sh"
|
||||
echo "fetch done type=${TYPE:-all}"
|
||||
16
scripts/install-deps.sh
Executable file
16
scripts/install-deps.sh
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
# npm install in every cloned package that has package.json.
|
||||
set -euo pipefail
|
||||
DEST="${VERAE_SRC:-$HOME/verae-src}"
|
||||
if [[ ! -d "$DEST" ]]; then
|
||||
echo "missing $DEST — run scripts/clone.sh first" >&2
|
||||
exit 1
|
||||
fi
|
||||
command -v node >/dev/null
|
||||
command -v npm >/dev/null
|
||||
find "$DEST" -maxdepth 2 -name package.json ! -path '*/node_modules/*' | while read -r pkg; do
|
||||
dir="$(dirname "$pkg")"
|
||||
echo "npm install $dir"
|
||||
(cd "$dir" && npm install --no-audit --no-fund && npm rebuild --no-audit --no-fund >/dev/null)
|
||||
done
|
||||
echo "deps installed under $DEST"
|
||||
14
scripts/test.sh
Executable file
14
scripts/test.sh
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
test -f "$ROOT/repos.txt"
|
||||
test -f "$ROOT/types/ns1-all-in-one/repos.txt"
|
||||
test -f "$ROOT/types/control-plane/repos.txt"
|
||||
test -f "$ROOT/types/ns1-archive/repos.txt"
|
||||
test -f "$ROOT/types/lan-worker/repos.txt"
|
||||
# every type list is a subset of the master list
|
||||
while read -r name; do
|
||||
[[ -z "$name" || "$name" == \#* ]] && continue
|
||||
grep -qx "$name" "$ROOT/repos.txt" || { echo "type repo not in master: $name" >&2; exit 1; }
|
||||
done < <(cat "$ROOT"/types/*/repos.txt)
|
||||
echo OK
|
||||
Loading…
Add table
Add a link
Reference in a new issue