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

@front-lib/deploy-ftp

v0.3.1

Published

基于deploy-base的ftp文件传输

Downloads

4

Readme

deploy-ftp

基于ftp协议的文件deploy工具

// 安装为正式依赖
npm i @front-lib/deploy-ftp -S

// 安装为环境依赖
npm i @front-lib/deploy-ftp -D

用法

引入基础类

const DeployFtp = require('@front-lib/deploy-ftp')

实例化并执行deploy方法

const ins = new MyDeploy({
  // 一共可以重试上传的次数, 默认一共尝试3次上传,如果全部失败则中断上传
  times: 3,

  // 要deploy的文件夹根目录
  localRoot: path.join(__dirname, 'path/to'),

  // localRoot 下要忽略的文件,遵守glob规则,支持数组/字符串格式
  // ignores: '**/.git/**',
  ignores: ['**/.git/**', 'node_modules/**'],

  // 是否把文件内容hash后与远程地图里面的文件hash比较后,只deploy有变化的文件
  // 如果设置为false,则不与远程地图比较,全部重新deploy
  compare: true,

  // glob的options设置
  glob: {},

  // ftp服务器相关配置
  ftp: {
    host: '',
    user: '',
    pass: ''
  },

  // jsftp扩展函数
  jsftpHook: async (ftp) => {
    ftp.timeout = 1000 * 60 * 10
  }

  // localRoot下的文件上传到ftp服务器哪个目录下
  remoteRoot: '/',

  // ftp服务器上map文件路径, 默认为 `.deploy_ftp_map.json`
  remoteMap: '.deploy_ftp_map.json'
})

async function foo () {
  // 开始 deploy
  await ins.deploy()
  // deploy 结束
}
foo()

相关

ignores与glob pattern关系

  • 如果ignores为字符串,则直接作为glob pattern
  • 如果ignores为数组且长度为1,则ignores[0]作为glob pattern
  • 如果ignores为数组,则经'{' + ignores.join(',') + '}'处理后作为glob pattern

ignores参数怎么配置?

glob pattern文档

glob参数怎么配置?

glob options文档

ftp参数怎么配置?

该参数传递给 jsftp options

remoteMap在远程的路径是相对于remoteRoot下的吗?

不是