Coder Social home page Coder Social logo

deno-slack-builder's Introduction

deno-slack-builder

โš ๏ธ This repository is now archived. It has been superseded by https://github.com/slackapi-deno-slack-hooks.

Library for building a Run on Slack Deno project. The artifacts produced from this library are what can be deployed as a Run on Slack project.

Requirements

A recent version of deno.

Quickstart

Note: The examples below use version 0.1.0 of deno-slack-builder; check the Releases page and be sure to use the latest version.

In a directory that contains a valid manifest file (manifest.json, manifest.js, or manifest.ts), run the following:

deno run --allow-write --allow-read "https://deno.land/x/[email protected]/mod.ts"

This will generate a valid Run On Slack project in a new folder named dist.

Usage details

The top level mod.ts file is executed as a Deno program, and takes up to three optional arguments:

Optional Argument Description
--manifest If passed, will only generate the manifest and skip building functions.
--source Absolute or relative path to your project. Defaults to current working directory.
--output Where manifest and function files will be written to. Defaults to dist. If omitted and --manifest is set, the manifest will be printed to stdout.

Example Usage

Only generate a valid Run On Slack manifest file:

deno run --allow-write --allow-read "https://deno.land/x/[email protected]/mod.ts" --manifest

Generate a Run On Slack project from a /src directory:

deno run --allow-write --allow-read "https://deno.land/x/[email protected]/mod.ts" --source src

How it works

This Deno program bundles any functions with Deno into the output directory in a structure compatible with the Run on Slack runtime, and generates a Run On Slack manifest.json file.

Both the manifest and the functions will be placed into a dist directory by default; use --output to specify a different target directory. You can also output to stdout by using --manifest (be sure to not use --output if you want to write to stdout).

Manifest Generation Logic

Allows for flexibility with how you define your manifest.

  • Looks for a manifest.json file. If it exists, use it.
  • Looks for a manifest.ts file. If it exists, it's default export is used. If you also had a manifest.json file, it is deep-merged on top of the json file.
  • If no manifest.ts exists, looks for a manifest.js file, and follows the same logic as manifest.ts does.

Function Bundling

  • For each entry in the functions where remote_environment=slack it looks for a source_file property, which should be a relative path to the corresponding function file. This is then bundled for the Run on Slack Deno runtime. The reverse function defined below indicates there should be a corresponding function file in the project located at functions/reverse.ts.
"functions": {
  "reverse": {
    "title": "Reverse",
    "description": "Takes a string and reverses it",
    "source_file": "functions/reverse.ts",
    "input_parameters": {
      "properties": {
        "stringToReverse": {
          "type": "string",
          "description": "The string to reverse"
        }
      },
      "required": ["stringToReverse"]
    },
    "output_parameters": {
      "properties": {
        "reverseString": {
          "type": "string",
          "description": "The string in reverse"
        }
      },
      "required": ["reverseString"]
    }
  }
}

Running Tests

If you make changes to this repo, or just want to make sure things are working as desired, you can run:

deno task test

To get a full test coverage report, run:

deno task coverage

Getting Help

We welcome contributions from everyone! Please check out our Contributor's Guide for how to contribute in a helpful and collaborative way.

deno-slack-builder's People

Contributors

filmaj avatar jesselawson avatar lucasmichot avatar mwbrooks avatar selfcontained avatar sgargslack avatar shapirone avatar srajiang avatar williambergamin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deno-slack-builder's Issues

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.