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

@yuzhang9804/scripts

v1.2.5

Published

一个受 [@antfu/ni](https://github.com/antfu-collective/ni) 启发的交互式脚本选择器,集成了 GitLab MR 创建功能。

Downloads

16

Readme

YS - 脚本选择器

一个受 @antfu/ni 启发的交互式脚本选择器,集成了 GitLab MR 创建功能。

功能特性

  • �� 交互式脚本选择,类似 nr 命令,使用 @posva/prompts 提供现代化的用户界面
  • 📦 自动检测包管理器(npm/yarn/pnpm/bun)
  • 🔧 支持 npm-scripts-info 约定显示脚本描述
  • 🎯 集成 GitLab MR 创建功能
  • 📝 从当前执行目录读取环境变量
  • 🔒 代码混淆和打包优化
  • ✨ 优雅的命令行交互体验

安装

npm install -g @yuzhang/scripts

使用方法

在任何包含 package.json 的项目目录中运行:

ys

交互体验

使用方向键 ↑↓ 选择命令,按 Enter 确认:

🚀 YS - 脚本选择器
==================
📦 正在执行 npm install...
✅ 依赖安装完成

? 请选择要执行的命令 › 
❯ build           构建项目
  dev             启动开发服务器  
  test            运行测试
  create-mr       🚀 创建 GitLab MR
  exit            退出程序

功能说明

  1. 自动安装依赖: 首先会根据检测到的包管理器自动安装依赖
  2. 脚本选择: 显示所有可用的 npm scripts,支持交互式选择
  3. GitLab MR 创建: 内置 GitLab MR 创建功能,支持:
    • 自动获取远程分支最新信息
    • 合并远程目标分支(处理冲突)
    • 自动推送分支
    • 运行类型检查
    • 交互式输入 MR 标题和描述
    • 创建 MR
    • 发送飞书通知

GitLab MR 创建流程

create-mr 命令会按以下步骤执行:

  1. 配置检查: 验证所有必需的环境变量
  2. 分支信息获取: 获取当前分支和 Git 用户信息
  3. 远程分支同步:
    • git fetch origin - 获取远程分支最新信息
    • git merge origin/{target_branch} - 合并远程目标分支
    • 如有冲突会提示手动解决步骤
  4. 分支推送: 推送当前分支到远程仓库
  5. 类型检查: 运行 pnpm run tc 进行类型检查
  6. MR 信息收集: 交互式输入标题和描述
  7. MR 创建: 自动创建 GitLab Merge Request
  8. 飞书通知: 发送通知到配置的飞书群

冲突处理

如果在合并远程分支时出现冲突,脚本会停止并提供解决指导:

❌ 合并远程 main 分支失败: ...
💡 请手动解决冲突后重新运行此脚本
💡 解决冲突的步骤:
   1. git add <冲突文件>
   2. git commit
   3. 重新运行此脚本

环境变量配置

在项目根目录创建 .env.local 文件:

# GitLab 配置
GITLAB_DOMAIN="your-gitlab-domain.com"
GITLAB_PROJECT_PATH="your-group/your-project"
GITLAB_PROJECT_ID="your-project-id"
GITLAB_TARGET_BRANCH="main"
GITLAB_COOKIES="session_id=xxx; ..."

# 飞书配置
FEISHU_USER_ID="your_feishu_user_id"
FEISHU_WEBHOOK_URL="https://open.feishu.cn/open-apis/bot/v2/hook/your-webhook-id"

脚本描述支持

支持 npm-scripts-info 约定,在 package.json 中添加:

{
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "test": "vitest"
  },
  "scripts-info": {
    "dev": "启动开发服务器",
    "build": "构建生产版本",
    "test": "运行单元测试"
  }
}

如果没有提供 scripts-info,工具会根据命令内容自动推断描述。

技术栈

  • TypeScript: 类型安全的开发体验
  • @posva/prompts: 现代化的命令行交互界面
  • Bun: 快速的构建和打包
  • dotenv: 环境变量管理

开发

# 克隆项目
git clone <repository-url>
cd scripts

# 安装依赖
bun install

# 构建
bun run build

# 本地测试
node dist/index.js

许可证

MIT