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

@w6s/export-build-info

v1.0.0-beta.1

Published

Automatically export the relevant information of the project after the build, such as git branch, build time, etc.

Downloads

3

Readme

vite-plugin-export-build-info

🛵 Automatically export the relevant information of the project after the build, such as git branch, build time, etc.

Test

动机

  1. 如果项目会被部署到多个的客户环境,而你可能不知道;
  2. 如果项目分支非常多,并且年份老远;
  3. 如果项目开发的周期不稳定,例如此次发布距离上一次超过一年;
  4. 如果项目人员频繁更换。。。

以上,该插件的主要目的是在打包出静态资源的同时,导出一些跟 Git 信息相关的数据到特定文件,方便后续的代码版本确定。

其中,项目的 Git 信息,主要通过git-repo-info实现,会打印git-repo-info返回的所有信息。同时会追加打包的时间以及当前用户(设备)的 Git usernameemail信息,并且支持扩展。

安装

需要 Vite@2+ 版本。

yarn add @w6s/export-build-info -D

# npm
npm install --save-dev @w6s/export-build-info

使用

// vite.config.ts/.js
import { ExportBuildInfo } from '@w6s/export-build-info'

export default defineConfig({
  plugins: [
    vue(),

    // 该插件只会在 build 阶段的最后执行
    ExportBuildInfo({
      fileName: 'build-info',
      extend: {
        oha: 'oha'
      }
    })
  ],
})

参数说明:

  • fileName:非必需,默认为 build-info,文件输出位置会跟 Vite 的 build.outDir 保持一致;
  • extend:非必需,扩展属性;若字段冲突,会被覆盖,并且扩展字段会排在最前面。

导出的文件没后缀名。

License

MIT.