From 983a88d2f8422c25888f22c5e10c3c3a9f077220 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Fri, 13 Sep 2024 10:44:55 +0200 Subject: [PATCH] more testing --- dist/main.js | 6 ++++-- src/get-prereqs.mjs | 10 +++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/dist/main.js b/dist/main.js index b04a517..4841a1f 100644 --- a/dist/main.js +++ b/dist/main.js @@ -24423,12 +24423,14 @@ var getPrereqs = async ({ if (content === null) { continue; } - const parser = source == "prereqs.json" ? parsePrereqsJSON : source == "prereqs.yml" ? parsePrereqsYAML : source.match(/\.json$/) ? parseMetaJSON : source.match(/\.ya?ml$/) ? parseMetaYAML : source.match(/makefile$/i) ? parseMakefile : source.match(/cpanfile/i) ? parseCPANfile : null; + const parser = source.match(/prereqs\.json$/) ? parsePrereqsJSON : source.match(/prereqs\.yml/) ? parsePrereqsYAML : source.match(/\.json$/) ? parseMetaJSON : source.match(/\.ya?ml$/) ? parseMetaYAML : source.match(/makefile$/i) ? parseMakefile : source.match(/cpanfile/i) ? parseCPANfile : null; if (parser === null) { throw new Error(`Don't know how to parse ${source}`); } + const reqs = await parser(content); + console.log(reqs); const filteredPrereqs = filterPrereqs({ - prereqs: await parser(content), + prereqs: reqs, phases: new Set(phases), relationships: new Set(relationships), features: new Set(features) diff --git a/src/get-prereqs.mjs b/src/get-prereqs.mjs index cd3ded0..1f1bbb1 100644 --- a/src/get-prereqs.mjs +++ b/src/get-prereqs.mjs @@ -126,8 +126,8 @@ export const getPrereqs = async ({ } const parser = - source == 'prereqs.json' ? parsePrereqsJSON - : source == 'prereqs.yml' ? parsePrereqsYAML + source.match(/prereqs\.json$/) ? parsePrereqsJSON + : source.match(/prereqs\.yml/) ? parsePrereqsYAML : source.match(/\.json$/) ? parseMetaJSON : source.match(/\.ya?ml$/) ? parseMetaYAML : source.match(/makefile$/i) ? parseMakefile @@ -137,8 +137,12 @@ export const getPrereqs = async ({ throw new Error(`Don't know how to parse ${source}`); } + const reqs = await parser(content); + + console.log(reqs); + const filteredPrereqs = filterPrereqs({ - prereqs: await parser(content), + prereqs: reqs, phases: new Set(phases), relationships: new Set(relationships), features: new Set(features),