Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

hapi-auth-udaru package #505

Merged
merged 17 commits into from
Apr 5, 2018
Merged

hapi-auth-udaru package #505

merged 17 commits into from
Apr 5, 2018

Conversation

ShogunPanda
Copy link
Contributor

Fixes #501.

In order to maintain both v16 and v17 packages I created a new package called hapi-auth-udaru that contains both udaru-hapi-plugin and udaru-hapi-server as a single package.

The code has been slightly reorganized and simplified. Test coverage is 100%.

The udaru-core has been modified to support async/await, but its still compatible with hapi v16.

@coveralls
Copy link

coveralls commented Mar 29, 2018

Coverage Status

Coverage remained the same at 93.136% when pulling 6fce4db on hapi-auth-udaru into 81855ca on master.

Copy link
Contributor

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the new module is named hapi-auth-udaru?

.travis.yml Outdated
@@ -1,8 +1,7 @@
language: node_js

node_js:
- '6'
- '7'
- '8.9'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely not correct. We should test the Hapi v17 bits only on 8 and 9, but the rest also on Node 6.
We can drop 7.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agreed. But I'm not sure on how to configure Travis for this. Any hint?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run the test everywhere, but then the projects that are 8+ should not run their tests if node < 8.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, good idea. Will do it.


...

const server = new Hapi.server()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is new needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Dumb me. Good catch.

@@ -0,0 +1,65 @@
'use strict'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should move the benchmarks into their own shared package. Otherwise they are just duplicated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Especially since I'm working on the fastify version. Will do it.

Copy link
Contributor Author

@ShogunPanda ShogunPanda Mar 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I was thinking...if these benchmark are run from within the entire udaru repository, why do we even need a shared package at all? Couldn't just move it to the root folder and that's it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'll likely have to support both plugins for some time, anything that cuts down on duplication would be welcomed

@ShogunPanda
Copy link
Contributor Author

Note: this is currently base after #508. Make sure to wait for it to be merged, then rebase after master before merging.

@ShogunPanda
Copy link
Contributor Author

@mcollina Due to force push, I can't see your previous Travis commit. But I can confirm is now run on 6 and 8.9

@ShogunPanda
Copy link
Contributor Author

@mcollina The new name for the new package is because udaru-hapi-* will be for v16-, while hapi-auth-udaru (which contains both) is for v17+. I picked up a new name trying to be consistent with other plugins in the Hapi plugins list.

```

## Usage

```js
const Hapi = require('hapi')
const UdaruPlugin = require('@nearform/udaru-hapi-plugin')
const UdaruPlugin = require('@nearform/hapi-auth-udaru-16')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with this naming convention are we causing confusion, could someone think it is udaru-16 and not to do with hapi-16?

would it be better to have udaru-auth-hapi-16 & udaru-auth-hapi-17 for example and any other server support use the same convention udaru-auth-fastify etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're probably right.
The reason I don't want to use 17 in the newer package is because if in the future hapi goes 18 and we're still compatible we probably don't want to rename the package.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I much preferred the old naming convention, I know it's not hapi convention but I don't care. Am leaning back towards:

  • udaru-core
  • udaru-hapi-16-plugin
  • udaru-hapi-plugin
  • udaru-hapi-server

Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes sounds good to me.

Copy link
Contributor

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

.travis.yml Outdated
@@ -2,7 +2,7 @@ language: node_js

node_js:
- '6'
- '7'
- '8.9'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be '8', and we should also add '9'.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still the same here, did you push?

package.json Outdated
@@ -42,7 +44,8 @@
"lint": "standard",
"postinstall": "lerna bootstrap",
"doc:lint": "remark .",
"start": "node packages/udaru-server/start.js",
"start-v16": "node packages/hapi-auth-udaru-16/start.js",
"start": "node packages/hapi-auth-udaru/start.js",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed on slack, but let's have one start, pointing to node packages/hapi-auth-udaru-16/start.js

```

## Usage

```js
const Hapi = require('hapi')
const UdaruPlugin = require('@nearform/udaru-hapi-plugin')
const UdaruPlugin = require('@nearform/hapi-auth-udaru-16')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I much preferred the old naming convention, I know it's not hapi convention but I don't care. Am leaning back towards:

  • udaru-core
  • udaru-hapi-16-plugin
  • udaru-hapi-plugin
  • udaru-hapi-server

Thoughts?

@@ -0,0 +1,65 @@
'use strict'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'll likely have to support both plugins for some time, anything that cuts down on duplication would be welcomed

@mcollina
Copy link
Contributor

mcollina commented Apr 4, 2018

yes I much preferred the old naming convention, I know it's not hapi convention but I don't care. Am leaning back towards:

udaru-core
udaru-hapi-16-plugin
udaru-hapi-plugin
udaru-hapi-server

I like this.

@mcollina
Copy link
Contributor

mcollina commented Apr 4, 2018

I would recommend to ship https://www.npmjs.com/package/swagger-ui-dist instead of copying the files of swagger ui. It can be a separate issue, but I see the files are being moved around in this PR.

@ShogunPanda
Copy link
Contributor Author

I've update the package names as @dberesford asked. udaru-hapi-server now runs on udaru-hapi-16-plugin.

@cianfoley-nearform
Copy link
Contributor

Looks good to me Paolo!

Copy link
Contributor

@dberesford dberesford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dberesford dberesford merged commit eb10745 into master Apr 5, 2018
@dberesford dberesford deleted the hapi-auth-udaru branch April 5, 2018 13:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants