How to use gulp-awspublish - 10 common examples

To help you get started, we’ve selected a few gulp-awspublish examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elastic / apm-agent-js-core / gulpfile.js View on Github external
// Set headers
  var headers = {
    'Cache-Control': 'max-age=1800, public'
  }

  var version = require('./package').version
  var majorVersion = version.match(/^(\d).(\d).(\d)/)[1]

  var versionPath = './dist/cdn/**'

  console.warn('Uploading All files in:', versionPath)

  return gulp.src([versionPath])
    // Gzip
    .pipe(awspublish.gzip())
    // Publish files with headers
    .pipe(publisher.publish(headers))
    // Create a cache file to speed up consecutive uploads
    .pipe(publisher.cache())
    // Print upload updates to console
    .pipe(awspublish.reporter())
})
github michaelBenin / react-ssr-spa / gulpfile.babel.js / tasks / gulp_upload_static_files.js View on Github external
gulp.task('upload-vendor-file', function publishAWS() {
  if (existsSync(manifestPath)) {
    // eslint-disable-next-line global-require, import/no-dynamic-require
    manifestJSON = require(manifestPath);
  } else {
    log(`Manifest file not found: ${manifestPath}`);
    throw new Error(`Manifest file not found: ${manifestPath}`);
  }

  const publisher = awspublish.create({
    region: 'us-east-1',
    params: {
      Bucket: process.env.s3bucket
    }
  });

  const headers = {
    'Cache-Control': 'max-age=315360000, no-transform, public'
  };

  return gulp
    .src([
      `./dist/static/js/${manifestJSON['vendor.js']}`,
      `./dist/static/js/${manifestJSON['vendor.js.map']}`
    ])
    .pipe(
github gitana / alpaca / gulpfile.js View on Github external
gulp.task("cdn", function(){

    var aws = JSON.parse(fs.readFileSync("./_s3.json"));

    // create a new publisher
    var publisher = awspublish.create(aws);
    gulp
        .src("./build/alpaca/**/*")
        .pipe(rename(function(x) {
            x.dirname = path.join("alpaca", pkg.version, x.dirname);
        }))
        .pipe(publisher.publish())
        //.pipe(publisher.sync())
        .pipe(awspublish.reporter());
});
github keen / keen-analysis.js / gulpfile.js View on Github external
gulp.task('deploy', function() {
  var cacheLife, publisher, headers;
  if (!process.env.AWS_KEY || !process.env.AWS_SECRET) {
    throw 'AWS credentials are required!';
  }
  cacheLife = (1000 * 60 * 60); // 1 hour (* 24 * 365)
  headers = {
    'Cache-Control': 'max-age=' + cacheLife + ', public'
  };
  publisher = aws.create({
    'accessKeyId': process.env.AWS_KEY,
    'secretAccessKey': process.env.AWS_SECRET,
    'params': {
      'Bucket': 'keen-js',
      'Expires': new Date(Date.now() + cacheLife)
    }
  });

  return gulp.src([
      './dist/' + pkg.name + '.js',
      './dist/' + pkg.name + '.min.js'
    ])
    .pipe(rename(function(path) {
      path.dirname += '/';
      var name = pkg.name + '-' + pkg.version;
      path.basename = (path.basename.indexOf('min') > -1) ? name + '.min' : name;
github productboard / webpack-deploy / tasks / deploy-s3.js View on Github external
function deployS3(config) {
  if (!config.credentials.accessKeyId || !config.credentials.secretAccessKey) {
    gutil.log(
      gutil.colors.red('AWS S3 credentials missing, skipping upload...'),
    );
    return;
  }

  // create a new publisher
  const publisher = aws.create(config.credentials);

  // define custom headers
  const headers = {
    'Cache-Control': 'max-age=315360000, no-transform, public',
  };
  return (
    gulp
      .src(config.assetsPath)
      .pipe(
        rename(function(filepath) {
          filepath.dirname = path.join(config.dirname, filepath.dirname);
        }),
      )
      // gzip, Set Content-Encoding headers and add .gz extension
      .pipe(gulpIf(file => !file.path.match(/\.(mp4|ogg|webm|avi|mov|mkv)$/), aws.gzip()))
      // publisher will add Content-Length, Content-Type and headers specified above
github productboard / webpack-deploy / tasks / deploy-s3.js View on Github external
gulp
      .src(config.assetsPath)
      .pipe(
        rename(function(filepath) {
          filepath.dirname = path.join(config.dirname, filepath.dirname);
        }),
      )
      // gzip, Set Content-Encoding headers and add .gz extension
      .pipe(gulpIf(file => !file.path.match(/\.(mp4|ogg|webm|avi|mov|mkv)$/), aws.gzip()))
      // publisher will add Content-Length, Content-Type and headers specified above
      // If not specified it will set x-amz-acl to public-read by default
      .pipe(publisher.publish(headers))
      // create a cache file to speed up consecutive uploads
      .pipe(publisher.cache())
      // print upload updates to console
      .pipe(aws.reporter())
  );
}
github auth0-samples / auth0-sso-dashboard / gulpfile / app.js View on Github external
// define custom headers
    var headers = {
      'Cache-Control': 'max-age=315360000, no-transform, public'
    };

    var revAll = new RevAll({
      dontRenameFile: ['\.woff', '\.woff2', '\.svg', '\.ttf', '\.eot']
    });

    return gulp.src('./dist/app/**/*.*')
      .pipe(revAll.revision())
      .pipe(awspublish.gzip())
      .pipe(publisher.publish(headers))
      .pipe(publisher.cache())
      .pipe(awspublish.reporter())
      .pipe(cloudfront(aws));
  });
github DallasMorningNews / generator-dmninteractives / generators / page / templates / gulp / tasks / aws.js View on Github external
question: deline`You're about to publish this project to AWS
                            under the directory '${awsDirectory}'.
                            In the process, we'll also wipe out any
                            uploads to the test directory.
                            Are you sure you want to do this?`,
          input: '_key:y',
        }))
        .pipe(rename((filePath) => {
          // eslint-disable-next-line no-param-reassign
          filePath.dirname = awsDirectory + filePath.dirname.replace('.\\', '');
        }))
        .pipe(awspublishRouter(routes))
        .pipe(publisher.publish({}, { force: false }))
        .pipe(cloudfront(cfSettings))
        .pipe(publisher.cache())
        .pipe(awspublish.reporter())
        .on(
          'end',
          gutil.log.bind(
            gutil,
            // eslint-disable-next-line comma-dangle
            `Published at 'http://interactives.dallasnews.com/${awsDirectory}'.`
          )  // eslint-disable-line comma-dangle
        );
github michaelBenin / react-ssr-spa / gulpfile.babel.js / tasks / gulp_upload_static_files.js View on Github external
};

  return gulp
    .src([
      `./dist/static/js/${manifestJSON['vendor.js']}`,
      `./dist/static/js/${manifestJSON['vendor.js.map']}`
    ])
    .pipe(
      rename(function renamePlugin(path) {
        path.dirname = `/${vendor}/${path.dirname}`; // eslint-disable-line no-param-reassign
        return path;
      })
    )
    .pipe(awspublish.gzip())
    .pipe(publisher.publish(headers))
    .pipe(awspublish.reporter());
});
github michaelBenin / react-ssr-spa / gulpfile.babel.js / tasks / gulp_upload_static_files.js View on Github external
const headers = {
    'Cache-Control': 'max-age=315360000, no-transform, public'
  };

  return gulp
    .src([
      `./dist/static/js/${manifestJSON['vendor.js']}`,
      `./dist/static/js/${manifestJSON['vendor.js.map']}`
    ])
    .pipe(
      rename(function renamePlugin(path) {
        path.dirname = `/${vendor}/${path.dirname}`; // eslint-disable-line no-param-reassign
        return path;
      })
    )
    .pipe(awspublish.gzip())
    .pipe(publisher.publish(headers))
    .pipe(awspublish.reporter());
});

gulp-awspublish

gulp plugin to publish files to amazon s3

MIT
Latest version published 4 months ago

Package Health Score

73 / 100
Full package analysis