summaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorKasra Bigdeli <[email protected]>2020-08-16 08:40:00 -0400
committerKasra Bigdeli <[email protected]>2020-08-16 08:40:00 -0400
commitb67f5f8aa1e79fc6fcdd3b4e2e75b5d06daa1bb4 (patch)
tree3240f264edc75a583ca49f7506e7c6c2177bf50e /scripts
parent54468bde290fc7c5d515e56ccd851d446a49f76c (diff)
downloadcaprover-one-click-apps-b67f5f8aa1e79fc6fcdd3b4e2e75b5d06daa1bb4.tar.gz
caprover-one-click-apps-b67f5f8aa1e79fc6fcdd3b4e2e75b5d06daa1bb4.zip
Updated validator - linter fixes
Diffstat (limited to 'scripts')
-rw-r--r--scripts/validate_json.js32
1 files changed, 12 insertions, 20 deletions
diff --git a/scripts/validate_json.js b/scripts/validate_json.js
index 3cd5071..6e71702 100644
--- a/scripts/validate_json.js
+++ b/scripts/validate_json.js
@@ -1,15 +1,15 @@
/*jshint esversion: 6 */
const path = require('path');
- const fs = require('fs-extra')
+ const fs = require('fs-extra');
- const PUBLIC = `public`
+ const PUBLIC = `public`;
const pathOfPublic = path.join(__dirname, '..', PUBLIC);
// validating version 2
function validate() {
- const version = '2'
+ const version = '2';
const pathOfVersion = path.join(pathOfPublic, 'v' + version);
const pathOfApps = path.join(pathOfVersion, 'apps');
@@ -17,15 +17,14 @@
.then(function (items) {
const apps = items.filter(v => v.includes('.json'));
- const appDetails = [];
for (var i = 0; i < apps.length; i++) {
const contentString = fs.readFileSync(path.join(pathOfApps, apps[i]));
- const content = JSON.parse(contentString)
+ const content = JSON.parse(contentString);
const captainVersion = (content.captainVersion + '');
const versionString = (version + '');
if (versionString !== captainVersion)
- throw new Error(`unmatched versions ${versionString} ${captainVersion} for ${apps[i]}`)
+ throw new Error(`unmatched versions ${versionString} ${captainVersion} for ${apps[i]}`);
apps[i] = apps[i].replace('.json', '');
@@ -37,35 +36,28 @@
const logoFileName = apps[i] + '.png';
- appDetails[i] = {
- name: apps[i],
- displayName: content.displayName,
- description: content.description,
- logoUrl: logoFileName
- }
-
const logoFullPath = path.join(pathOfVersion, 'logos', logoFileName);
if (!fs.existsSync(logoFullPath) ||
!fs.statSync(logoFullPath).isFile()) {
let printablePath = logoFullPath;
- printablePath = printablePath.substr(printablePath.indexOf(`/${PUBLIC}`))
+ printablePath = printablePath.substr(printablePath.indexOf(`/${PUBLIC}`));
throw new Error(`Cannot find logo for ${apps[i]} ${printablePath}`);
}
- console.log(`Validated ${apps[i]}`)
+ console.log(`Validated ${apps[i]}`);
}
- })
+ });
}
Promise.resolve()
.then(function () {
- return validate()
+ return validate();
})
.catch(function (err) {
- console.error(err)
- process.exit(127)
- }) \ No newline at end of file
+ console.error(err);
+ process.exit(127);
+ }); \ No newline at end of file