Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add more messages here, and finally replace messages in our methods #1518

Open
github-actions bot opened this issue Feb 14, 2023 · 0 comments
Open

add more messages here, and finally replace messages in our methods #1518

github-actions bot opened this issue Feb 14, 2023 · 0 comments
Labels

Comments

@github-actions
Copy link

// TODO add more messages here, and finally replace messages in our methods

import {
  generateHtmlFullTemplateHackernoon,
  generateReactFullTemplateHackernoon,
  generateHtmlFullTemplateRecipes,
} from './src';
import {
  readSourceFile,
  generateTemplateName,
  printMessage,
} from './src/helper';
import { writeHTML, isFolderExists } from './src/domain/write';
import { deliver } from './src/domain/deliver/deliver';
import { MESSAGE_HTML_FULL_TEMPLATE2 } from './src/domain/deliver/deliver.constants';

// TODO add more messages here, and finally replace messages in our methods
const MESSAGE_REACT_FULL_TEMPLATE =
  'The FullTemplate has been parsed successfully';
// const MESSAGE_REACT_CONTENT = 'The Content has been parsed successfully';

//-------------------
// @TODO add path package, in order to make it work PERFECTLY
const FULL_SOURCE = 'source/source.md';
const RECIPES_SOURCE = 'source/recipes/source-nmtg.md';

const markdown = readSourceFile(FULL_SOURCE);

isFolderExists('./generated');
isFolderExists('./tests/_generated');

export const modes = {
  full: () => {
    const hackernoonFullTemplate = generateHtmlFullTemplateHackernoon(markdown);

    deliver(
      hackernoonFullTemplate,
      'hackernoon-full-template',
      MESSAGE_HTML_FULL_TEMPLATE2,
    );
  },
  reactFull: () => {
    const fullContent = generateReactFullTemplateHackernoon(markdown);

    // TODO replace this three rows on deliver function
    const fileName = generateTemplateName('FullTemplate', 'js');
    writeHTML(fileName, fullContent);
    printMessage(MESSAGE_REACT_FULL_TEMPLATE, 'green2');
  },
  recipesFull: () => {
    const markdownRecipes = readSourceFile(RECIPES_SOURCE);

    const recipesFullTemplate =
      generateHtmlFullTemplateRecipes(markdownRecipes);

    deliver(
      recipesFullTemplate,
      'recipes-full-template',
      MESSAGE_HTML_FULL_TEMPLATE2,
    );
  },
};

modes[process.env.PARSE ?? 'full'](FULL_SOURCE);
@github-actions github-actions bot added the todo label Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants