md-sync

Multiple destinations syncing(sync local files or directories to multiple destinations).

Usage no npm install needed!

<script type="module">
  import mdSync from 'https://cdn.skypack.dev/md-sync';
</script>

README

md-sync

Multiple destinations syncing(sync local files or directories to multiple destinations).

npm install md-sync --save-dev

package.json

"scripts": {
  "sync": "md-sync"
}

config

Add a md-sync.config.js file to your project root.

module.exports = [
  // first destination
  {
    src: [globs, options],
    remotePath: 'remotePath',
    server: {
      ignoreErrors: true,
      sshConfig: {
        host: 'host',
        username: 'username',
        password: 'password'
      }
    },
  },
  // second destination
  ...
];
  1. src: gulp src args
  2. remotePath: remote server path
  3. server: options for gulp-ssh

multiple server environments

If you need to support multiple server environments(test, gray, prod), you can do like this:

# package.json

"scripts": {
  "sync:test": "md-sync --env test",
  "sync:gray": "md-sync --env gray",
  "sync:prod": "md-sync --env prod"
}

With minimist.

# md-sync.config.js

const argv = require('minimist')(process.argv.slice(2));

const configs = {
  test: [
    { ... },
    ...
  ],
  gray: [
    { ... },
    ...
  ],
  prod: [
    { ... },
    ...
  ],
};

module.exports = configs[argv.env];

do syncing

npm run sync