Skip to content

Commit

Permalink
Catch unexisting readme in metadata initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
lowlighter committed Aug 5, 2021
1 parent f34cd58 commit c5af923
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions source/app/metrics/metadata.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ export default async function metadata({log = true} = {}) {
for (const name of await fs.promises.readdir(__templates)) {
if (!(await fs.promises.lstat(path.join(__templates, name))).isDirectory())
continue
if (/^@/.test(name))
continue
logger(`metrics/metadata > loading template metadata [${name}]`)
Templates[name] = await metadata.template({__templates, name, plugins, logger})
}
Expand Down Expand Up @@ -270,7 +268,7 @@ metadata.template = async function({__templates, name, plugins, logger}) {
try {
//Load meta descriptor
const raw = fs.existsSync(path.join(__templates, name, "metadata.yml")) ? `${await fs.promises.readFile(path.join(__templates, name, "metadata.yml"), "utf-8")}` : ""
const readme = `${await fs.promises.readFile(path.join(__templates, name, "README.md"), "utf-8")}`
const readme = fs.existsSync(path.join(__templates, name, "README.md")) ? `${await fs.promises.readFile(path.join(__templates, name, "README.md"), "utf-8")}` : ""
const meta = yaml.load(raw) ?? {}

//Compatibility
Expand Down

0 comments on commit c5af923

Please sign in to comment.