mirror of
https://github.com/BradNut/awesome-uses
synced 2025-09-08 17:40:31 +00:00
move to joi package
This commit is contained in:
parent
0be615a79f
commit
c4c8f32204
3 changed files with 12 additions and 76 deletions
66
package-lock.json
generated
66
package-lock.json
generated
|
|
@ -14,7 +14,6 @@
|
||||||
"@babel/core": "^7.16.7",
|
"@babel/core": "^7.16.7",
|
||||||
"@babel/eslint-parser": "^7.16.5",
|
"@babel/eslint-parser": "^7.16.5",
|
||||||
"@babel/preset-react": "^7.16.7",
|
"@babel/preset-react": "^7.16.7",
|
||||||
"@hapi/joi": "^17.0.2",
|
|
||||||
"@types/node": "^16.11.19",
|
"@types/node": "^16.11.19",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.9.1",
|
"@typescript-eslint/eslint-plugin": "^5.9.1",
|
||||||
"@typescript-eslint/parser": "^5.9.1",
|
"@typescript-eslint/parser": "^5.9.1",
|
||||||
|
|
@ -31,6 +30,7 @@
|
||||||
"gatsby-plugin-web-font-loader": "^1.0.4",
|
"gatsby-plugin-web-font-loader": "^1.0.4",
|
||||||
"gatsby-source-filesystem": "^2.1.40",
|
"gatsby-source-filesystem": "^2.1.40",
|
||||||
"gatsby-transformer-sharp": "^2.3.7",
|
"gatsby-transformer-sharp": "^2.3.7",
|
||||||
|
"joi": "^17.5.0",
|
||||||
"normalize.css": "^8.0.1",
|
"normalize.css": "^8.0.1",
|
||||||
"prop-types": "^15.7.2",
|
"prop-types": "^15.7.2",
|
||||||
"react": "^16.12.0",
|
"react": "^16.12.0",
|
||||||
|
|
@ -2193,51 +2193,17 @@
|
||||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz",
|
||||||
"integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w=="
|
"integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w=="
|
||||||
},
|
},
|
||||||
"node_modules/@hapi/address": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/address/-/address-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-SkszZf13HVgGmChdHo/PxchnSaCJ6cetVqLzyciudzZRT0jcOouIF/Q93mgjw8cce+D+4F4C1Z/WrfFN+O3VHQ==",
|
|
||||||
"deprecated": "Moved to 'npm install @sideway/address'",
|
|
||||||
"dependencies": {
|
|
||||||
"@hapi/hoek": "^9.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@hapi/bourne": {
|
"node_modules/@hapi/bourne": {
|
||||||
"version": "1.3.2",
|
"version": "1.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-1.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-1.3.2.tgz",
|
||||||
"integrity": "sha512-1dVNHT76Uu5N3eJNTYcvxee+jzX4Z9lfciqRRHCU27ihbUcYi+iSc2iml5Ke1LXe1SyJCLA0+14Jh4tXJgOppA==",
|
"integrity": "sha512-1dVNHT76Uu5N3eJNTYcvxee+jzX4Z9lfciqRRHCU27ihbUcYi+iSc2iml5Ke1LXe1SyJCLA0+14Jh4tXJgOppA==",
|
||||||
"deprecated": "This version has been deprecated and is no longer supported or maintained"
|
"deprecated": "This version has been deprecated and is no longer supported or maintained"
|
||||||
},
|
},
|
||||||
"node_modules/@hapi/formula": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/formula/-/formula-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-V87P8fv7PI0LH7LiVi8Lkf3x+KCO7pQozXRssAHNXXL9L1K+uyu4XypLXwxqVDKgyQai6qj3/KteNlrqDx4W5A==",
|
|
||||||
"deprecated": "Moved to 'npm install @sideway/formula'"
|
|
||||||
},
|
|
||||||
"node_modules/@hapi/hoek": {
|
"node_modules/@hapi/hoek": {
|
||||||
"version": "9.2.1",
|
"version": "9.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz",
|
||||||
"integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw=="
|
"integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw=="
|
||||||
},
|
},
|
||||||
"node_modules/@hapi/joi": {
|
|
||||||
"version": "17.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/joi/-/joi-17.1.1.tgz",
|
|
||||||
"integrity": "sha512-p4DKeZAoeZW4g3u7ZeRo+vCDuSDgSvtsB/NpfjXEHTUjSeINAi/RrVOWiVQ1isaoLzMvFEhe8n5065mQq1AdQg==",
|
|
||||||
"deprecated": "Switch to 'npm install joi'",
|
|
||||||
"dependencies": {
|
|
||||||
"@hapi/address": "^4.0.1",
|
|
||||||
"@hapi/formula": "^2.0.0",
|
|
||||||
"@hapi/hoek": "^9.0.0",
|
|
||||||
"@hapi/pinpoint": "^2.0.0",
|
|
||||||
"@hapi/topo": "^5.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@hapi/pinpoint": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/pinpoint/-/pinpoint-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-vzXR5MY7n4XeIvLpfl3HtE3coZYO4raKXW766R6DZw/6aLqR26iuZ109K7a0NtF2Db0jxqh7xz2AxkUwpUFybw==",
|
|
||||||
"deprecated": "Moved to 'npm install @sideway/pinpoint'"
|
|
||||||
},
|
|
||||||
"node_modules/@hapi/topo": {
|
"node_modules/@hapi/topo": {
|
||||||
"version": "5.1.0",
|
"version": "5.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz",
|
||||||
|
|
@ -29425,46 +29391,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@hapi/address": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/address/-/address-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-SkszZf13HVgGmChdHo/PxchnSaCJ6cetVqLzyciudzZRT0jcOouIF/Q93mgjw8cce+D+4F4C1Z/WrfFN+O3VHQ==",
|
|
||||||
"requires": {
|
|
||||||
"@hapi/hoek": "^9.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@hapi/bourne": {
|
"@hapi/bourne": {
|
||||||
"version": "1.3.2",
|
"version": "1.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-1.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-1.3.2.tgz",
|
||||||
"integrity": "sha512-1dVNHT76Uu5N3eJNTYcvxee+jzX4Z9lfciqRRHCU27ihbUcYi+iSc2iml5Ke1LXe1SyJCLA0+14Jh4tXJgOppA=="
|
"integrity": "sha512-1dVNHT76Uu5N3eJNTYcvxee+jzX4Z9lfciqRRHCU27ihbUcYi+iSc2iml5Ke1LXe1SyJCLA0+14Jh4tXJgOppA=="
|
||||||
},
|
},
|
||||||
"@hapi/formula": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/formula/-/formula-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-V87P8fv7PI0LH7LiVi8Lkf3x+KCO7pQozXRssAHNXXL9L1K+uyu4XypLXwxqVDKgyQai6qj3/KteNlrqDx4W5A=="
|
|
||||||
},
|
|
||||||
"@hapi/hoek": {
|
"@hapi/hoek": {
|
||||||
"version": "9.2.1",
|
"version": "9.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz",
|
||||||
"integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw=="
|
"integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw=="
|
||||||
},
|
},
|
||||||
"@hapi/joi": {
|
|
||||||
"version": "17.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/joi/-/joi-17.1.1.tgz",
|
|
||||||
"integrity": "sha512-p4DKeZAoeZW4g3u7ZeRo+vCDuSDgSvtsB/NpfjXEHTUjSeINAi/RrVOWiVQ1isaoLzMvFEhe8n5065mQq1AdQg==",
|
|
||||||
"requires": {
|
|
||||||
"@hapi/address": "^4.0.1",
|
|
||||||
"@hapi/formula": "^2.0.0",
|
|
||||||
"@hapi/hoek": "^9.0.0",
|
|
||||||
"@hapi/pinpoint": "^2.0.0",
|
|
||||||
"@hapi/topo": "^5.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@hapi/pinpoint": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/pinpoint/-/pinpoint-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-vzXR5MY7n4XeIvLpfl3HtE3coZYO4raKXW766R6DZw/6aLqR26iuZ109K7a0NtF2Db0jxqh7xz2AxkUwpUFybw=="
|
|
||||||
},
|
|
||||||
"@hapi/topo": {
|
"@hapi/topo": {
|
||||||
"version": "5.1.0",
|
"version": "5.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz",
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
"@babel/core": "^7.16.7",
|
"@babel/core": "^7.16.7",
|
||||||
"@babel/eslint-parser": "^7.16.5",
|
"@babel/eslint-parser": "^7.16.5",
|
||||||
"@babel/preset-react": "^7.16.7",
|
"@babel/preset-react": "^7.16.7",
|
||||||
"@hapi/joi": "^17.0.2",
|
|
||||||
"@types/node": "^16.11.19",
|
"@types/node": "^16.11.19",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.9.1",
|
"@typescript-eslint/eslint-plugin": "^5.9.1",
|
||||||
"@typescript-eslint/parser": "^5.9.1",
|
"@typescript-eslint/parser": "^5.9.1",
|
||||||
|
|
@ -35,6 +34,7 @@
|
||||||
"gatsby-plugin-web-font-loader": "^1.0.4",
|
"gatsby-plugin-web-font-loader": "^1.0.4",
|
||||||
"gatsby-source-filesystem": "^2.1.40",
|
"gatsby-source-filesystem": "^2.1.40",
|
||||||
"gatsby-transformer-sharp": "^2.3.7",
|
"gatsby-transformer-sharp": "^2.3.7",
|
||||||
|
"joi": "^17.5.0",
|
||||||
"normalize.css": "^8.0.1",
|
"normalize.css": "^8.0.1",
|
||||||
"prop-types": "^15.7.2",
|
"prop-types": "^15.7.2",
|
||||||
"react": "^16.12.0",
|
"react": "^16.12.0",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
const exec = require('@actions/exec');
|
const exec = require('@actions/exec');
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
const github = require('@actions/github');
|
const github = require('@actions/github');
|
||||||
const Joi = require('@hapi/joi');
|
const Joi = require('joi');
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
const https = require('https');
|
const https = require('https');
|
||||||
const flags = require('./flags.js');
|
const flags = require('./flags.js');
|
||||||
|
|
@ -13,8 +13,8 @@ async function getCurrentBranchName() {
|
||||||
const options = {
|
const options = {
|
||||||
silent: true,
|
silent: true,
|
||||||
listeners: {
|
listeners: {
|
||||||
stdout: data => (myOutput += data.toString()),
|
stdout: (data) => (myOutput += data.toString()),
|
||||||
stderr: data => (myError += data.toString()),
|
stderr: (data) => (myError += data.toString()),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -23,7 +23,7 @@ async function getCurrentBranchName() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** on master branch will return an empty array */
|
/** on master branch will return an empty array */
|
||||||
module.exports.getMasterData = async function() {
|
module.exports.getMasterData = async function () {
|
||||||
const options = { silent: true };
|
const options = { silent: true };
|
||||||
const curentBranchName = await getCurrentBranchName();
|
const curentBranchName = await getCurrentBranchName();
|
||||||
// when on a branch/PR different from master
|
// when on a branch/PR different from master
|
||||||
|
|
@ -67,7 +67,7 @@ module.exports.Schema = Joi.object({
|
||||||
tags: Joi.array().items(Joi.string()),
|
tags: Joi.array().items(Joi.string()),
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports.getStatusCode = function(url) {
|
module.exports.getStatusCode = function (url) {
|
||||||
const client = url.startsWith('https') ? https : http;
|
const client = url.startsWith('https') ? https : http;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const REQUEST_TIMEOUT = 10000;
|
const REQUEST_TIMEOUT = 10000;
|
||||||
|
|
@ -78,17 +78,17 @@ module.exports.getStatusCode = function(url) {
|
||||||
);
|
);
|
||||||
|
|
||||||
client
|
client
|
||||||
.get(url, res => {
|
.get(url, (res) => {
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
resolve(res.statusCode);
|
resolve(res.statusCode);
|
||||||
})
|
})
|
||||||
.on('error', err => reject(err));
|
.on('error', (err) => reject(err));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// If there are errors, will fail the action & add a comment detailing the issues
|
// If there are errors, will fail the action & add a comment detailing the issues
|
||||||
// If there are no errors, will leave an "all-clear" comment with relevant URLs (to ease a potential manual check)
|
// If there are no errors, will leave an "all-clear" comment with relevant URLs (to ease a potential manual check)
|
||||||
module.exports.communicateValidationOutcome = async function(
|
module.exports.communicateValidationOutcome = async function (
|
||||||
errors,
|
errors,
|
||||||
failedUrls,
|
failedUrls,
|
||||||
changedData
|
changedData
|
||||||
|
|
@ -99,8 +99,8 @@ module.exports.communicateValidationOutcome = async function(
|
||||||
|
|
||||||
comment += [
|
comment += [
|
||||||
'🚨 We have detected the following issues, let us (contributors) know if you need support or clarifications:',
|
'🚨 We have detected the following issues, let us (contributors) know if you need support or clarifications:',
|
||||||
...errors.map(e => `- ${e.message}`),
|
...errors.map((e) => `- ${e.message}`),
|
||||||
...failedUrls.map(url => `- URL is invalid: ${url}`),
|
...failedUrls.map((url) => `- URL is invalid: ${url}`),
|
||||||
].join('\n');
|
].join('\n');
|
||||||
} else {
|
} else {
|
||||||
comment += [
|
comment += [
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue