@bring-it/sftp

0.3.1 • Public • Published

@bring-it/sftp

SFTP deployment tool for frontend.

npm github node

@bring-it/sftp follows the principle of Convention over configuration, provide sftp like but lite version Command-Line Interface.

Installation

npm install @bring-it/sftp --global

Usage

bring-it [command] <options>

Commands

bring-it sftp

bring-it sftp [server]

SFTP deployment command

Positionals:
  server  URI as user@hostname[:port][/path]
          or Host section in '.ssh/config'

Options:
  -c, --cwd  default: .bring-it
  -k, --key  example: .ssh/id_rsa  [required]

When not match URI, bring-it will treat it as a Host name in .ssh/config.

It support .ssh/config like config with keys: Hostname, Port, User, and a custom key: Path

bring-it sftp dev
# example: .ssh/config

# other Host will inherit from *
Host *
  User root

# = root@192.168.1.200:22/mnt
Host dev
  Hostname 192.168.1.200
  Path /mnt

# = deploy@example.org:2222
Host docs
  Hostname example.org
  Port 2222
  User deploy

Tips: this tool will read env.SSH_PRIVATE_KEY_PATH when no --key arguments passing.

bring-it pack

bring-it pack [target...]

Pack files when support

Positionals:
  target  glob pattern of files or directories  [array]

Options:
  -n, --name  archive output file name  [default: "pack"]

Tips

For a little bit safer, @bring-it/sftp will always upload files in order by: OTHER, SVG, STYLE, SCRIPT, HTML, XML/JSON/YAML .

Not like the HTTP URL, in the SFTP URI, Port is 22 by default.

Path will point to / by default, so don't forget set ChrootDirectory in /etc/ssh/sshd_config to a safe path on server.

Atomic write is not support when ssh/sftp/scp transfer, make your bundle support long-term caching, it will be safer when uploading.

FAQ

Why unauthorized transfer is not supported?

To make sure unexpected file transferring won't happen.

Why password is not supported?

Not safe, and typing special characters to the terminal might not easy.

Package Sidebar

Install

npm i @bring-it/sftp

Weekly Downloads

23

Version

0.3.1

License

MIT

Unpacked Size

424 kB

Total Files

10

Last publish

Collaborators

  • airkro