Skip to content

hiblacker/auto-version-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

auto-version-webpack-plugin V2.0.0

Automatically update version when building。构建时自动更新版本号,生成打包版本信息文件。支持命令行传参更新版本号。遵循 Semver 语义化版本号。

Install

Using npm:

npm install  --save-dev auto-version-webpack-plugin

Or yarn:

yarn add -D auto-version-webpack-plugin

Usage

webpack.config.js

const autoVersionPlugin = require('auto-version-webpack-plugin')

module.exports = {
    plugins: [
        // Default Configuration
        // {
        //     semver: 'patch',
        //     inject: true,
        //     injectFileDirectory: '/',
        //     injectFileName: 'version.json',
        //     injectVersionTimestamp: true,
        //     packageIndent: 2,
        //     custome: null
        // }
        new autoVersionPlugin()
    ]
}

Configuration

semver

Type: String | Boolean,可选配置:major | minor | patch | false

Default: patch

语义化升级版本号: patch 补丁升级,minor 小版本号升级,major 大版本升级, false 不升级。

inject

Type: Boolean

Default: true

是否在打包文件中注入版本信息文件。

injectFileDirectory

Type: String

Default: /

注入路径,/表示打包跟目录。

injectFileName

Type: String

Default: version.json

注入文件名字。

injectVersionTimestamp

Type: Boolean

Default: true

注入的版本号是否加入时间戳。

packageIndent

Type: Number

Default: true

package.json 文件缩进。

custome

Type: Object

Default: null

自定义数据。

更新日志

v2.0.1

  1. 修复自定义打包路径失败
  2. 使用最新 webpack hooks 接口

v2.0.0

  1. 兼容开发模式。
  2. 文件目录调整。
  3. 遵循 Semver 语义化版本。

About

Automatically generate versions when building

Resources

Stars

Watchers

Forks

Packages

No packages published