Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .babelrc

This file was deleted.

11 changes: 3 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ jobs:
- image: circleci/node:10
steps:
- checkout
- run: yarn install
- run: yarn run build
- run: yarn install --frozen-lockfile
- run: yarn run prettier --list-different
- run: yarn run eslint
- run: yarn flow check
Expand All @@ -22,12 +21,8 @@ jobs:
- image: circleci/node:10
steps:
- checkout
- run: yarn install
- run: sudo yarn global add now --prefix /usr/local
- run: echo "{\"alias\":\"$NOW_ALIAS\"}" > now.json
- run: now --public --no-clipboard --token $NOW_TOKEN --env NODE_ENV=production --env APP_ID=$APP_ID --env LOG_LEVEL=$LOG_LEVEL --env WEBHOOK_SECRET=$WEBHOOK_SECRET --env PRIVATE_KEY=$PRIVATE_KEY --env SENTRY_DSN=$SENTRY_DSN
- run: now --token $NOW_TOKEN alias
- run: now --token $NOW_TOKEN rm backport --safe --yes
- run: yarn install --frozen-lockfile
- run: yarn serverless deploy

workflows:
version: 2
Expand Down
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/app/
/.env
/.serverless/
/coverage/
/node_modules/
/reports/

.env
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/app/
/.serverless/
/coverage/
/flow-typed/npm/
23 changes: 23 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* eslint-env node */

"use strict";

const presetEnv = require("@babel/preset-env");
const presetFlow = require("@babel/preset-flow");

// eslint-disable-next-line no-process-env
const env = process.env.NODE_ENV;

module.exports = {
presets: [
[
presetEnv,
{
targets: {
node: env === "test" ? true : "8.10.0",
},
},
],
presetFlow,
],
};
66 changes: 29 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,55 +1,47 @@
{
"dependencies": {
"github-backport": "^0.1.1",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-preset-env": "^1.7.0",
"babel-preset-flow": "^6.23.0",
"debug": "^3.1.0",
"probot": "^7.1.1",
"probot-commands": "^1.1.0",
"shared-github-internals": "^0.1.4"
},
"description": "GitHub App to backport pull requests",
"devDependencies": {
"babel-eslint": "^8.2.6",
"babel-jest": "^23.4.2",
"eslint": "^5.3.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-flowtype": "^2.50.0",
"eslint-plugin-import": "^2.13.0",
"@babel/core": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-flow": "^7.0.0",
"@probot/serverless-lambda": "^0.2.0",
"babel-core": "^7.0.0-bridge",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"babel-loader": "^8.0.4",
"debug": "^4.1.0",
"eslint": "^5.7.0",
"eslint-config-prettier": "^3.0.1",
"eslint-plugin-flowtype": "^3.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-security": "^1.4.0",
"eslint-plugin-unicorn": "^5.0.0",
"flow-bin": "^0.78.0",
"eslint-plugin-unicorn": "^6.0.1",
"flow-bin": "^0.83.0",
"flow-typed": "^2.5.1",
"jest": "^23.5.0",
"jest-junit": "^5.1.0",
"nodemon": "^1.17.2",
"prettier": "^1.14.2",
"smee-client": "^1.0.2",
"uuid": "^3.3.2"
"github-backport": "^0.1.2",
"jest": "^23.6.0",
"jest-junit": "^5.2.0",
"prettier": "^1.14.3",
"probot": "^7.3.1",
"probot-commands": "^1.1.0",
"promise-retry": "^1.1.1",
"serverless": "^1.32.0",
"serverless-webpack": "^5.2.0",
"shared-github-internals": "^0.1.5",
"string-replace-loader": "^2.1.1",
"uuid": "^3.3.2",
"webpack": "^4.20.2"
},
"engines": {
"node": ">= 6.11.2"
"node": ">= 8.10.0"
},
"main": "app",
"name": "backport",
"nodemonConfig": {
"exec": "yarn build && yarn start",
"watch": [
".env",
"src"
]
},
"private": true,
"scripts": {
"build": "babel src --out-dir app",
"dev": "nodemon",
"eslint": "eslint . --max-warnings 0",
"flow": "flow",
"flow-typed": "flow-typed",
"prettier": "prettier \"**/*.{js,json,md}\"",
"start": "probot run .",
"test": "jest"
}
}
24 changes: 24 additions & 0 deletions serverless.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
service: backport

provider:
name: aws
runtime: nodejs8.10
stage: production

functions:
probot:
handler: src/handler.probot
events:
- http: POST /
- http: GET /probot
environment:
APP_ID: ${env:APP_ID}
DISABLE_STATS: true
NODE_ENV: production
PRIVATE_KEY: ${env:PRIVATE_KEY}
SENTRY_DSN: ${env:SENTRY_DSN}
WEBHOOK_SECRET: ${env:WEBHOOK_SECRET}
memorySize: 512

plugins:
- serverless-webpack
7 changes: 5 additions & 2 deletions src/index.js → src/handler.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// @flow strict

import { serverless } from "@probot/serverless-lambda";
import commands from "probot-commands";

import backport from "./backport";

module.exports = (app: { log(string): void }) => {
const probot = serverless((app: { log(string): void }) => {
app.log("App loaded");

commands(app, "backport", async (context, command) => {
Expand All @@ -25,4 +26,6 @@ module.exports = (app: { log(string): void }) => {
})
);
});
};
});

export { probot };
Loading