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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@saiweng/fast-publish

v1.2.1

Published

SFTP 部署 CLI 工具,支持多环境配置与交互式发布

Downloads

492

Readme

@saiweng/fast-publish

基于 SFTP 的前端部署 CLI 工具,支持多环境配置与交互式发布。

安装

# 全局安装(推荐,任意目录可用)
npm install -g @saiweng/fast-publish

# 或作为项目 devDependency
npm install --save-dev @saiweng/fast-publish

快速开始

1. 在项目根目录创建 fastpublish.config.ts

import { defineConfig } from '@saiweng/fast-publish'

export default defineConfig({
  environments: {
    test: {
      host: '192.168.1.100',
      port: 22,
      user: 'root',
      password: 'your-password',
      remotePath: '/var/www/html/test',
      localDir: 'dist',        // 可选,默认 'dist'
    },
    pro: {
      host: 'prod.example.com',
      port: 22,
      user: 'deploy',
      password: 'your-password',
      remotePath: '/var/www/html',
      localDir: 'dist',
    },
  },
})

2. 构建项目

npm run build

3. 执行发布

fast-publish

交互界面效果:

◆ fast-publish v1.0.0
│
◆ 请选择发布环境(空格选择,回车确认)
│  ◻ test    192.168.1.100:/var/www/html/test
│  ◻ pro     prod.example.com:/var/www/html
└

⠸ [test] 正在上传 dist → /var/www/html/test
◆ [test] 上传成功  共 42 个文件

⠸ [pro]  正在上传 dist → /var/www/html
◆ [pro]  上传成功  共 42 个文件

◆ 所有环境部署完成 ✓

在 package.json 中配置脚本

{
  "scripts": {
    "deploy": "fast-publish",
    "build:deploy": "npm run build && fast-publish"
  }
}

配置项说明

| 字段 | 类型 | 必填 | 默认值 | 说明 | |------|------|------|--------|------| | host | string | ✅ | — | SFTP 服务器地址 | | port | number | — | 22 | SFTP 端口 | | user | string | ✅ | — | SSH 用户名 | | password | string | ✅ | — | SSH 密码 | | remotePath | string | ✅ | — | 服务器目标目录 | | localDir | string | — | 'dist' | 本地上传目录(相对项目根目录) |

多环境示例

import { defineConfig } from '@saiweng/fast-publish'

export default defineConfig({
  environments: {
    dev: {
      host: '10.0.0.1',
      user: 'root',
      password: 'dev-pass',
      remotePath: '/var/www/dev',
    },
    test: {
      host: '10.0.0.2',
      user: 'root',
      password: 'test-pass',
      remotePath: '/var/www/test',
    },
    pro: {
      host: 'prod.example.com',
      user: 'deploy',
      password: 'prod-pass',
      remotePath: '/var/www/html',
    },
  },
})

运行 fast-publish 后,通过空格多选目标环境,回车确认,所有选中的环境将依次上传并展示各自结果。

注意事项

  • fastpublish.config.ts 包含服务器密码,请将其加入 .gitignore,避免泄露到代码仓库
  • 上传前请确保 localDir 目录已存在(即先执行构建)
  • 需要 Node.js >= 18