@iivu/up v1.0.0-beta.4
up
up
is a command-line tool, which can upload your files to sftp with simple commands.
Usage
Install
npm install -g up
use yarn
/pnpm
whatever you like.
Setup configuration file
up
will read configuration file from up.config.json
in your working directory.
You can use up --init
to create a configuration file.
Below is a complete example of up.config.json
:
{
"host": "your-sftp-host",
"port": 22,
"username": "your-username",
"password": "your-password",
"remotePath": "/your/remote/path",
"localPath": "/your/local/path",
"exclude": []
}
Configuration fields
host
(required): the sftp hostport
: the sftp port, default is22
username
(required): the sftp usernamepassword
(required): the sftp passwordremotePath
(required): the remote dir path you want to upload to, should be an absolute path.localPath
(required): the local file path you want to upload, can be relative or absolute, finally this path will be resolved to an absolute pathexclude
: the files you want to exclude, should be an array of string, the string should be a glob pattern, like['**/*.log', 'node_modules']
if localPath
is a directory, up
will upload all files in the directory, for example:
/your/local/path
is a directory, and it contains files like: /your/local/path/example.txt
, remotePath
is /var/www/project
, when upload finished, the remote file url will be /var/www/project/example.txt
if localPath
is a file, up
will directly upload the file to the remotePath
, for example
/your/local/example.txt
is a file, remotePath
is /var/www/project
, when upload finished, the remote file url will be /var/www/project/example.txt
Commands and options
up
: upload files to sftp, use the working directory'sup.config.json
as configuration file.-h, --help
: output usage information-v, --version
: output the version number-i, --init
: create a template of configuration file in the working directory
License
MIT