I have been using dropbox for a long time and even though I remain on the free plan I have never filled up the space. Important things live on there - and my laptop ever died somehow, I'd be okay.
But one frustration I have had is that there is no way to not sync certain folders - and this is a bigger problem with node_modules. Syncing thousands of files is ridiculously slow.
Note: you can selective sync with a paid dropbox account. I'm not paying for that.
This issue continued to perplex me. I did find pnpm which reduces amount of files used, but that didn't really solve the problem.
So I went searching for another cloud provider. Hopefully it would give me a folder that I could use - like .syncignore
similar to how .gitignore
files work.
Trail and Error
I did try sync.com which offers a free package, is decent, and allows you to selectively sync via the UI. This is okay. But it's not ideal either.
Along the way I ran into another service from Switzerland that has a great feature set from https://tresorit.com
During my first attempt using Tresorit I felt it was slow. But I tried again, and it was just fine. So I jumped in further, because I found out that Tresorit allows you to create a filter for syncing - kind of like a .gitignore
file.
Setting it up
Step 1: set up an account, install the desktop software, etc.
Step 2: In the software, make a new Tresor (let's try ~/projects).
Step 3: Make a rule to filter all node_modules in every sub folder in ~/projects
You can read through this documentation which is buried a little bit on their site.
cd ~/projects
mkdir -p .tresorit/Filters
echo "[Ignore] //node_modules" > .tresorit/Filters/local.filter
This will add an ignore rule for all sub-directories named node_modules
. They won't be synced. Brilliant.
Step 4: Make a test project and see how it works.
cd ~/projects
mkdir test-project && cd test-project
npm init -y
npm install [some package]
ls
(you will see your node_modules folder here)
Now check in the Tresorit desktop app and see what was synced - you will not see your node_modules folder. You should see package.json
and package-lock.json
Summary: Now you have one file with one rule in your ~/projects that filters all sub-directories name node_modules. Nifty.
Happy npm-ing!
Top comments (2)
With dropbox allowing to ignore files/directories using the terminal it is now quite easy to do.
I built a node CLI Dropbox Ignore node_modules to do this very easily.
ā [Junk] may make more sense than [Ignore] because Tresorit then lets you delete parent folders without warnings.
ā With [Junk, Directory], node_modules must be a directory.