README
Goal
This package is made to deploy an npm package to a remote server through FTP. It copies the package source files - the ones included in the archive generated by npm pack - to a temporary directory where the production dependencies are installed. ftp-deploy-package
then uploads all the useful files to the remote server.
Installation
Add this package to your devDependencies: npm install --save-dev ftp-deploy-package
.
Deprecation notice
We were using this package to deploy Azure Functions as detailed in this blog post. Azure Functions can now be deployed with a simple zip push. The same feature is available with AWS Lambda. It means we don't need this npm package anymore so we will stop maintaining it.
Usage
ftp-deploy-package
package is a wrapper around ftp. You can thus pass it all the options accepted by its connect
method.
CLI
- Add
"deploy": "ftp-deploy-package"
to yourpackage.json
scripts
- Display the command help with:
npm run deploy
Example:
npm run deploy -- --path site/wwwroot/app --host your.host.com --user "deploy\user"
Node.js
const ftpDeployPackage = require('ftp-deploy-package');
// Path to the directory containing your package.json.
const packageDirectory = 'local/path';
const ftpConfig = {
host: 'your.host.com',
path: 'site/wwwroot/app',
user: 'deploy\\user'
};
ftpDeployPackage(packageDirectory, ftpConfig).then(() => {
console.log('deploy successful');
});
Testing
To test the package on your machine:
npm install
- Create a
.env
file respecting the dotenv guidelines and add the environment variables mentioned byindex.test.js
. npm test