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

emad

v2.0.2

Published

An rsync-based deployment tool

Downloads

21

Readme

EMAD

Dependency Status

This is a deployment utility written in node.js that leverages rsync to deploy the files from your local file system to a drive that is mounted with sshfs. This project exists because it is not always possible to use deployment tools such as Capistrano in order to deploy sites to shared or managed hosting accounts.

The logic that the deployment script follows is to upload only new files or directories, as well as overwrite the files on the server when the files on your computer are newer.

This is a recursive file copy from one place to another.

Dependencies

  1. Node JS
  2. rsync
  3. sshfs

This requires the rsyncwrapper package for Node.js, which has a dependency that "a reasonably modern version of rsync (>=2.6.9) in your PATH."

Windows users will need to install the cwRsync package. See the installation section for more info.

This script also relies on sshfs to mount the remote server as a network drive. Some options for mounting a remote server as a network drive include:

Quick Intro

  1. Install the package as a global module by running npm install -g emad from the command line
  2. Set up your config files (emad-project.json and emad-local/emad-config.json).
  3. Mount remote directory using sshfs.
  4. Deploy using emad [options]

Options

immediates

--immediates

Makes the sync operation non-recursive. default: false

env

--env <name>

The target environment of the deployment. default: staging

only

--only <index>

The deploys only the index specified in the target environment. The index is zero-based. A value of false will deploy all locations in the environment. default: false

files-from

--files-from <filename>

Limits the scope of the deployment to the contents of the file provided in the command line option. Must be used with the --only flag. default: false

force

--force

Will do a fresh copy of the source into the target and ignore the last modified time. This is not a full mirror. Files that do not exist in the source will be kept intact in the target directory. default: false

dry-run

-n, --dry-run

Outputs a list of files to be copied without actually copying them. default: false

inplace

--inplace

Writes data to the destination file directly instead of using a temporary file. default: false

transpose

--transpose

Attempts to swap the source and destination directories provided in the config file. default: false

version

-V, --version

Displays the version number.

help

-h, --help

Displays help information.

Config Files

Don't feel like generating these by hand? You can use our Yeoman generator to create these for you. Check out generator-emad for more.

emad-project.json

This file contains the project-level includes and excludes, environment definitions, and deployment locations for each. This is to avoid having items such as config files advertently deployed to a server. These excludes can be shared with other developers and this file IS meant to be checked in to version control.

Every object in the deployment environment is required to have a source and target property. The source and target property values must always use POSIX style paths, regardless of the OS of your development machine.

Also, note that to copy the contents of the source directory into the target directory, the source directory should end in a trailing slash but the target directory should not.

{
  "exclude": ["*.komodoproject", "test.txt"],
  "include": ["smiley.gif"],
  "configversion": 3,
  "env": {
     "production": [
        {
          "source": "./path-1/",
          "target": "/public_html/path-1"
        },
        {
          "source": "./path-2/",
          "target": "/public_html/path-2"
        }
     ],
     "staging": [
        {
          "source": "./path-1/",
          "target": "/public_html/path-1"
        },
        {
          "source": "./path-2/",
          "target": "/public_html/path-2"
        }
     ]
  }
}

emad-local/emad-config.json

It's likely that each developer that works on the project will have drives mapped differently. The emad-config.json file adds prefixes to each path that are specific to each development machine. This file is specific to your dev environment and should not be checked in to version control.

{
  "env": {
    "production": {
      "source": {
        "prefix": ""
      },
      "target": {
        "prefix": "/cygdrive/p/"
      }
    },
    "staging": {
      "source": {
        "prefix": ""
      },
      "target": {
        "prefix": "/cygdrive/s/"
      }
    }
  }
}

In the example above, the /cygdrive prefix is needed because the development machine is Windows, and cwRsync which is used on Windows requires the /cygdrive prefix in order for absolute paths to be used. The /s in the staging environment's target prefix value means that the developer has the target destination of the deployment mapped to his or her "s" drive.

emad-local/emad-deploy.log

This is a log of previous deploys. Note that it is specific to the machine that the deployment is being triggered from and not a true log every developer's releases to a specific server. This file is specific to your dev environment and should not be checked in to version control.

Additional Notes

The following files and directories are not included in the deployment: 'emad-project.json', 'emad-local/', 'node_modules/', '.sass-cache/', '*.scssc', '.DS_Store'

Additionally, the command uses rsync's --cvs-exclude flag, which will ignore common directories that are used for source control such as .git/ and .svn/. See the rsync manual for more information.