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

Export make template functions #17

Merged
merged 5 commits into from
May 23, 2023
Merged

Export make template functions #17

merged 5 commits into from
May 23, 2023

Conversation

lukekarrys
Copy link
Contributor

The only source changes were to export the two existing functions. I tried to add tests and docs to match the existing style. The resulting d.ts file isn't very DRY, I can clean that up if necessary.

Closes #16

@Qix-
Copy link
Member

Qix- commented Mar 27, 2023

Meh the names of those functions kind of rub me the wrong way. Maybe we can improve the names while we're at it. I'll think about it overnight but if you have any ideas feel free to suggest them.

Thanks for the PR :)

@lukekarrys
Copy link
Contributor Author

lukekarrys commented Mar 27, 2023

I'll agree to the names of the functions not being ideal for public consumption. But I don't have any better names off the top of my head.

I marked this PR as allowing edits from maintainers, so feel free to update if you come up with better names.

@Qix-
Copy link
Member

Qix- commented Mar 28, 2023

Instead of exporting makeChalkTemplate directly, do you mind instead making a new function called makeTaggedTemplate that does essentially chalk => makeChalkTemplate(makeTemplate(chalk))?

The net effect being that we export makeTemplate which returns just a string->string function, and makeTaggedTemplate that is a tagged template function, both of which take a Chalk instance.

@lukekarrys
Copy link
Contributor Author

Those suggestion have been implemented. Both functions now take a Chalk instance. Types and tests have been updated as well.

@lukekarrys
Copy link
Contributor Author

Hey @Qix-, friendly ping on this one 😄

My plan was to use this feature once I've landed chalk@5 (npm/cli#6285) which I am slowly working towards. So no rush! Excited for this since once we are on chalk@5 this feature will be a huge help for us.

@sindresorhus sindresorhus merged commit 50b910f into chalk:main May 23, 2023
0 of 2 checks passed
@lukekarrys lukekarrys deleted the lk/make-chalk-template branch May 23, 2023 15:57
midzelis pushed a commit to midzelis/chalk-template that referenced this pull request Jun 13, 2023
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.

Use chalk-template with a custom chalk instance
3 participants