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

chore: interpolate example code in README.md for each package #40

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

jemc
Copy link
Collaborator

@jemc jemc commented Jun 5, 2024

This script will modify the given files (all CLI arguments passed to the script are interpreted as filenames) to interpolate example code from files.

It looks for lines that look like this:

This example code shows how to do X.

And replaces those occurrences to look like this:

This example code shows how to do X.

// Contents of ../path/to/file.ts

This simple hack allows us to keep our code examples in separate files (which are runnable and testable in CI), while still including them inline in the documentation that gets published to npmjs.org for the packages.

This script will modify the given files (all CLI arguments passed to the
script are interpreted as filenames) to interpolate example code from files.

It looks for lines that look like this:

[This example code](../path/to/file.ts) shows how to do X.

And replaces those occurrences to look like this:

This example code shows how to do X.

```ts
// Contents of ../path/to/file.ts
```

This simple hack allows us to keep our code examples in separate files
(which are runnable and testable in CI), while still including them inline in
the documentation that gets published to npmjs.org for the packages.
@jemc jemc force-pushed the chore/interpolate-example-code-in-readmes branch from 5e42a8b to 017cebc Compare June 5, 2024 20:58
Copy link
Collaborator

@InfraK InfraK left a comment

Choose a reason for hiding this comment

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

Very nice! Works like a charm!

@jemc jemc merged commit 786b799 into main Jun 7, 2024
1 check passed
@jemc jemc deleted the chore/interpolate-example-code-in-readmes branch June 7, 2024 17:08
Copy link

🎉 This PR is included in version @formula-monks/kurt-v1.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version @formula-monks/kurt-open-ai-v1.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version @formula-monks/kurt-vertex-ai-v1.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants