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

ssh-upload-amo

v1.0.3

Published

vue-cli 打包后使用ssh2自动上传的插件

Downloads

1

Readme

使用示例

const { SSHUploadWebpackPlugin } = require("ssh-upload-amo");
module.exports = {
    ....
    plugins: [
      // ssh上传插件
      new SSHUploadWebpackPlugin({
    	// ssh2配置
        host: "localhost",
        username: "root",
        password: "password",
    	// 插件配置
    	arg: "--upload-ssh-amo",// 感知进行上传的命令行参数。如: vue-cli-service build --upload-ssh-amo
    	/**
    		文件上传完成后的回调。可用于后续的相关操作。如果有异步操作需要返回一个promise。
    		@param {SSHAmo} ssh - 封装过后的 NodeSSH 实例。实例介绍见后文
    		@return {promise}
    	*/
    	uploadAfter(ssh) {
          // 例:复制后端配置文件
          return ssh.copy("./dist-copy/config.txt","./dist/config.txt");
        },
    	// 服务器相关配置
        cwd: "/www", // 服务器工作目录
        local: __dirname + "/dist",// 本地待上传的目录
        remote: "webApp" // 上传后的服务器目录(相对cwd,即:/www/webApp。如果不填写默认为 path.dirname(local))
      }),
    ]
  }
}

SSHAmo实例

NodeSSH的实例进行包裹后的简单二次封装。主要是对一些如复制、重命名、删除、命令行等常用的ssh操作进行了封装

const { SSHAmo } = require("ssh-upload-amo");
const sshAmo = new SSHAmo({
	// 对应 NodeSSH.prototype.connect 方法的参数
    host: "localhost",
    username: "root",
    password: "password",
    // 新增参数
    cwd: "/www" //  服务器端工作目录
});
// 属性
sshAmo.ssh; // 原生的 NodeSSH 实例
// 方法 (涉及到服务器端的文件或者目录的参数,其路径都是相对 cwd 的)
sshAmo.upload("./dist", "webApp"); // 上传文件或者目录。参数: 本地路径, 服务器路径
sshAmo.uploadAndBackups("./dist", "webApp"); // 上传文件或者目录,且会自动备份。参数: 本地路径, 服务器路径
sshAmo.execCommand("mkdir newDir"); // 执行命令行命令。工作目录为 cwd。 参数: 命令
sshAmo.changeName("dir", "newDir"); // 修改目录或文件名称。参数: 源文件或目录,目标文件或目录
sshAmo.del("test.txt"); // 删除文件或者目录
sshAmo.mkdir("newDir"); // 创建目录
sshAmo.copy("origin", "target"); // 复制目录或文件。如果目标目录不存在则会自动创建。参数: 源文件或目录,目标文件或目录
sshAmo.close(); // 断开连接