Skip to content

Commit

Permalink
Merge pull request #17 from Rindrics/issue-16-setup
Browse files Browse the repository at this point in the history
Add app skelton
  • Loading branch information
Rindrics authored Jun 9, 2024
2 parents 89761f0 + f4100f0 commit 164cead
Show file tree
Hide file tree
Showing 13 changed files with 208 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Use the Ubtuntu base image
FROM ubuntu:22.04

# Download development tools
RUN apt-get update
RUN apt-get install -y curl
RUN apt-get install -y git
RUN apt-get install -y unzip

# Run the container as a user
RUN useradd -m -s /bin/bash slackdev
RUN chown slackdev /usr/local/bin
USER slackdev

# Install the project runtime
RUN curl -fsSL https://deno.land/install.sh | sh
RUN export DENO_INSTALL="/home/slackdev/.deno"
RUN export PATH="$DENO_INSTALL/bin:$PATH"

# Set the working directory
WORKDIR /workspaces

# Install the Slack CLI
RUN curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash -s -- -d
35 changes: 35 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# .devcontainer

A [development container][container] provides a predefined environment with
some tools needed for development, which can be useful in editors such as
[Visual Studio Code][vscode] or remote settings like [Codespaces][codespaces].

This specific container packages [the Slack CLI][cli] with the project runtime
and a few development tools. The `Dockerfile` details the container.

## Editor extensions

Modifications to an editor can be made with changes to the `devcontainer.json`
file:

```diff
{
"customizations": {
"vscode": {
"extensions": [
+ "GitHub.copilot",
"denoland.vscode-deno",
"ms-azuretools.vscode-docker"
],
+ "settings": {
+ "terminal.integrated.defaultProfile.linux": "zsh"
+ }
}
}
}
```

[codespaces]: https://github.com/features/codespaces
[cli]: https://api.slack.com/automation/cli
[container]: https://containers.dev/
[vscode]: https://code.visualstudio.com/docs/devcontainers/containers
13 changes: 13 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "Slack Platform",
"dockerFile": "Dockerfile",
"remoteUser": "slackdev",
"customizations": {
"vscode": {
"extensions": [
"denoland.vscode-deno",
"ms-azuretools.vscode-docker"
]
}
}
}
34 changes: 34 additions & 0 deletions .github/workflows/deno.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deno app build and testing

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
deno:
if: github.repository == 'slack-samples/deno-blank-template'
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Setup repo
uses: actions/checkout@v3

- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Verify formatting
run: deno fmt --check

- name: Run linter
run: deno lint

- name: Run tests
run: deno task test

- name: Run type check
run: deno check *.ts
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist
package
.DS_Store
.slack/apps.dev.json
.log/
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"deno.enable": true,
"deno.lint": true,
"deno.unstable": true,
"deno.suggest.imports.hosts": {
"https://deno.land": false
},
"[typescript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "denoland.vscode-deno"
},
"editor.tabSize": 2
}
Binary file added assets/default_new_app_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"$schema": "https://deno.land/x/deno/cli/schemas/config-file.v1.json",
"fmt": {
"include": [
"README.md",
"datastores",
"external_auth",
"functions",
"manifest.ts",
"triggers",
"types",
"views",
"workflows"
]
},
"importMap": "import_map.json",
"lint": {
"include": [
"datastores",
"external_auth",
"functions",
"manifest.ts",
"triggers",
"types",
"views",
"workflows"
]
},
"lock": false,
"tasks": {
"test": "deno fmt --check && deno lint && deno test --allow-read --allow-none"
}
}
6 changes: 6 additions & 0 deletions import_map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"imports": {
"deno-slack-sdk/": "https://deno.land/x/deno_slack_sdk@2.11.0/",
"deno-slack-api/": "https://deno.land/x/deno_slack_api@2.4.0/"
}
}
11 changes: 11 additions & 0 deletions manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Manifest } from "deno-slack-sdk/mod.ts";
import { RegisterMessageWorkflow } from "./workflows/register_message_workflow.ts";

export default Manifest({
name: "success-notification-aggregator",
description: "Consolidates success notifications into a single, reliable report",
icon: "assets/default_new_app_icon.png",
workflows: [RegisterMessageWorkflow],
outgoingDomains: [],
botScopes: ["commands", "chat:write", "chat:write.public"],
});
5 changes: 5 additions & 0 deletions slack.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"hooks": {
"get-hooks": "deno run -q --allow-read --allow-net https://deno.land/x/deno_slack_hooks@1.3.0/mod.ts"
}
}
22 changes: 22 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"skipLibCheck": true,
"target": "ES2020",
"lib": [
"dom",
"ES2020"
],
"allowSyntheticDefaultImports": true,
"module": "ESNext",
"baseUrl": ".",
"paths": {
"*": [
"node_modules/*",
"workflows/*"
]
}
}
}
7 changes: 7 additions & 0 deletions workflows/register_message_workflow.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { DefineWorkflow } from "deno-slack-sdk/mod.ts";

export const RegisterMessageWorkflow = DefineWorkflow({
callback_id: "register_message_workflow",
title: "Register Message",
description: "Add ID to the incoming success notification and register it to Datastore",
});

0 comments on commit 164cead

Please sign in to comment.