From add9ce5f226b9096ccfadf17d0d8ffb7ff88deda Mon Sep 17 00:00:00 2001 From: Tina Holly Date: Sat, 25 May 2019 09:51:05 -0400 Subject: [PATCH 1/3] upgrade to use latest @hapi/joi --- package.json | 2 +- tests/mock-server.js | 4 ++-- validate.js | 4 ++-- yarn.lock | 50 +++++++++++++++++++------------------------- 4 files changed, 27 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index a1979bb..947b6a1 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,6 @@ "supertest": "^4.0.0" }, "dependencies": { - "joi": "^v14.3.1" + "@hapi/joi": "^v15.0.3" } } diff --git a/tests/mock-server.js b/tests/mock-server.js index 9a5e932..b235d51 100644 --- a/tests/mock-server.js +++ b/tests/mock-server.js @@ -1,5 +1,5 @@ const express = require('express'); -const Joi = require('joi'); +const Joi = require('@hapi/joi'); const validate = require('../validate'); @@ -33,4 +33,4 @@ app.post('/contacts', validate({ }), (req, res) => res.send('ok')); -module.exports = app; \ No newline at end of file +module.exports = app; diff --git a/validate.js b/validate.js index 1fbd3d8..80b8a09 100644 --- a/validate.js +++ b/validate.js @@ -1,4 +1,4 @@ -const Joi = require('joi'); +const Joi = require('@hapi/joi'); /** @@ -39,4 +39,4 @@ const validate = (schema) => ( ); -module.exports = validate; \ No newline at end of file +module.exports = validate; diff --git a/yarn.lock b/yarn.lock index eb7f449..625db75 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,28 @@ # yarn lockfile v1 +"@hapi/address@2.x.x": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.0.0.tgz#9f05469c88cb2fd3dcd624776b54ee95c312126a" + +"@hapi/hoek@6.x.x": + version "6.2.3" + resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-6.2.3.tgz#0abff7ac75d0c5388d2829c464b2aff74d473721" + +"@hapi/joi@^v15.0.3": + version "15.0.3" + resolved "https://registry.yarnpkg.com/@hapi/joi/-/joi-15.0.3.tgz#e94568fd859e5e945126d5675e7dd218484638a7" + dependencies: + "@hapi/address" "2.x.x" + "@hapi/hoek" "6.x.x" + "@hapi/topo" "3.x.x" + +"@hapi/topo@3.x.x": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-3.1.0.tgz#5c47cd9637c2953db185aa957a27bcb2a8b7a6f8" + dependencies: + "@hapi/hoek" "6.x.x" + abbrev@1: version "1.1.1" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" @@ -732,10 +754,6 @@ he@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" -hoek@6.x.x: - version "6.1.2" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-6.1.2.tgz#99e6d070561839de74ee427b61aa476bd6bddfd6" - homedir-polyfill@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz#743298cef4e5af3e194161fbadcc2151d3a058e8" @@ -915,12 +933,6 @@ isarray@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" -isemail@3.x.x: - version "3.2.0" - resolved "https://registry.yarnpkg.com/isemail/-/isemail-3.2.0.tgz#59310a021931a9fb06bbb51e155ce0b3f236832c" - dependencies: - punycode "2.x.x" - isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -954,14 +966,6 @@ istanbul@^0.4.5: which "^1.1.1" wordwrap "^1.0.0" -joi@^v14.3.1: - version "14.3.1" - resolved "https://registry.yarnpkg.com/joi/-/joi-14.3.1.tgz#164a262ec0b855466e0c35eea2a885ae8b6c703c" - dependencies: - hoek "6.x.x" - isemail "3.x.x" - topo "3.x.x" - js-yaml@3.12.0: version "3.12.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" @@ -1371,10 +1375,6 @@ pump@^3.0.0: end-of-stream "^1.1.0" once "^1.3.1" -punycode@2.x.x: - version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - qs@6.5.2: version "6.5.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" @@ -1721,12 +1721,6 @@ to-regex@^3.0.1, to-regex@^3.0.2: regex-not "^1.0.2" safe-regex "^1.1.0" -topo@3.x.x: - version "3.0.3" - resolved "https://registry.yarnpkg.com/topo/-/topo-3.0.3.tgz#d5a67fb2e69307ebeeb08402ec2a2a6f5f7ad95c" - dependencies: - hoek "6.x.x" - type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" From 4d89b15959f51e9177b29889427588462a1faee7 Mon Sep 17 00:00:00 2001 From: Tina Holly Date: Sat, 25 May 2019 09:54:47 -0400 Subject: [PATCH 2/3] update readme to use @hapi/joi --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3a3faa0..746e658 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ app.get('/contacts/:id', contactsHandler); To implement route validation, simply call the provided validation function with the desired schema that uses Joi: ```js +const Joi = require('@hapi/joi'); const validate = require('express-joi-validate'); const contactSchema = { From 5f297f9c00a5cf3f4d966fd9102f4cb50ca8aca2 Mon Sep 17 00:00:00 2001 From: Tina Holly Date: Sat, 25 May 2019 09:57:59 -0400 Subject: [PATCH 3/3] rm node version from travis.yml --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5561ca5..9e925ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,4 @@ language: node_js -node_js: - - "6" script: - npm test - - npm run coverage-ci \ No newline at end of file + - npm run coverage-ci