sync-my-code

1.3.3 • Public • Published

sync-my-code

一个同步本地和SFTP服务器文件的工具。

主要功能:

  1. 工具启动时,会同步本地工作目录和远程工作目录。
  2. 启动后,会实时监测本地工作目录的修改,并即时更新远程工作目录。

已经在Windows和MacOS上通过测试。

安装

npm install sync-my-code -g

使用说明

$ sync-my-code --help

  Usage: sync-my-code [options]

  一个同步本地和SFTP服务器文件的工具。

  Options:

    -V, --version                     output the version number
    -w, --work-path [value]           需要同步的本地工作路径
    -c, --create-syncrc-path [value]  在指定目录创建一个.syncrc.json
    -h, --help                        output usage information

运行程序目前有两个可选参数-w-c:

  1. -w指定需要同步的本地工作路径。要求本地工作路径下有.syncrc.json配置文件。
  2. -c指定一个需要生成配置文件的工作目录。程序会在生成.syncrc.json配置文件后自动退出。

配置文件是一个JSON文件:

{
  "config": {
    "remote_host": "localhost",
    "remote_port": 22,
    "remote_username": "root",
    "remote_password": "root",
    "remote_path": "/root",
    "ignore_file":[],
    "ignore_dir":[
      ".idea",
      "node_modules",
      ".git"
    ],
    "ignore_watch": "(.*___jb_tmp___)|(.*___jb_old___)|(\\.idea\/.*)|(\\.git\/.*)|(\\.idea\\.*)|(\\.git\\.*)"
  }
}

配置文件说明:

配置项 数据类型 说明
remote_host String 远程SFTP服务器的域名或IP
remote_port Number 远程SFTP服务器的端口号
remote_username String 远程SFTP服务器的用户名
remote_password String 远程SFTP服务器的密码
remote_path String 远程SFTP服务器的同步工作路径
ignore_file Array 在同步文件中需要过滤的列表
ignore_dir Array 在同步文件夹中需要过滤的列表
ignore_watch String 在实时监测文件变化中,需要匹配的正则表达式。注1

注1:当文件名能够匹配正则表达式时,这个文件会被忽略,这个配置,主要用来过滤一些临时文件。

Readme

Keywords

none

Package Sidebar

Install

npm i sync-my-code

Weekly Downloads

1

Version

1.3.3

License

MIT

Unpacked Size

20.4 kB

Total Files

9

Last publish

Collaborators

  • ni982000