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

yw-deploy-cli

v1.2.4

Published

A cli tool for web deploy.

Readme

yw-deploy-cli

前端轻量化部署脚手架,支持测试、线上等多环境部署,支持环境配置扩展,配置好后仅需一条命令即可完成整个部署流程。

fe-deploy-cli改造,扩展了很多功能,具体支持功能可看配置文件

新功能包括:

  • 备份旧文件
  • 显示预览地址,是否在浏览器打开该地址

更加灵活的 CLI 命令

  • 指定配置文件路径
  • 指定拓展文件(覆盖已有的 deploy.config.js,多人开发中这个可以作为忽略选项,作为个人自定义配置)
  • 指定配置文件所在目录

git 地址:

https://gitee.com/gerson577/deploy-cli.git

npm 地址:

https://www.npmjs.com/package/yw-deploy-cli

适用对象

目前还在采用手工部署又期望快速实现轻量化部署的小团队或者个人项目,毕竟像阿里这种大公司都有完善的前端部署平台。

前提条件

能通过 ssh 连上服务器即可,目前仅支持 windows 服务器(上传文件之后,会使用 windows 的 cmd 做一些处理),有兴趣的可以实现一下兼容一下 Linux,写一些 Linux 的文件操作

安装

~~全局安装 yw-deploy-cli~~

推荐安装在当前项目作为开发依赖,每个项目的配置可能不一样,多人开发可以保证一致的开发体验

npm i -D yw-deploy-cli

查看版本,表示安装成功。

安装fe-deploy-cli

使用

1.初始化部署模板

npx deploy init

初始化

2.配置部署环境

部署配置文件位于 deploy 文件夹下的deploy.config.js, 包含dev(测试环境)和prod(线上环境)两个配置

具体配置信息请参考配置文件注释:

// 可另增加 deploy.config.extend.js 文件,deploy.config.extend.js 会覆盖当前文件内容
module.exports = {
	privateKeyPath: 'C:/ssh/id_rsa', // 本地私钥地址,位置一般在C:/Users/xxx/.ssh/id_rsa,建议使用 privateKeyPath,比直接提供 password 更安全
	passphrase: '', // 本地私钥密码,非必填,有私钥则配置
	projectName: '', // 项目名称
	dev: {
		// 测试环境
		name: '测试环境',
		preRun: '', // 部署前需要执行的脚本,可为空
		host: '', // 测试服务器地址
		port: 22, // ssh port,一般默认22
		username: '', // 登录服务器用户名
		password: '', // 登录服务器密码
		distPath: 'dist', // 本地打包dist目录
		webDir: '', // // 测试环境服务器地址
		remoteIgnorePath: '', // 远程服务器忽略删除文件或文件夹,可填数组或字符串
		// 备份
		bakOld: {
			// 备份个数,不填默认 3 个
			num: 3,
			// 是否备份,默认启用备份
			enable: true,
		}, // 部署预览
		preview: {
			url: '', // 部署后检查部署效果,查看的网页地址
			openInBrowser: false, // 部署完成后是否自动打开部署的网页地址
		},
	},
	prod: {
		// 线上环境
		name: '线上环境',
		preRun: '', // 部署前需要执行的脚本,可为空
		host: '', // 线上服务器地址
		port: 22, // ssh port,一般默认22
		username: '', // 登录服务器用户名
		password: '', // 登录服务器密码
		distPath: 'dist', // 本地打包dist目录
		webDir: '', // // 线上环境服务器地址
		remoteIgnorePath: '', // 远程服务器忽略删除文件或文件夹,可填数组或字符串
		// 备份
		bakOld: {
			// 备份个数,不填默认 3 个
			num: 3,
			// 是否备份,默认启用备份
			enable: true,
		}, // 部署预览
		preview: {
			url: '', // 部署后检查部署效果,查看的网页地址
			openInBrowser: false, // 部署完成后是否自动打开部署的网页地址
		},
	},
};

3.查看部署命令

配置好deploy.config.js,运行

npx deploy --help

查看部署命令

部署命令

dev 和 prod 部署选项

dev 和 prod部署选项

4.测试环境部署

测试环境部署采用的时dev的配置

npx deploy dev

测试环境部署

5.线上环境部署

线上环境部署采用的是prod的配置

npx deploy prod

部署流程和测试环境相同

6. 自定义环境部署

增加 env 参数,指定读取得自定义环境配置 key,读取该配置进行部署

比如增加如下配置

{
   sz: {
		name: '苏州项目',
		preRun: '', // 部署前需要执行的脚本,可为空
		host: '', // 线上服务器地址
		port: 22, // ssh port,一般默认22
		username: '', // 登录服务器用户名
		password: '', // 登录服务器密码
		distPath: 'dist', // 本地打包dist目录
		webDir: '', // // 服务器地址
		remoteIgnorePath: '', // 远程服务器忽略删除文件或文件夹,可填数组或字符串
		// 备份
		bakOld: {
			// 备份个数,不填默认 3 个
			num: 3,
			// 是否备份,默认启用备份
			enable: true,
		}, // 部署预览
		preview: {
			url: '', // 部署后检查部署效果,查看的网页地址
			openInBrowser: false, // 部署完成后是否自动打开部署的网页地址
		},
	},
}

部署时,指定读取得 key 为 sz

npx deploy env -e sz