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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@142vip/changelog

v0.0.1-alpha.7

Published

公众号搜:储凡

Downloads

29

Readme

@142vip/changelog

NPM version

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

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

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

新功能

  • 支持在CHANGELOG文档中标记破坏性改动
  • CHANGELOG文档中支持按照scope进行分组展示
  • 配合CI流水线,生成的CHANGELOG记录支持展示代码贡献者
  • 支持Monorepo模式,通过scopeName配置,匹配git提交信息中的scope,过滤出组件包的提交记录

👉 使用示例

使用

生成CHANGELOG.md文档

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

本地预览

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

配合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:
  # 版本发布
  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
          # “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
          fetch-depth: 0

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

      # 安装Node环境
      - name: Install Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 20.12.2
          # 淘宝镜像加速
          registry-url: 'https://registry.npmmirror.com'
          # 缓存
          cache: pnpm

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

      - name: Build All Packages
        run: |
          pnpm build

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

更多功能


# cli 参数帮助
npx changelog -h

@142vip/changelog/0.0.1-alpha.6

Usage: @142vip/changelog [options]

Options:
  -v --version             Package Version
  -t, --tokens <path>      GitHub Token
  --from <ref>             From tag
  --to <ref>               To tag
  --github <path>          GitHub Repository, e.g. @142vip/core-x
  --name <name>            Name of the release
  --prerelease             Mark release as prerelease
  --output <path>          Output to file instead of sending to GitHub
  --scopeName <scopeName>  Package name in Monorepo,Match the scope in the git commit information
  --dry                    Dry run (default: false)
  -h, --help               display help for command

配置

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

证书

MIT

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