Skip to content

Conversation

@raducristianpopa
Copy link
Member

EXPERIMENT based on the discussion that took place on 30th of July.

@changeset-bot
Copy link

changeset-bot bot commented Jul 31, 2025

⚠️ No Changeset found

Latest commit: bb33084

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@netlify
Copy link

netlify bot commented Jul 31, 2025

Deploy Preview for openpayments-preview ready!

Name Link
🔨 Latest commit bb33084
🔍 Latest deploy log https://app.netlify.com/projects/openpayments-preview/deploys/688afba6e9df73000848728f
😎 Deploy Preview https://deploy-preview-653--openpayments-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@raducristianpopa raducristianpopa force-pushed the radu/docs-snippets-update-experiment branch from 26535d1 to bb33084 Compare July 31, 2025 05:14
@@ -0,0 +1 @@
export const VERSION = 'v1'
Copy link
Member Author

Choose a reason for hiding this comment

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

We can have a version in:

  • src/docs/content/version.ts (for latest)
  • src/docs/content/1.0/version.ts (for v1)

This version can be used with the new ChunkedSnippet component which will help to detect the correct snippet associated with the major version:

<ChunkedSnippetExperimental source="token/token-revoke.ts" chunk="3" l="node" version={VERSION}  />

At the moment:

  • l: language (i.e. node, rust, etc...) (NB: needs a better name, it was named l since lang and language were already used in the component)
  • source: the file source relative to the root of the snippets folder
  • version: by providing the version the component will read the correct version for the snippets

The path looks lile this: <git-root>/snippets/${version}/${language}/${source}

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think if we did version without the v, to allow for minor version + keep inline with the docs as well?
eg <git-root>/snippets/1.0/node/${source}

Copy link
Member Author

@raducristianpopa raducristianpopa Aug 1, 2025

Choose a reason for hiding this comment

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

I am okay with both approaches. But, thinking more about it, would it be better to name the versions like 1.x 2.x if we only care about versioning major releases? This makes it clearer that we're referring to a major version, rather than a specific release.

Copy link
Member Author

Choose a reason for hiding this comment

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

Bringing more context:

Me and Max played with versioning a bit and we noticed that the OpenAPI definitions are not versioned by default. In the Astro config we will have to manually add the entries for 1.0/openapi/.....

One thing that we found out is that we will not be able to use dots for the path (1.0/openapi/...) and we will have to go for something like v1/openapi/.....

Comment on lines +11 to +17
const gitRoot = execSync('git rev-parse --show-toplevel').toString().trim();
const snippetsPath = path.join(gitRoot, 'snippets');

const getChunk = async () => {
const data = await fs.readFile(path.join(snippetsPath, version, l, source), {encoding: "utf8"})
return data
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the only code change that happened in this file - how we retrieve the source: readFile instead of a HTTP request.

@melissahenderson
Copy link
Contributor

@mkurapov @raducristianpopa Is this OK to close?

@mkurapov
Copy link
Contributor

mkurapov commented Oct 1, 2025

Closing as completed in #689

@mkurapov mkurapov closed this Oct 1, 2025
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.

3 participants