Last active
December 21, 2023 19:40
-
-
Save craigerskine/fe1278ca405d58cd61e349797f96d9d0 to your computer and use it in GitHub Desktop.
Force Dropbox to truly ignore node_modules using Apple Script (macOS only)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prep dropbox to ignore 'node_modules' in a node project | |
# 1. Move this script to your node project root; | |
# 2. Delete the existing 'node_modules' folder; | |
# 3. Run this script; | |
# 4. `npm install` as normal; | |
# 5. Enjoy! | |
tell application "Finder" | |
set current_path to container of (path to me) as alias | |
make new folder at current_path with properties {name:"node_modules"} | |
set current_path to POSIX path of current_path | |
end tell | |
delay 1 | |
# do shell script "xattr -w com.dropbox.ignored 1 " & current_path & "./node_modules" | |
do shell script "xattr -w com.dropbox.ignored 1 " & quoted form of (POSIX path of current_path) & "./node_modules" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@craigerskine I got it to work by changing line 16 to:
do shell script "xattr -w com.dropbox.ignored 1 " & quoted form of (POSIX path of current_path) & "./node_modules"
Credit to this SO post:
https://apple.stackexchange.com/a/200505
Thanks again! Very useful gist.