From daa5405e78c4497a252858a6b399a15fd73fa3c7 Mon Sep 17 00:00:00 2001 From: Vadim Date: Sat, 23 Jul 2022 19:06:56 +0300 Subject: [PATCH] refactor indexFile --- src/index.js | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/index.js b/src/index.js index 704d24bf1..c49edec42 100644 --- a/src/index.js +++ b/src/index.js @@ -15,23 +15,10 @@ isFolderExists('./tests/_generated'); console.info('MODE: ', process.env.PARSE, ''); -// TODO rewrite on object -switch (process.env.PARSE) { - case 'full': - // generateFullTemplate(); - generateFullTemplateHackernoon(FULL_SOURCE); - break; +const modeMap = { + full: () => generateFullTemplateHackernoon(FULL_SOURCE), + // reactContentOnly: () => generateReactContent(CONTENT_SOURCE), + // reactFull: () => generateReactFullTemplate(FULL_SOURCE), +}; - case 'reactContentOnly': - // same as default, but with react components instead. - // generateReactContent(CONTENT_SOURCE); - break; - - case 'reactFull': - // generateReactFullTemplate(FULL_SOURCE); - break; - - default: - // generateFullTemplate(FULL_SOURCE); - break; -} +modeMap[process.env.PARSE ?? 'full']();