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(cli): export cli actions as node apis #135

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

matthewvolk
Copy link
Contributor

@matthewvolk matthewvolk commented Mar 13, 2024

Summary

Resolves #134

Abstract core logic for generate-schema and generate-output CLI commands into importable Node.js APIs.

Set of changes

The diff is large, but the code is largely the same, mostly just moved around:

  • All of the logic in generateSchema is unchanged, with the exception of header parsing being pulled out of the function and now headers are passed in as a Record<string,string>. Additionally, cwd is now an optional parameter (helpful when this methods are called from a directory outside of the directory containing your project's tsconfig.json file, e.g., npm create some-project).
  • generateTadaTypes is almost entirely unchanged, cwd is now an optional parameter.

Copy link

changeset-bot bot commented Mar 13, 2024

🦋 Changeset detected

Latest commit: 8dc6640

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

packages/cli-utils/src/index.ts Outdated Show resolved Hide resolved
@JoviDeCroock
Copy link
Member

Also needs a changeset

@@ -1,4 +1,4 @@
#!/usr/bin/env node

import cli from '@gql.tada/cli-utils';
cli();
(cli as any).default();
Copy link
Member

Choose a reason for hiding this comment

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

Are the types erroneously generated now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Confirmed types for gql-data-cli.d.ts are the same as they were previous to this change 👍🙂

@JoviDeCroock JoviDeCroock merged commit 88ec0a6 into 0no-co:main Mar 13, 2024
2 checks passed
@github-actions github-actions bot mentioned this pull request Mar 13, 2024
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.

RFC: Exposing the generate-schema and generate-output actions from cli-utils as Node.js API's
2 participants