- Notifications
You must be signed in to change notification settings - Fork55
Deploy websites over FTP with one command line
License
SamKirkland/ftp-deploy
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Syncs a local folder with a remote folder over ftp.
After the initial sync only differences are synced, making deployments super fast!
Install the npm package using
npm install @samkirkland/ftp-deploy --only=devRun via command line
ftp-deploy --server ftp.samkirkland.com --username test@samkirkland.com --password \"CrazyUniquePassword&%123\"Or you can add a script to make deployments easier
Add a new key to your
package.jsonfile underscriptssection. See example below.You can run the script using the following command
npm run deploy(run this in the folder that has thepackage.jsonfile)
Example ofpackage.json:
{"scripts": {"deploy":"ftp-deploy --server ftp.samkirkland.com --username test@samkirkland.com --password\"CrazyUniquePassword&%123\"", },}- Install the npm package using
npm install @samkirkland/ftp-deploy --only=dev - Import the code and use it in your code
Example ofmyCustomDeployment.js:
import{deploy,excludeDefaults}from"@samkirkland/ftp-deploy";asyncfunctiondeployMyCode(){console.log("🚚 Deploy started");awaitdeploy({server:"ftp.samkirkland.com",username:"username@samkirkland.com",password:`CrazyUniquePassword&%123`,// note: I'm using backticks here ` so I don't have to escape quotesexclude:[...excludeDefaults,"dontDeployThisFolder/**"]// excludeDefaults will exclude .git files and node_modules});console.log("🚀 Deploy done!");}deployMyCode();
If you use github as source control you can automatically re-deploy your site on every git commit.Read more
To list all commands with examples simply runftp-deploy without any options.
| Key Name | Required | Example | Default Value | Description |
|---|---|---|---|---|
--server | Yes | ftp.samkirkland.com | Deployment destination server | |
--username | Yes | username@samkirkland.com | ftp username | |
--password | Yes | CrazyUniquePassword&%123 | ftp password, be sure to escape quotes and spaces | |
--port | No | 990 | 21 | Server port to connect to (read your web hosts docs) |
--protocol | No | ftps | ftp | ftp: provides no encryption,ftps: full encryption newest standard (aka "explicit" ftps),ftps-legacy: full encryption legacy standard (aka "implicit" ftps) |
--local-dir | No | ./myFolderToPublish/ | ./ | Path to upload to on the server, must end with trailing slash/ |
--server-dir | No | ftp.samkirkland.com/ | ./ | Folder to upload from, must end with trailing slash/ |
--state-name | No | folder/.sync-state.json | .ftp-deploy-sync-state.json | ftp-deploy uses this file to track what's been deployed already, so only differences can be published. If you don't like the name or location you can customize it |
--dry-run | No | true | false | Prints which modifications will be made with current config options, but doesn't actually make any changes |
--dangerous-clean-slate | No | true | false | Deletes ALL contents of server-dir, even items marked as--exclude argument |
--exclude | No | nuclearLaunchCodes.txt | **/.git***/.git*/****/node_modules/** | An array of glob patterns, these files will not be included in the publish/delete process |
--log-level | No | info | info | minimal: only important info,standard: important info and basic file changes,verbose: print everything the script is doing |
--security | No | strict | loose | strict: Reject any connection which is not authorized with the list of supplied CAs.loose: Allow connection even when the domain is not in certificate |
--timeout | No | 60000 | 30000 | Timeout in milliseconds for FTP operations |
About
Deploy websites over FTP with one command line
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Contributors8
Uh oh!
There was an error while loading.Please reload this page.