Skip to content

Commit

Permalink
feat(1958): Upgrade to @hapi/hapi v19.x.x. BREAKING CHANGE: pull joi v17
Browse files Browse the repository at this point in the history
feat(1958): Upgrade to @hapi/hapi v19.x.x. BREAKING CHANGE: pull joi v17
  • Loading branch information
pritamstyz4ever authored Aug 26, 2020
2 parents 51f9037 + 17f1aa0 commit 7606044
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
17 changes: 6 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const Joi = require('joi');
const SCHEMA_CONFIG = require('screwdriver-data-schema').config.command.schemaCommand;
const Yaml = require('js-yaml');

Expand All @@ -20,18 +19,14 @@ function loadCommandSpecYaml(yamlString) {
* @param {Object} commandObj Configuration object that represents the command
* @return {Promise} Promise that resolves to the passed-in config object
*/
function validateCommand(commandObj) {
return new Promise((resolve, reject) => {
Joi.validate(commandObj, SCHEMA_CONFIG, {
async function validateCommand(commandObj) {
try {
return await SCHEMA_CONFIG.validateAsync(commandObj, {
abortEarly: false
}, (err, data) => {
if (err) {
return reject(err);
}

return resolve(data);
});
});
} catch (err) {
throw err;
}
}

/**
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "screwdriver-command-validator",
"version": "1.0.0",
"version": "2.0.0",
"description": "A module for validating a Screwdriver Command file",
"main": "index.js",
"scripts": {
"pretest": "eslint .",
"test": "jenkins-mocha --recursive",
"test": "mocha --recursive",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"repository": {
Expand Down Expand Up @@ -34,17 +34,17 @@
"Tiffany Kyi <tiffanykyi@gmail.com>"
],
"devDependencies": {
"@hapi/hoek": "^9.0.4",
"chai": "^3.5.0",
"eslint": "^4.3.0",
"eslint-config-screwdriver": "^3.0.0",
"hoek": "^4.1.0",
"jenkins-mocha": "^6.0.0"
"mocha": "^8.1.1"
},
"dependencies": {
"commander": "^2.12.2",
"joi": "^13.0.0",
"joi": "^17.2.0",
"js-yaml": "^3.8.1",
"screwdriver-data-schema": "^19.1.1"
"screwdriver-data-schema": "^20.0.0"
},
"release": {
"debug": false,
Expand Down
2 changes: 1 addition & 1 deletion screwdriver.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
shared:
image: node:8
image: node:12

jobs:
main:
Expand Down
2 changes: 1 addition & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const assert = require('chai').assert;
const fs = require('fs');
const hoek = require('hoek');
const hoek = require('@hapi/hoek');
const path = require('path');
const validator = require('../index.js');

Expand Down

0 comments on commit 7606044

Please sign in to comment.