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(scripts): move helpers to snippet files for algolia doc #3197

Merged
merged 4 commits into from
Jun 18, 2024

Conversation

shortcuts
Copy link
Member

@shortcuts shortcuts commented Jun 17, 2024

🧭 What and Why

🎟 JIRA Ticket: https://algolia.atlassian.net/browse/DI-2458

Changes included:

duplicates the snippets for our netlify doc to the JSON of the initial snippet, with a template pattern, this allows us to ship a single file to the documentation, which doesn't use JS anyway so it's better if we let them do the templating/variable replace directly

also move the specs logic to its own folder, the file was pretty complicate to navigate in

@shortcuts shortcuts self-assigned this Jun 17, 2024
@algolia-bot
Copy link
Collaborator

algolia-bot commented Jun 17, 2024

✗ The generated branch has been deleted.

If the PR has been merged, you can check the generated code on the main branch.
You can still access the code generated on main via this commit.

Copy link

github-actions bot commented Jun 17, 2024

@github-actions github-actions bot temporarily deployed to pull request June 17, 2024 20:20 Inactive
Base automatically changed from feat/scripts-push-to-docs to main June 18, 2024 08:25
@shortcuts shortcuts force-pushed the feat/move-hepers-for-algolia-docs branch from a4dd3e5 to 0996a50 Compare June 18, 2024 08:26
@shortcuts shortcuts marked this pull request as ready for review June 18, 2024 08:26
@shortcuts shortcuts requested a review from a team as a code owner June 18, 2024 08:26
@shortcuts shortcuts requested review from damcou and millotp June 18, 2024 08:26
};

export const waitForTask = {
csharp: `await client.WaitForTaskAsync("<<indexName>>", response.TaskID);`,
Copy link
Member Author

Choose a reason for hiding this comment

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

I've used this format for templating for now but it will most likely evolve from @kai687 's PoC

Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe we can use the same format as for our CTS, we use ${{localhost}} for example

Copy link
Member Author

Choose a reason for hiding this comment

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

It will change for sure later anyway so... I guess we don't really mind for now

Comment on lines 46 to 62
if (!('waitForAppTask' in snippetSamples[language])) {
snippetSamples[language].waitForAppTask = {
default: waitForAppTask[language],
};
}

if (!('waitForApiKey' in snippetSamples[language])) {
snippetSamples[language].waitForApiKey = {
default: waitForApiKey[language],
};
}

if (!('waitForTask' in snippetSamples[language])) {
snippetSamples[language].waitForTask = {
default: waitForTask[language],
};
}
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 actually the only bits that changed, lmk if you want 2 PRs instead for the file move

@github-actions github-actions bot temporarily deployed to pull request June 18, 2024 08:41 Inactive
Copy link
Collaborator

@millotp millotp left a comment

Choose a reason for hiding this comment

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

look good ! nice split

import fsp from 'fs/promises';

import { GENERATORS, capitalize, createClientName, toAbsolutePath } from '../common.js';
import type { CodeSamples, Language, SnippetForMethod, SnippetSamples } from '../types.js';
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you move some of those types to the new types.ts file pls ?

Copy link
Member Author

Choose a reason for hiding this comment

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

indeed!

};

export const waitForTask = {
csharp: `await client.WaitForTaskAsync("<<indexName>>", response.TaskID);`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe we can use the same format as for our CTS, we use ${{localhost}} for example

@shortcuts shortcuts requested a review from millotp June 18, 2024 13:16
@github-actions github-actions bot temporarily deployed to pull request June 18, 2024 13:43 Inactive
@shortcuts shortcuts enabled auto-merge (squash) June 18, 2024 13:46
@github-actions github-actions bot temporarily deployed to pull request June 18, 2024 14:00 Inactive
Copy link
Collaborator

@millotp millotp left a comment

Choose a reason for hiding this comment

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

perfect !

@shortcuts shortcuts merged commit 21490f8 into main Jun 18, 2024
21 checks passed
@shortcuts shortcuts deleted the feat/move-hepers-for-algolia-docs branch June 18, 2024 14:56
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