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

@tingyun-common-web/upload-message-webpack-plugin

v2.0.3

Published

webpac插件,保存项目包一些相关信息。【该版本兼容低版本项目】

Downloads

3

Readme

说明

webpac插件,保存项目包一些相关信息。【该版本兼容低版本项目】

使用

1.安装插件 @tingyun-common-web/upload-message-webpack-plugin

npm install @tingyun-common-web/upload-message-webpack-plugin --save-dev

2.安装 @angular-builders/custom-webpack (根据当前angular项目确定使用版本)

npm install @angular-builders/[email protected] --save-dev

3.修改angular.json

"projects": {
  ...
  // [project]是实际项目名
  "[project]": {
    ...
    "architect": {
      ...
      "build": {
        // 修改默认builder
        // "builder": "@angular-devkit/build-angular:browser",
        "builder": "@angular-builders/custom-webpack:browser",
        "options": {
            // 增加自定义webpack文件配置
            "customWebpackConfig": {
                // webpack配置文件名称, 名称自定义
                "path": "./custom-webpack.config.js",
                "replaceDuplicatePlugins": true
            },
            ...
        }
      ...

4.配置package.json

{
    "name": "[project]",
    // 实时修改版本
    "version": "",
    // 新增项目git地址
    "url": "http://git.tingyun.com/app3/rum-app-web.git",
    // 新增group 例:com.tingyun.web.app
    "group": "com.tingyun.web.x",
    // 新增product 例:app
    "product": "x",
    // 新增项目成员(记录该发版版本的参与人员,研发+测试,每次发版实时修改)
    "contributors": [
      // 开发
      {
        "name": "zhangjiaqi",
        "email": "",
        "roles": [
          "dev"
        ]
      },
      // 测试
      {
        "name": "",
        "email": "",
        "roles": [
          "test"
        ]
      }
    ],
    ...
    "dependencies": {
        ...
    },
    "devDependencies": {
        ...
    }
}

5.修改/创建webpack配置文件 此处配置文件的生成位置取决于angular.json中配置的路径

const UploadMessageWebpackPlugin = require('@tingyun-common-web/upload-message-webpack-plugin');
const PackageJson = require('./package.json');
module.exports = (config) => {
  if (config.mode === "production") {
    if (!config.plugins) {
      config.plugins = [];
    }
    config.plugins.push(
      new UploadMessageWebpackPlugin({
        'group': PackageJson.group,
        'artifact': PackageJson.name,
        'version': PackageJson.version,
        'product': PackageJson.product,
        'scm': {
          'url': PackageJson.url
        },
        'contributors': PackageJson.contributors,
        // 低版本项目加该参数
        // 'lowVersion': true
      })
    )
  }
  return config;
}

插件执行测试结果:

  • 本地:
    • ng build --prod 不执行
    • npm run build 不执行
    • Dupload_package_metadata=true ng build --prod 执行
    • Dupload_package_metadata=true npm run build 执行
  • releasego环境:
    • 默认不加Dupload_package_metadata=true 不执行
    • 加入Dupload_package_metadata=true 执行
  • 在releasego Jenkins中配置添加(例):