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

@142vip/changelog

v0.0.1-alpha.23

Published

基于Git提交信息,生成变更记录,输出Markdown格式的日志文件

Readme

@142vip/changelog

NPM version

根据Git提交记录,自动生成CHANGELOG文档

GitHub 提交信息Conventional Commits中生成更改日志。 这个模块实现参考了 changelogenchangelogithub 两个模块的实现。

非常感谢两位作者的实现思路

👉 使用示例

安装

# npm
npm install @142vip/changelog -D
# pnpm
pnpm i @142vip/changelog -D

使用

生成CHANGELOG.md文档

# output参数可以配置,支持做本地文档更新
npx changelog --output CHANGELOG.md

试运行

# 只本地生成创建版本的URL
npx changelog --dry-run

配合Github Actions使用

# .github/workflows/release.yml
name: Release

permissions:
  contents: write

on:
  push:
    tags:
      - 'v*'

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      # 安装node版本,大于16
      - uses: actions/setup-node@v4
        with:
          node-version: 16.x

      # Github发布版本,并更新Release信息
      - name: Release New Version
        run: |
          npx changelog
        env:
          GITHUB_TOKEN: ${{secrets.TOKEN}}

向 GitHub 推送以“v”开头的标签时,github actions会被触发。

在142vip所有的开源仓库中,都可以通过@142vip/changelog模块来实现发布,例如:

#
# CD持续交付
#

name: CD
on:
  push:
    branches:
      - next
  workflow_dispatch:
jobs:
  # 版本发布
  github-release:
    name: 创建Github发布
    runs-on: ubuntu-latest
    # 主库next且执行release更新时执行
    if: github.repository == '142vip/core-x' && startsWith(github.event.head_commit.message, 'chore(release):')

    steps:
      - name: Checkout Code
        uses: actions/checkout@v4
        with:
          persist-credentials: false
          fetch-depth: 0

      # 安装PNPM
      - name: PNPM Install
        uses: pnpm/action-setup@v4
        with:
          version: 9.6.0

      # 安装Node环境
      - name: Install Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 20.12.2
          # 缓存
          cache: pnpm

      # 基于国内镜像源下载依赖,并执行初始化脚本:钩子函数、思维导图构建
      - name: Install Dependencies
        run: |
          ./scripts/ci

      # ci的hooks已经执行
      #      - name: Build All Packages
      #        run: |
      #          pnpm build:packages

      # Github发布版本,并更新Release信息
      - name: Release New Version
        run: npx changelog
        env:
          GITHUB_TOKEN: ${{secrets.TOKEN}}

更多功能

# 常看命令
npx changelog -h

Usage: @142vip/changelog [options]

基于Git提交信息,生成变更记录,输出Markdown格式的日志文件

Options:
  -v,--version             VipCommander Version By @142vip
  --trace                  开启日志追踪模式 (default: false)
  --dry-run                试运行 (default: false)
  --token <token>          GitHub的Token
  --from <from>            Git Commit信息的开始的标签
  --to <to>                Git Commit信息的结束标签
  --name <name>            发布的名称
  --github <github>        Github仓库地址,例如:@142vip/core-x
  --output <output>        输出文档的文件名,建议用绝对路径,例如:CHANGELOG.md
  --scopeName <scopeName>  Monorepo模式下的应用包名称
  --prerelease             将当前发布的版本标记为预发布状态 (default: true)
  -h, --help               display help for command

配置

可以将配置文件放在项目根目录中,名为 changelog.config.{json,ts,js,mjs,cjs}或使用 changelog 字段在package.json中。

// 默认配置
export default {
  scopeMap: {},
  types: {
    feat: { title: '✨ Features', semver: 'minor' },
    perf: { title: '🔥 Performance', semver: 'patch' },
    fix: { title: '🐛 Bug Fixes', semver: 'patch' },
    refactor: { title: '💅 Refactors', semver: 'patch' },
    docs: { title: '📖 Documentation', semver: 'patch' },
    build: { title: '📦 Build', semver: 'patch' },
    types: { title: '🌊 Types', semver: 'patch' },
    release: { title: '😏 Release Packages', semver: 'patch' },
  },
  titles: {
    breakingChanges: '🚨 Breaking Changes',
  },
  contributors: true,
  capitalize: true,
  group: true,
  emoji: true,
  baseUrl: 'github.com',
  baseUrlApi: 'api.github.com',
  prerelease: true,
}

API

  • GithubAPI 对象
  • Changelog 对象
  • ChangelogAPI
  • GitCommitAPI 对象
  • MarkdownAPI 对象
/**
 * changelog相关API
 */
export const ChangelogAPI = {
  generateChangelogInfo,
  upsertChangelogDoc,
  changelogCoreHandler,
}

/**
 * Git Commit相关API
 */
export const GitCommitAPI = {
  getGitCommitDiff,
  parseGitCommits,
  parseCommitsToMarkdownStr,
}

/**
 * Github相关API
 */
export const GithubAPI = {
  getAuthorInfo,
  isExistTag,
  generateReleaseUrl,
  printReleaseUrl,
  getHeaders,
  resolveAuthors,
  createGithubRelease,
}

/**
 * markdown文档相关API
 */
export const MarkdownAPI = {
  formatSection,
  getNoSignificantChanges,
  getNPMVersionDescription,
  getGithubVersionDescription,
}

证书

MIT

Copyright (c) 2019-present, @142vip 储凡

仅供学习参考,商业使用请保留作者版权信息,作者不保证也不承担任何软件的使用风险。