npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@frylo/pftp

v1.5.0

Published

Progressive FTP deployment

Downloads

6

Readme

🚀 @frylo/pftp - Progressive FTP

This package using LFTP to deploy your code to FTP/SFTP/SSH server.

Benefits

1. **Fast**
   1. Updates only changed files.
   2. Deploy faster with parallel deployment processes.
   3. Deploy of 1GB project took about 10 seconds.
2. **Clear**
   1. Only necessary info in you console.
   2. See the process of deployment with progressbar.
3. **Simple**
   1. Only integral options.
   2. Autocompletion for configuration.
   3. Advanced configuration is also available, but hidden deeper in config.

🔗 Reference

🎁 Examples

👁️ Progressbar CLI example

const process = require("process");
const { deploy } = require("../lib/index.js");
const { credentials, folders } = require("./credentials.js");

async function main() {
  await deploy({
    host: "000.00.00.0",
    port: 22,
    protocol: "sftp",
    username: "my-username",
    password: "my-password",

    progress: "bar", // << This option change the view

    localFolder: "./build",
    remoteFolder: "/var/www/my-site.com",
  });
}

main()
  .then(() => process.exit())
  .catch((error) => console.error(error));

Progressbar PFTP

👁️ Progress logs CLI example

const process = require("process");
const { deploy } = require("../lib/index.js");
const { credentials, folders } = require("./credentials.js");

async function main() {
  await deploy({
    host: "000.00.00.0",
    port: 22,
    protocol: "sftp",
    username: "my-username",
    password: "my-password",

    progress: "logs", // << This option change the view

    localFolder: "./build",
    remoteFolder: "/var/www/my-site.com",
  });
}

main()
  .then(() => process.exit())
  .catch((error) => console.error(error));

Progress logs PFTP

🏁 Getting Started

Install package:

npm install --save-dev @frylo/pftp
yarn install -D @frylo/pftp
pnpm i -D @frylo/pftp

Create upload script file, e.g. deployment.mjs:

import { deploy, Credentials } from "@frylo/pftp";

/** @type {Credentials} */
const credentials = {
  host: "000.00.00.0",
  port: 22,
  protocol: "sftp",
  username: "my-username",
  password: "my-password",
};

async function main() {
  await deploy({
    ...credentials,
    localFolder: "./build",
    remoteFolder: "/var/www/my-site.com",
    progress: "bar",
  });
}

main.then(() => process.exit());

Run upload script to deploy files:

node ./deployment.mjs

🔑 Configuration

Configuration schema:

| Option | Value | Description | | ------------------ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | host | string | IP or URL of your host. | | port | number | Number of port, usually 21 for FTP and 22 for SFTP. | | protocol | 'ftp', 'sftp' | Protocol for upload. If you are using SSH server, you could simply use SFTP with 22 port. | | username | string | Username for connection. | | password | string | Password for connection. | | localFolder | string | Path to source folder on local machine. | | remoteFolder | string | Path to target folder on remote machine. | | excludeRegExp | RegExp[] | List of RegExp's to be excluded. Given RegExp's are applied to file and dir names which are in realtive form (relative to cwd). All RegExp's have to be in Egrep format, so flags are not allowed and there are some small difference between JS RegExp and Egrep. | | includeForceRegExp | RegExp[] | Files matching any of this regexp will be uploaded to server no matter has been it changed or not. Given RegExp's are applied only to file names which are in realtive form (relative to cwd). All RegExp's have to be in Egrep format, so flags are not allowed and there are some small difference between JS RegExp and Egrep. All files mathcing RegExp will be uploaded to server using mput lftp command. | | progress | 'bar', 'logs' | Customize process loggin.* Bar - show progress bar (useful for manual execution);* Logs - print logs (useful for GitLab CI/CD). | | customLftpOptions | CustomLftpOptions | Allows to advancely configure LFTP. Usually you don't need this option. Read more about this options in CustomLftpOptions schema section. |

CustomLftpOptions schema:

| Option | Value | Description | | -------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | lftpCommand | string | Path to LFTP executable or name of lftp command. Defaults to "lftp". | | logLftpCommand | boolean | If true script will log generated LFTP command to console. | | beforeOpen | string | In this string you can pass command to lftp that will be ran before "open" command (before connection).Default value: set net:timeout 5; set net:max-retries 3; set net:reconnect-interval-multiplier 1; set net:reconnect-interval-base 5 | | openCommandOptions | string | Here you can rewrite CLI options for open LFTP command. | | beforeMirror | string | In this string you can pass command to LFTP that will be ran before "mirror" command (then you connected, but mirroring haven't started yet). | | mirrorCommandOptions | string | Here you can rewrire CLI options for mirror LFTP command.Default value: --reverse --delete --only-newer --verbose=2 --ignore-time --parallel=10 | | beforeMput | string | In this string you can pass command to lftp that will be ran before "mput" set of commands (this set will run only if you use includeForceRegExp option). | | mputCommandOptions | string | Options for mput set of commands, that runs at second phase if importForceRegExp option is present.Default value: -d | | enaleSsl | string | By default SSL option for LFTP is disabled, because usually it bring pain for beginners. You could enable it back with this option. |

⚙️ Package development

Read more about package development here.

📜 LFTP docs

Read here.