Repository: vercel/next.js
Pull request: Turbopack: Remove old macos-compress script

@wbinnssmith added these scripts a long time ago at my suggestion/urging, but I think they ended up bad for a couple reasons that were hard to foresee at the time:

- afsctool operates in-place and doesn't atomically write the compressed file, so if the process gets interrupted, your `target` directory is corrupted. https://github.com/Dr-Emann/applesauce is better for this reason.
- This doesn't acquire the cargo lock, and modifying files while cargo is running is a good way to get corruption of the `target` directory.

https://github.com/bgw/cargo-apfs-compress is my latest attempt at solving this, though I don't have a `LaunchAgents` config for it.  
  
Regarding `node_modules`: pnpm creates reflinks from a shared global store on apfs. Trying to compress these reflinked files is just going to hurt you because it'll break the data deduplication that would've otherwise happened.

Changed files:
filename: contributing/core/developing.md
patch: @@ -180,17 +180,3 @@ pnpm sweep
 ```
 
 It will also clean up other caches (pnpm store, cargo, etc.) and run `git gc` for you.
-
-### MacOS disk compression
-
-If you want to automatically use APFS disk compression on macOS for `node_modules/` and `target/` you can install a launch agent with:
-
-```bash
-./scripts/LaunchAgents/install-macos-agents.sh
-```
-
-Or run it manually with:
-
-```bash
-./scripts/macos-compress.sh
-```

filename: scripts/LaunchAgents/build.turbo.compress.plist
patch: @@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-  <!-- Periodically compress text-heavy directories -->
-	<dict>
-		<key>Label</key>
-		<string>build.turbo.compress</string>
-
-    <key>StandardOutPath</key>
-    <string>/tmp/build.turbo.compress/log</string>
-    <key>StandardErrorPath</key>
-    <string>/tmp/build/turbo.compress/error</string>
-
-    <key>EnvironmentVariables</key>
-    <dict>
-      <key>PATH</key>
-      <string>/opt/homebrew/bin:/opt/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
-    </dict>
-
-    <key>ProgramArguments</key>
-    <array>
-      <string>/bin/sh</string>
-      <string>-c</string>
-      <string>cd $(defaults read build.turbo.repopath -string) &amp;&amp; ./scripts/macos-compress.sh</string>
-    </array>
-
-    <key>StartInterval</key>
-    <integer>10800</integer> <!-- 3 hours -->
-	</dict>
-</plist>

filename: scripts/LaunchAgents/install-macos-agents.sh
patch: @@ -1,18 +0,0 @@
-#!/usr/bin/env bash
-#
-# Optionally automates compressing target/ and other directories.
-# Only intended for and needed on macOS.
-
-set -e
-
-SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
-NEXT_DIR=$(realpath "$SCRIPT_DIR/../..")
-
-defaults write build.turbo.repopath -string "$NEXT_DIR"
-
-for filename in "$SCRIPT_DIR"/*.plist; do
-  PLIST_FILE="$HOME/Library/LaunchAgents/$(basename "$filename")"
-  ln -sf "$filename" "$PLIST_FILE"
-  launchctl unload "$PLIST_FILE" || true
-  launchctl load "$PLIST_FILE"
-done

filename: scripts/macos-compress.sh
patch: @@ -1,22 +0,0 @@
-#!/usr/bin/env bash
-#
-# Optionally automates compressing target/ and other directories.
-# Only intended for and needed on macOS.
-#
-
-set -e
-
-SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
-NEXT_DIR=$(realpath "$SCRIPT_DIR/..")
-
-# Basic timestamp prefix for logging
-PS4='+ $(date "+%Y-%m-%d +%H:%M:%S") '
-
-set -x
-
-if ! command -v afsctool &> /dev/null; then
-  echo "afsctool is required. Install it with 'brew install afsctool'."
-  exit 1
-fi
-
-afsctool -c "$NEXT_DIR/target" "$NEXT_DIR/node_modules"