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
dawnerd authored Nov 21, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents c4482a9 + 0ea551f commit bafdd97
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/[email protected]
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/[email protected]
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/[email protected]
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).

@@ -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:

@@ -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();
2 changes: 0 additions & 2 deletions conf/default-envs.yaml
Original file line number Diff line number Diff line change
@@ -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
@@ -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
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');

4,487 changes: 3,192 additions & 1,295 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
"url": "https://github.com/firstandthird/rapptor.git"
},
"scripts": {
"test": "eslint . && tap test/initialize.test.js --cov",
"test": "tap",
"lint": "eslint .",
"config": "node bin/rapptor.js config",
"example": "cd example && nodemon ../bin/rapptor.js"
@@ -23,28 +23,28 @@
"rapptor": "bin/rapptor.js"
},
"dependencies": {
"@hapi/hapi": "19.1.1",
"@hapi/hapi": "^20.0.2",
"hapi-confi": "^10.0.0",
"hapi-config-route": "^1.3.0",
"hapi-favicon": "^2.1.0",
"hapi-health": "^1.3.0",
"hapi-log-response": "^4.11.0",
"hapi-logr": "^7.0.0",
"hapi-log-response": "^5.0.0",
"hapi-logr": "^9.0.1",
"hapi-method-loader": "^3.1.1",
"hapi-prom": "^3.2.0",
"hapi-require-https": "^3.0.1",
"hapi-require-https": "^5.0.0",
"hapi-route-loader": "^4.1.0",
"hapi-trailing-slash": "^3.1.0",
"json-stringify-safe": "^5.0.1"
},
"devDependencies": {
"@hapi/boom": "^8.0.1",
"@hapi/inert": "^5.2.2",
"@hapi/vision": "^5.5.4",
"eslint": "^5.5.0",
"eslint-config-firstandthird": "^4.3.0",
"@hapi/boom": "^9.1.0",
"@hapi/inert": "^6.0.3",
"@hapi/vision": "^6.0.1",
"eslint": "^7.13.0",
"eslint-config-firstandthird": "^6.0.2",
"eslint-plugin-import": "^2.14.0",
"handlebars": "^4.0.12",
"tap": "^12.0.1"
"nodemon": "^2.0.6",
"tap": "^14.11.0"
}
}
2 changes: 1 addition & 1 deletion test/initialize.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict';
/* eslint-disable no-console */
const Rapptor = require('../');
const tap = require('tap');
const expected = require('./expectedOutput.js');

0 comments on commit bafdd97

Please sign in to comment.