Menu icon Foundation
foundation-cli: Could we get »foundation deploy«?

I got so much used to typing »foundation watch« and »foundation build« and I use automated deployment a lot. Meaning, in »gulpfile.babel.js« I usually have a gulp task »deploy«, and in »package.json« the script defined:

    "deploy": "gulp deploy --production"

So instead of typing »npm run deploy« or even »gulp deploy --production« every time, it would be just great if we could have something like »foundation deploy«.

What do you think?

foundation-clideploy

I got so much used to typing »foundation watch« and »foundation build« and I use automated deployment a lot. Meaning, in »gulpfile.babel.js« I usually have a gulp task »deploy«, and in »package.json« the script defined:

    "deploy": "gulp deploy --production"

So instead of typing »npm run deploy« or even »gulp deploy --production« every time, it would be just great if we could have something like »foundation deploy«.

What do you think?

Matthias Hormann over 2 years ago

P.S.: Regarding the foundation stack, it could even come »built-in«, i.e. script and gulp task defined with an empty »deploy« function, like so (in »gulpfile.babel.js«):

 

// add gulp-prompt for deployment (npm install --save-dev gulp-prompt)
import prompt   from 'gulp-prompt';

…

// Deploy site to production server
gulp.task('deploy',
  gulp.series('build', deploy_function));

…

// Deploy to production server
// TODO: Fill this in if you want to use it
function deploy_function() {
}

For a recent project, I had to use vinyl-ftp, and it looked like this:

// Deploy to production server, via ftp
function deploy_ftp() {
  var conn = ftp.create(FTP_OPTIONS);
  // need to set glob because otherwise only empty "dist" gets ftp’ed
  // set base to "dist" otherwise it’ll make a "/dist" folder in target
  // set "dot: true" to make it ftp hidden files like ".htaccess"
  return gulp.src(PATHS.dist + '/**/*', { base: PATHS.dist, dot: true, buffer: false })
    .pipe(prompt.confirm('Really sure you want to deploy to the live server?'))
    // comment out next line to ftp ALL, not just newer/different size files
    .pipe(conn.newerOrDifferentSize(FTP_OPTIONS.dest))
    .pipe(conn.dest(FTP_OPTIONS.dest));
}

FTP_OPTIONS are being defined in config.yml:

# DEPLOY (using vinyl_ftp)
#   npm run deploy –or–
#   gulp deploy --production
FTP_OPTIONS:
  host: "example.com"
  port: 21
  dest: "/"
  user: "username"
  password: "password"
  parallel: 10
  log: gutil.log