@qiwi/semrel-plugin-creator
TypeScript icon, indicating that this package has built-in type declarations

2.4.1 • Public • Published

@qiwi/semrel-plugin-creator

Semrel plugin creator

Install

yarn add @qiwi/semrel-plugin-creator

Usage

import {createPlugin} from '@qiwi/semrel-plugin-creator'

const handler = async ({step, pluginConfig, context, name}) => {
  if (step === 'prepare') {
    pluginConfig.foo = 'bar'
  }

  if (step === 'publish') {
    await doSomething()
  }
}

const plugin = createPlugin({
  handler,
  name: 'plugin-name',
  include: ['prepare', 'publish']
})

API

export type TPluginHandlerContext = {
  pluginConfig: TPluginConfig
  stepConfig: TPluginConfig
  stepConfigs: TStepConfigs
  context: TSemrelContext
  step: TReleaseStep
}

export type TPluginFactoryOptionsNormalized = {
  handler: TReleaseHandler
  name?: string
  include: TReleaseStep[]
  exclude: TReleaseStep[]
  require: TReleaseStep[]
}

export type TPluginFactoryOptions = Partial<TPluginFactoryOptionsNormalized>

export type TReleaseHandler = (context: TPluginHandlerContext) => Promise<any>

export type TPluginFactory = (
  handler: TPluginFactoryOptions | TReleaseHandler,
) => TPlugin

Readme

Keywords

none

Package Sidebar

Install

npm i @qiwi/semrel-plugin-creator

Weekly Downloads

385

Version

2.4.1

License

MIT

Unpacked Size

85.1 kB

Total Files

33

Last publish

Collaborators

  • antongolub
  • qiwibot