Prune non-amd64 prebuilds from Bare bundle
This commit is contained in:
@@ -17,6 +17,16 @@ rm -rf "${BUNDLE_DIR}" "${OUT_DIR}/jarvis-qvac-bare-${PLATFORM}.tar.gz"
|
||||
mkdir -p "${BUNDLE_DIR}"
|
||||
tar --exclude='.git' --exclude='./.agents' --exclude='./.codex' --exclude='./dist' --exclude='./vendor/agent-harness/node_modules' --exclude='*/__pycache__' --exclude='*.pyc' -cf - -C "${ROOT_DIR}" . | tar -xf - -C "${BUNDLE_DIR}"
|
||||
cp -a "${ROOT_DIR}/node_modules" "${BUNDLE_DIR}/"
|
||||
# QVAC publishes one package containing native prebuilds for every supported
|
||||
# platform. The rolling asset is architecture-specific: retain all Linux x64
|
||||
# GPU variants, and remove arm64/mobile/Apple/Windows payloads before packing.
|
||||
find "${BUNDLE_DIR}/node_modules" -type d -name prebuilds -prune -print0 | while IFS= read -r -d '' prebuilds; do
|
||||
find "${prebuilds}" -mindepth 1 -maxdepth 1 -type d ! -name "${PLATFORM}" -exec rm -rf {} +
|
||||
done
|
||||
find "${BUNDLE_DIR}/node_modules" -maxdepth 1 -type d -name 'bare-runtime-*' ! -name "bare-runtime-${PLATFORM}" -exec rm -rf {} +
|
||||
if [[ -d "${BUNDLE_DIR}/node_modules/@esbuild" ]]; then
|
||||
find "${BUNDLE_DIR}/node_modules/@esbuild" -mindepth 1 -maxdepth 1 -type d ! -name 'linux-x64' -exec rm -rf {} +
|
||||
fi
|
||||
tar -C "${OUT_DIR}" -czf "${OUT_DIR}/jarvis-qvac-bare-${PLATFORM}.tar.gz" "jarvis-qvac-bare-${PLATFORM}"
|
||||
rm -rf "${BUNDLE_DIR}"
|
||||
echo "${OUT_DIR}/jarvis-qvac-bare-${PLATFORM}.tar.gz"
|
||||
|
||||
@@ -14,9 +14,13 @@ from pathlib import Path
|
||||
root = Path(sys.argv[1] if len(sys.argv) > 1 else "node_modules")
|
||||
mapping = json.loads(Path(__file__).with_name("bare-imports.json").read_text())
|
||||
changed = 0
|
||||
for package_json in root.rglob("package.json"):
|
||||
if "/.cache/" in str(package_json) or "/.bin/" in str(package_json):
|
||||
for directory, subdirs, files in __import__("os").walk(root):
|
||||
# Native model payloads can be gigabytes. They never contain package
|
||||
# manifests, so do not walk them while preparing JavaScript packages.
|
||||
subdirs[:] = [d for d in subdirs if d not in {"prebuilds", ".git", ".cache"}]
|
||||
if "package.json" not in files:
|
||||
continue
|
||||
package_json = Path(directory) / "package.json"
|
||||
try:
|
||||
package = json.loads(package_json.read_text())
|
||||
except (OSError, json.JSONDecodeError):
|
||||
|
||||
Reference in New Issue
Block a user