

Automated Deploy Script, Attempt 1: BitBar But I wanted sometime a bit more elegant, a tool a bit more “native” to my Mac. I could have made an alias to the script and then, anytime I wanted to “sync” my local folder to the CDN, just open the terminal, type the command, and let it do its thing. Now the only thing I needed was a way to make the deploy script a bit more accessible. deploy( "SITE_ID", "/path/to/folder", )Īwesome! With just a few lines of code, I had the solution I was looking for: deploy a local folder of files to a global CDN! In it’s most basic form, that script looked like this: const NetlifyAPI = require( "netlify") Ĭonst client = new NetlifyAPI( "YOUR_TOKEN_HERE") Thanks to the hard working folks at Netlify, there was already a tool to deploy a folder via Netlify’s API.
PUBLIC FOLDER SYNC MAC
Question: is there some kind of service out there, like Dropbox, where you drag and drop files to a folder on your Mac which syncs to a server and makes each file immediately available via a URL on a CDN? Kind of like the old Dropbox public folder?Īfter explaining a bit more about what I wanted, told me it was, in fact, possible with Netlify and pointed me in the right direction:Ĭan totally be done with the netlify api and js-client.Īfter digging around the docs a bit and finding out what was possible, I realized the implementation was actually quite straightforward. Have you ever managed your own S3 bucket hooked up to their CDN? Ain’t nobody got time for that.Īs I was thinking about the problem confronting me, I asked the Twitter world about it: I started thinking about other possible avenues for a solution, but none looked too promising. I just wanted to drop a bunch of static files on Netlify’s global CDN but it didn’t seem possible. Drag and drop a folder of files via the Netlify UI each time you want a deploy.Īnd I didn’t want all my icon PNG files 1) in a git repo, or 2) dragged to a web interface anytime I want a deploy.Hook up a site to a git repo and have Netlify auto deploy when you push commits.There were only two ways to deploy a site via Netlify: And I didn’t see how Netlify could help me. All those static PNG files in git were becoming problematic. 5 stars, would use again.īut the problem with my icon gallery sites is that my git repos were getting yuge. I’ve been using Netlify for all my web build/deploy/hosting needs. I Didn’t Think Netlify Could Help Me-They Proved Me Wrong This post is going to dive a bit more into the details of how I built that on top of Netlify’s platform. Instead, I wanted a solution like the old Dropbox Public folder: drag a file into a folder and see it show up on a global CDN. In my previous post, I talked about why Netlify Large Media wasn’t for me.

Even then, I make no guarantees it will make sense.

You might want to read the previous posts for this one to make complete sense. This is part final installment in a three part series:
