From the course: Learning Static Site Building with Hugo

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Upload the site content

Upload the site content

From the course: Learning Static Site Building with Hugo

Start my 1-month free trial

Upload the site content

- The last thing that Deployment Script needs to do is actually deploy the files. We'll write two methods to do this. One that creates any folders we need on the server and then one that uploads the files themselves. I'll start with the Create Directories For function. We get a list of local items, so what I want to do is let Directories to create coming from items.filter pull out any item from that list of items that's a directory. We'll say given the path we'll select or filter everything where the path is a directory. Now, all we need to do is returnpromise.all because we're going to do multiple operations here. We'll say directories to create.map for each directory, we need to do sftp.mkdir, make directory we'll say dir.remotepath because we know what the remote path is supposed to be already. And we will want to do it recursively, if necessary. Then after that's done, we'll say .then and this should be familiar by now. We'll do console.log created directory and just output the…

Contents