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

feat: introduce based generator logic #42

Merged
merged 13 commits into from
Jul 21, 2024
Merged

Conversation

ovflowd
Copy link
Member

@ovflowd ovflowd commented Jul 20, 2024

Description

This PR introduces the base generator modules. This should be integrated together with the CLI Pull Request, as the CLI should pass the CLI options to the generators.

Validation

Please verify that the code works and that it is well documented.

Test snippet

import { resolve } from 'node:path';
import createGenerator from './src/generators.mjs';
import createLoader from './src/loader.mjs';
import createParser from './src/parser.mjs';

const { loadFiles } = createLoader();
const { parseApiDocs } = createParser();

const apiDocFiles = loadFiles('../node/doc/api/http.md');

const parsedApiDocs = await parseApiDocs(apiDocFiles);

const { runGenerators } = createGenerator(parsedApiDocs);

await runGenerators({
  generators: ['jsonSimple'],
  output: resolve('.'),
});

Notes: I assume the CLI script will pass the options gotten from the CLI args to the generator; The output property must be a resolved path, and generators the generators they passed on CLI.

@ovflowd ovflowd requested a review from a team as a code owner July 20, 2024 22:18
@ovflowd ovflowd requested a review from canerakdas July 20, 2024 22:24
src/generators.mjs Outdated Show resolved Hide resolved
src/generators/types.d.ts Outdated Show resolved Hide resolved
src/generators/types.d.ts Outdated Show resolved Hide resolved
src/metadata.mjs Show resolved Hide resolved
Co-authored-by: Caner Akdas <canerakdas@gmail.com>
@ovflowd
Copy link
Member Author

ovflowd commented Jul 21, 2024

@canerakdas is this PR good to go? I believe this needs to land first before your CLI PR

Copy link
Member

@canerakdas canerakdas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@ovflowd ovflowd merged commit 5d2c825 into main Jul 21, 2024
6 checks passed
@ovflowd ovflowd deleted the feat/introduce-generator-engine branch July 21, 2024 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants