diff --git a/npm_run_puplish.js b/npm_run_puplish.js index 243c3c0..8b237db 100644 --- a/npm_run_puplish.js +++ b/npm_run_puplish.js @@ -16,6 +16,7 @@ .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])); @@ -27,12 +28,30 @@ if (captainVersion === "1") { if (contentString.includes("$$cap_root_domain")) throw new Error('V1 should not have root domain') + } else { + } + apps[i] = apps[i].replace('.json', ''); + + if (captainVersion + '' === '2') { + if (!content.displayName) content.displayName = apps[i] + if (!content.description) content.description = '' + if (!content.imageUrl) content.imageUrl = 'https://caprover.com/img/logo.png' + + appDetails[i] = { + name: apps[i], + displayName: content.displayName, + description: content.description, + imageUrl: content.imageUrl, + } + } + } fs.outputJsonSync(pathOfList, { - appList: apps + appList: apps, + appDetails: appDetails }); })