native-bolt
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

Native Bolt

npm version license

A library for building simple distribution slack commands for native apps.

Installation

$ npm install --save native-bolt

Usage

First, define DeployDestination, which determines the deployment destination from the command.

In application development, CI may be used, and native-bolt can use BitriseClient and GitHubClient for easy requests.

const triggerBitriseWorkflow = (workflowId: string) => {
  const client = new BitriseClient({ token: /*  */ })
  const run = async (params: BuildParameters) => {
    await client.triggerBuild(/* */, {
      branch: params.branch!,
      workflowId: workflowId
    })
  }
  return run
}

const appDistributionDev: DeployDestination = {
  id: 'app_distribution_development',
  name: 'App Distribution - DEV',
  run: triggerBitriseWorkflow('distribution-development'),
}

Next, define the DeployCommandOption that sets the command name and the DeployDestination.

const deployOption: DeployCommandOption = {
  commandName: '/deploy_ios',
  actionPrefix: 'deploy_ios',
  title: 'Deploy iOS',
  responseType: 'in_channel',
  defaultBranch: 'develop',
  branches: branches,
  version: version,
  destinations: [appDistributionDev],
}

Finally, you can execute the slack command by passing App and DeployCommandOption to useDeliverEvents.

const expressReceiver = new ExpressReceiver({
  signingSecret: /* */,
  endpoints: '/events',
  processBeforeResponse: true,
})

const app = new App({
  receiver: expressReceiver,
  token: /* */,
  processBeforeResponse: true,
})

// Events
useDeliverEvents(app, deployOption)

export const event = functions
  .region('asia-northeast1')
  .https.onRequest(expressReceiver.app)

Readme

Keywords

none

Package Sidebar

Install

npm i native-bolt

Weekly Downloads

1

Version

1.0.6

License

MIT

Unpacked Size

90.9 kB

Total Files

35

Last publish

Collaborators

  • tosaka07