forked from retoor/devplacepy
Zo doen wijdat in oost
This commit is contained in:
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "usage: build.sh <outdir>" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
mkdir -p "$1"
|
||||
out=$(cd "$1" && pwd)
|
||||
name=devplace-node-extension.zip
|
||||
archive="$out/$name"
|
||||
rm -f "$archive"
|
||||
|
||||
cd "$here"
|
||||
if command -v zip >/dev/null 2>&1; then
|
||||
zip -q -X -r "$archive" manifest.json src ui README.md
|
||||
else
|
||||
python3 - "$archive" <<'PY'
|
||||
import sys
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
archive = sys.argv[1]
|
||||
paths = [Path("manifest.json"), Path("README.md")]
|
||||
for folder in ("src", "ui"):
|
||||
paths.extend(sorted(item for item in Path(folder).rglob("*") if item.is_file()))
|
||||
with zipfile.ZipFile(archive, "w", zipfile.ZIP_DEFLATED) as bundle:
|
||||
for path in paths:
|
||||
bundle.write(path, path.as_posix())
|
||||
PY
|
||||
fi
|
||||
|
||||
cd "$out"
|
||||
if command -v sha256sum >/dev/null 2>&1; then
|
||||
sha256sum "$name" > "$name.sha256"
|
||||
else
|
||||
shasum -a 256 "$name" > "$name.sha256"
|
||||
fi
|
||||
cat "$name.sha256"
|
||||
Reference in New Issue
Block a user