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

webpack-build-log

v0.2.1

Published

webpack 构建完成生成构建版本信息日志

Downloads

7

Readme

注意:

暂时只支持 Git 管理软件版本的项目,因为插件会读取Git文件相关版本信息,svn或者其他版本管理工具不支持

安装(webpack构建)

npm i webpack-build-log

vue2/vu3 使用:


const WebpackBuildLogs = require('webpack-build-log');

const json = require('./package.json');
const appInfos= {
  name: json.name,
  version: json.version
}
  ...
  plugins: [
    // 调用插件
    new WebpackBuildLogs({
      filename: 'build_version.md',
      appInfos: {
        name:  appInfos.name,
        version: appInfos.version
      }
    })
  ]
  ..

结果(dist/build_version.md):

dist 目录里面: build_version.md 内容:

| 名称 | 信息 | | --------- | ---------------------------------------- | | 应用名称: | vue3_test | | 应用版本: | 0.1.0 | | 应用分支: | master | | 最后提交: | e7b3e33ca51dbf6986b8933d3d3efdfd6c2b8c24 | | 提交信息: | init | | 提交时间: | 2024-01-30 09:31:20 | | 打包人: | zhangxudong | | 打包时间: | 2024-02-02 14:18:40 |

react 使用(npx create-react-app calculator-app)创建的项目

  1. 修改create-react-app 脚手架打包配置 安装插件
npm install react-app-rewired --save-dev
  1. 项目跟目录创建 config-overrides.js
const json = require('./package.json');
const appInfos= {
  name: json.name,
  version: json.version
}

module.exports = function override(config, env) {
  // 修改配置项
  config.plugins.push(new WebpackBuildLogs({
    filename: 'build_version.md',
    appInfos: {
      name:  appInfos.name,
      version: appInfos.version
    }
  }));

  return config;
};
  1. 修改package script 脚本命令
  ...
  "scripts": {
    "start": "react-app-rewired  start",
    "build": "react-app-rewired  build",
    ...
  },
  ...
  1. 在运行打包命令
npm run build

react 打包结果(build/build_version.md)

| 名称 | 信息 | | --------- | ----------------------------------------- | | 应用名称: | calculator-app | | 应用版本: | 0.1.0 | | 应用分支: | master | | 最后提交: | 2ee7f4725146e3d85bbd1227cda19538b8f4250b | | 提交信息: | Initialize project using Create React App | | 提交时间: | 2024-02-07 13:47:49 | | 打包人: | zhangxudong | | 打包时间: | 2024-02-07 14:24:12 |

如果是自己配置react 的打包webpack.config.js, 参照上面,使用webpack的plugin 配置即可使用