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 🙏

© 2025 – Pkg Stats / Ryan Hefner

scp2-env

v1.0.5

Published

Deploy server using scp2 with environment support

Downloads

14

Readme

scp2-env

一个简单实用的自动化部署工具,用于通过SCP将文件部署到远程服务器。

功能特点

  • 支持多环境配置(开发、测试、生产)
  • 通过SCP安全地将文件传输到远程服务器
  • 友好的命令行界面和日志输出
  • 可通过环境变量灵活配置

安装

# npm
npm install scp2-env

# yarn
yarn add scp2-env

# pnpm
pnpm add scp2-env

全局安装(作为命令行工具使用):

npm install -g scp2-env

使用方法

命令行使用

# 使用默认开发环境
scp2-env

# 指定环境
scp2-env --mode test
scp2-env --mode production
scp2-env -m development

在项目中配置脚本

package.json 中添加以下脚本:

{
  "scripts": {
    "deploy": "scp2-env",
    "deploy:dev": "scp2-env --mode development",
    "deploy:test": "scp2-env --mode test",
    "deploy:prod": "scp2-env --mode production"
  }
}

然后可以使用:

npm run deploy
npm run deploy:test
npm run deploy:prod

配置

环境变量配置

创建以下环境配置文件:

  • .env - 默认配置(开发环境)
  • .env.test - 测试环境配置
  • .env.production - 生产环境配置

配置文件示例:

SCP2_DEPLOY_SERVER_HOST=example.com
SCP2_DEPLOY_SERVER_PORT=22
SCP2_DEPLOY_SERVER_USERNAME=deploy
SCP2_DEPLOY_SERVER_PASSWORD=secret
SCP2_DEPLOY_SERVER_PATH=/var/www/html
SCP2_DEPLOY_SOURCE_DIR=./dist

配置项说明

| 配置项 | 说明 | 默认值 | |-------|------|--------| | SCP2_DEPLOY_SERVER_HOST | 远程服务器主机地址 | localhost | | SCP2_DEPLOY_SERVER_PORT | 远程服务器端口 | 22 | | SCP2_DEPLOY_SERVER_USERNAME | 远程服务器用户名 | root | | SCP2_DEPLOY_SERVER_PASSWORD | 远程服务器密码 | - | | SCP2_DEPLOY_SERVER_PATH | 远程服务器部署路径 | /tmp | | SCP2_DEPLOY_SOURCE_DIR | 需要部署的源目录 | ./dist(尽量是绝对路径) |

开发

# 安装依赖
pnpm install

# 构建项目
pnpm build

# 测试部署
pnpm deploy:dev

示例

  1. 配置环境变量
  2. 执行部署命令
  3. 自动执行构建
  4. 部署到远程服务器
# 部署到测试环境
pnpm deploy:test

# 部署到生产环境
pnpm deploy:prod

许可证

MIT