npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-cli-deploy-rsync-assets

v0.2.1

Published

Plugin for ember-cli-deloy addon, upload using rsync.

Downloads

4

Readme

ember-cli-deploy-rsync-assets

A plugin for ember-cli-deploy, that provides a configurable rsync command which uses the upload pipeline hook to sync assets to a destination that you configure.

It would be a good idea to review the writing-a-plugin and pipeline-hooks pages to learn more about the upload hook.

The node-rsync module is used to execute the rsync command.

See the index.js file in this repo; the main script that provides a function for the createDeployPlugin method of this ember-cli-deploy addon.

Installation

Requires ember-cli-deploy addon to be installed first

ember install ember-cli-deploy-rsync-assets

For production deployment the build plugin is required

ember install ember-cli-deploy-build

Deploy config

Setup your configuration in config/deploy.js (generated when installing ember-cli-deploy)

|option|type|description| |:---|:---|:---| |destination|String|The destination include, user@IP if needed| |source|String|The source directory| |ssh|Boolean|Use SSH when syncing| |privateKeyPath|String|Path to your private key, may need with ssh option| |excludeIndexHTML|Boolean|Exclude the index.html file, default is true| |flags|Array|List of rsync flags to add, e.g. ['z'] to add compression| |dry|Boolean|Option for dry run, does not connect when using ssh|

The destination option can be a local path or a remote one. When using the ssh option be sure to include the user/domain, e.g. username@remote_host:/path_to_public. Also, if your config uses ssh: true you may need to also set the option for privateKeyPath to the path to your ssh key (/Users/<username>/.ssh/id_rsa).

Below is an example config/deploy.js file setup to sync all the assets; and also includes the the option to sync the index.html file.

Most likely the ember-cli-deploy-rsync-assets plugin will be used together with other deploy plugins, e.g. self-hosting your assets instead of using an S3 bucket.

See the options assigned to ENV['rsync-assets'] in the example config below…

/*jshint node:true*/
/* global module,process */
var VALID_DEPLOY_TARGETS = ['development-postbuild', 'production'];
module.exports = function(deployTarget) {
  if (VALID_DEPLOY_TARGETS.indexOf(deployTarget) === -1) {
    throw new Error('Invalid deployTarget ' + deployTarget);
  }
  var ENV = {};
  if (deployTarget === 'development-postbuild') {
    ENV.plugins = ['rsync-assets'];
    ENV.build = { environment: 'development' };
    ENV['rsync-assets'] = {
      destination: process.env['PUBLIC_DIR'],
      source: 'dist/.',
      excludeIndexHTML: false, // default is `true` to exclude index.html
      ssh: false,
      dry: false
    }
  } else if (deployTarget === 'production') {
    ENV.plugins = 'build rsync-assets'.split(' ');
    ENV.build = { environment: 'production' };
    ENV['rsync-assets'] = {
      destination: process.env['PUBLIC_DIR'],
      source: 'tmp/deploy-dist/.',
      excludeIndexHTML: false, // default is `true` to exclude index.html
      flags: ['z'], // compress, gzip
      ssh: true,
      privateKeyPath: process.env['PRIVATE_KEY_PATH']
    }
  }
  return ENV;
};

The example above uses a deployTarget of development-postbuild which runs after the build. To setup the hook in your ember-cli-build.js file add the emberCLIDeploy option, an example is below:

/*jshint node:true*/
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
    emberCLIDeploy: {
      runOnPostBuild: (env === 'development') ? 'development-postbuild' : false,
      configFile: 'config/deploy.js'
    }
  });
  return app.toTree();
};

When using as a replacement for S3 in the lightning-pack you can add the options for ENV['rsync-assets'] to your config/deploy.js file and also list the plugins to run during deployment.

  if (deployTarget === 'development-postbuild') {
    ENV.plugins = ['redis', 'rsync-assets'];
    // ... redis, rsync-assets settings
  } else if (deployTarget === 'production') {
    ENV.plugins = 'build display-revisions gzip redis manifest revision-data rsync-assets'.split(' ')
    //... redis, ssh-tunnel, rsync-assets settings…
  }

Links

For more information on using ember-cli, visit http://ember-cli.com/.