Skip to content

Commit

Permalink
Merge pull request #195 from firstandthird/update-deps
Browse files Browse the repository at this point in the history
Update deps
  • Loading branch information
dawnerd authored Nov 21, 2020
2 parents c4482a9 + 0ea551f commit bafdd97
Show file tree
Hide file tree
Showing 23 changed files with 3,389 additions and 1,425 deletions.
2 changes: 0 additions & 2 deletions .dockerignore

This file was deleted.

12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
35 changes: 0 additions & 35 deletions .github/main.workflow

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Lint

on:
push:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Setup Node.js environment
uses: actions/setup-node@v2.1.2
with:
node-version: 14
registry-url: 'https://registry.npmjs.org'
- run: yarn install
- run: yarn lint
53 changes: 53 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Create Release

on:
push:
tags:
- '*'

jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Setup Node.js environment
uses: actions/setup-node@v2.1.2
with:
node-version: 14
registry-url: 'https://registry.npmjs.org'
- run: yarn install
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Changelog
uses: scottbrenner/generate-changelog-action@master
id: Changelog
env:
REPO: ${{ github.repository }}
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
${{ steps.Changelog.outputs.changelog }}
draft: false
prerelease: false
29 changes: 29 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test

on:
push:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Setup Node.js environment
uses: actions/setup-node@v2.1.2
with:
node-version: 14
registry-url: 'https://registry.npmjs.org'
- run: yarn install
- run: yarn test
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v14.5.0
3 changes: 0 additions & 3 deletions .travis.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .vscode/launch.json

This file was deleted.

14 changes: 0 additions & 14 deletions Dockerfile

This file was deleted.

31 changes: 28 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# Rapptor [![Build Status](https://travis-ci.org/firstandthird/rapptor.svg?branch=master)](https://travis-ci.org/firstandthird/rapptor) [![Greenkeeper badge](https://badges.greenkeeper.io/firstandthird/rapptor.svg)](https://greenkeeper.io/)
<h1 align="center">Rapptor</h1>

<p align="center">
<a href="https://github.com/firstandthird/rapptor/actions">
<img src="https://img.shields.io/github/workflow/status/firstandthird/rapptor/Test/main?label=Tests&style=for-the-badge" alt="Test Status"/>
</a>
<a href="https://github.com/firstandthird/rapptor/actions">
<img src="https://img.shields.io/github/workflow/status/firstandthird/rapptor/Lint/main?label=Lint&style=for-the-badge" alt="Lint Status"/>
</a>
<img src="https://img.shields.io/npm/v/rapptor.svg?label=npm&style=for-the-badge" alt="NPM" />
</p>

Rapptor is a lightweight library that sits on top of [hapi](http://hapijs.com).

Expand All @@ -9,9 +19,17 @@ Rapptor is a lightweight library that sits on top of [hapi](http://hapijs.com).
* Automatically add any method in the `methods` directory with [hapi-method-loader](https://github.com/firstandthird/hapi-method-loader).
* Logging with [hapi-logr](https://github.com/firstandthird/hapi-logr).

## Install
## Installation

`npm install --save rapptor`
```sh
npm install rapptor
```

_or_

```sh
yarn add rapptor
```

## Usage:

Expand Down Expand Up @@ -73,3 +91,10 @@ module.exports = {
Now you can call `server.method.somemethod()` in your code.

See more information on method loading in [hapi-method-loader](https://github.com/firstandthird/hapi-method-loader).


---

<a href="https://firstandthird.com"><img src="https://firstandthird.com/_static/ui/images/safari-pinned-tab-62813db097.svg" height="32" width="32" align="right"></a>

_A [First + Third](https://firstandthird.com) Project_
2 changes: 1 addition & 1 deletion bin/rapptor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
'use strict';

const Rapptor = require('../');

const cwd = process.cwd();
Expand Down
2 changes: 0 additions & 2 deletions conf/default-envs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ envVars:
forceHttps: '{{ truthyEnv("FORCE_HTTPS") }}'
logRequests: '{{ truthyEnv("ACCESS_LOGS") }}'
sentryDsn: '{{getEnv("SENTRY_DSN", "")}}'
configRouteKey: '{{getEnv("CONFIG_ROUTE_KEY", false)}}'
configRouteOutput: '{{getEnv("CONFIG_ROUTE_OUTPUT", "log")}}'
18 changes: 7 additions & 11 deletions conf/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,19 @@ server:
routes:
state:
failAction: 'ignore'
port: "{{ envVars.port }}"
port: '{{ envVars.port }}'
address: '0.0.0.0'
routePrefix: "{{ envVars.routePrefix }}"
routePrefix: '{{ envVars.routePrefix }}'
plugins:
hapi-config-route:
key: "{{ envVars.configRouteKey}}"
output: "{{ envVars.configRouteOutput}}"
_enabled: "{{ envVars.configRouteKey }}"
hapi-favicon:
hapi-health:
token: "{{ envVars.healthToken }}"
endpoint: "{{routePrefix}}/health"
token: '{{ envVars.healthToken }}'
endpoint: '{{routePrefix}}/health'
auth: false
hapi-prom:
_enabled: "{{ envVars.enableProm }}"
metricsPath: "{{ envVars.promPath }}"
defaultMetrics: "{{ envVars.promDefaults}}"
_enabled: '{{ envVars.enableProm }}'
metricsPath: '{{ envVars.promPath }}'
defaultMetrics: '{{ envVars.promDefaults}}'
hapi-logr:
unhandledRejection: true
uncaughtException: true
Expand Down
3 changes: 3 additions & 0 deletions example/conf/default.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
verbose: true
someConfigValue: 'oh yeah'

plugins:
'./plugins/error':
13 changes: 8 additions & 5 deletions example/methods/random-number.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
'use strict';


module.exports = {
method: (done) => {
setTimeout(() => {
done(null, Math.random());
}, 500);
async method() {
await new Promise((resolve, reject) => {
setTimeout(resolve, 500);
});

return Math.random();
}
};
8 changes: 4 additions & 4 deletions example/plugins/error.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';
exports.register = function(server, options, next) {
const register = function(server, options) {
server.log(['error'], new Error('this is an error'));
next();
};
exports.register.attributes = {
exports.plugin = {
register,
once: true,
name: 'error'
};
22 changes: 8 additions & 14 deletions example/routes/home.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
'use strict';
exports.home = {
method: 'GET',
path: '/',
handler(request, reply) {
async handler(request, h) {
const server = request.server;
server.methods.randomNumber((err, number) => {
if (err) {
return reply(err);
}

reply({
config: server.settings.app.someConfigValue,
randomNumber: number
});
});
const number = await server.methods.randomNumber();
return {
config: server.settings.app.someConfigValue,
randomNumber: number
};
}
};

exports.error = {
method: 'GET',
path: '/bug',
handler(request, reply) {
handler(request, h) {
const a = request.dummy.blah; //this will error
reply(a);
return a;
}
};
10 changes: 0 additions & 10 deletions greenkeeper.json

This file was deleted.

2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict';
/* eslint-disable no-console */
const Hapi = require('@hapi/hapi');
const hapiConfi = require('hapi-confi');

Expand Down
Loading

0 comments on commit bafdd97

Please sign in to comment.