Skip to content

Instantly share code, notes, and snippets.

@IgorVaryvoda
Last active September 30, 2023 09:39
Show Gist options
  • Save IgorVaryvoda/40036108fda952d318abf397b53cc6da to your computer and use it in GitHub Desktop.
Save IgorVaryvoda/40036108fda952d318abf397b53cc6da to your computer and use it in GitHub Desktop.
Deploy Nuxt2 static assets to Sirv. Get Sirv Credentials here https://sirv.com/help/articles/sync-local-folder-to-sirv-via-ftp/#get-your-ftp-credentials
var FtpDeploy = require('ftp-deploy');
var ftpDeploy = new FtpDeploy();
var ftpConfig = {
user: 'yourusername',
password: 'yourpassword',
host: 'ftp.sirv.com',
port: 21,
localRoot: __dirname + '/.nuxt/dist/client',
remoteRoot: "/_nuxt/",
// include: ["*", "**/*"], // this would upload everything except dot files
include: ["*.*", "css/*.*"],
// e.g. exclude sourcemaps, and ALL files in node_modules (including dot files)
// exclude: ["dist/**/*.map", "node_modules/**", "node_modules/**/.*", ".git/**"],
// delete ALL existing files at destination before uploading, if true
deleteRemote: false,
// Passive mode is forced (EPSV command is not sent)
forcePasv: true,
// use sftp or ftp
sftp: false
}
ftpDeploy
.deploy(ftpConfig)
.then(res => console.log('finished:', res))
.catch(err => console.log(err))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment