Skip to content

Build and deploy a nodejs application (such as React, Angular, Vue ecc...).

License

Notifications You must be signed in to change notification settings

dsabre/deploy-ftp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nodejs FTP deploy

Build and deploy a nodejs application (such as React, Angular, Vue ecc...).

From version 1.1.2, using DSDEPLOY_FTP_PREDEPLOY variable, you can deploy anything, even not a site.

Version License: MIT Downloads GitHub issues Dependencies

Configuration

Create a .env.local file in your project directory with following variables:

Environment variable Type Description
DSDEPLOY_FTP_USER string Required. FTP username
DSDEPLOY_FTP_HOST string Required. FTP host
DSDEPLOY_FTP_PASSWORD string FTP password (prompted if none given)
DSDEPLOY_FTP_PORT integer FTP port (default 21)
DSDEPLOY_FTP_REMOTE_DIR string Remote directory name where file will be placed, will use the project directory name if not provided
DSDEPLOY_FTP_LOCAL_DIR string Local directory to upload, will look for the dist or build directory if not provided
DSDEPLOY_FTP_DELETE_REMOTE integer Set to 0 or 1 to delete remote files before upload (default 0)
DSDEPLOY_FTP_FORCE_PASSIVE_MODE integer Set to 0 or 1 to use passive mode (default 1)
DSDEPLOY_FTP_USE_SFTP integer Set to 0 or 1 to use SFTP (default 0)
DSDEPLOY_FTP_PREDEPLOY string Execute commands before deploy, you can define multiple commands to execute by separating them with a semicolon. If you don't want to execute any commands, set the variable to none (default: npm run build).

Example of a .env.local with default/example values

DSDEPLOY_FTP_USER=yourftpusername
DSDEPLOY_FTP_HOST=host.example.xyz
DSDEPLOY_FTP_PASSWORD=yourpassword
DSDEPLOY_FTP_PORT=21
DSDEPLOY_FTP_REMOTE_DIR=remote-directory
DSDEPLOY_FTP_LOCAL_DIR=dist
DSDEPLOY_FTP_DELETE_REMOTE=0
DSDEPLOY_FTP_FORCE_PASSIVE_MODE=1
DSDEPLOY_FTP_USE_SFTP=0
DSDEPLOY_FTP_PREDEPLOY="npm run build"

Usage

Use this command to deploy to your FTP server:

npx @dsabre/deploy-ftp

Optionally, you can pass the name of the environment variables file as a command parameter:

npx @dsabre/deploy-ftp .env

or with any name you want:

npx @dsabre/deploy-ftp myEnvFile.txt

Contributing

For contributions, issues and feature requests please check issues page.

Authors

Support me

Buy Me a Coffee

License

MIT