Giter Site home page Giter Site logo

auto-publish-plugin's Introduction

Auto Publish Plugin

Webpack plugin that supports automatic publishing of NPM packages.

安装

  npm i --save-dev @comkit/auto-publish-plugin
  yarn add --dev @comkit/auto-publish-plugin

使用

auto-publish-plugin支持自动发布 npm 包。

webpack.config.js

const path = require('path');
const AutoPublishWebpackPlugin = require('auto-publish-plugin').default;

module.exports = {
  entry: './index.js',
  plugins: [
    new AutoPublishWebpackPlugin({
      name: 'vue',
      output: path.resolve(__dirname, './dist'),
      registry: 'http://registry.npmjs.org/',
    }),
  ],
  output: {
    filename: 'name.js',
    path: path.resolve(__dirname, 'dist'),
  },
};

参数

Name Type Default Description
name string required 生成的package.json中的包名称
rootDir string required 当前项目跟路径
output string required 打包后生成内容的文件夹路径
registry string http://registry.npmjs.org/ npm

prerelease 下推送会自动在根目录提交并推送文件变成,并且生成对应 alpha 版本 Tag 同时自动提交。

环境变量

auto-publish-plugin还支持通过环境变量注入的方式更新包版本。

  • __version__plugin__mode=patch
  • __version__plugin__mode=minor
  • __version__plugin__mode=major
  • __version__plugin__mode=auto

当传递patchminormajor时,会根据对应的值直接进行版本号修改跳过询问步骤。

当传递auto时,会进入版本号询问环节,支持上述三种定义以及输入自定义版本号。

默认不传递__version__plugin__mode时,开启询问模式。

auto-publish-plugin's People

Watchers

SCLGIS avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.