Skip to content

feat(generators): generate algoliasearch JS client #760

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

Merged
merged 9 commits into from
Jun 28, 2022

Conversation

shortcuts
Copy link
Member

@shortcuts shortcuts commented Jun 27, 2022

🧭 What and Why

🎟 JIRA Ticket: https://algolia.atlassian.net/browse/APIC-555

Changes included:

We encountered conflicts after removing the JavaScript from the monorepo, the main one being during the release process, as algoliasearch is a standalone client.

The goal of this PR is to generate algoliasearch as we do with the others, with its nested lite client.

I've tired to move the templates files in their dedicated folder, to avoid confusion in them between a regular client, and algoliasearch.

There should not be any client code changes, except some naming maybe.

🧪 Test

CI :D

@shortcuts shortcuts self-assigned this Jun 27, 2022
@netlify
Copy link

netlify bot commented Jun 27, 2022

Deploy Preview for api-clients-automation canceled.

Name Link
🔨 Latest commit f179252
🔍 Latest deploy log https://app.netlify.com/sites/api-clients-automation/deploys/62bab8bafcad0d0008758642

@algolia-bot
Copy link
Collaborator

algolia-bot commented Jun 27, 2022

✗ 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.

@shortcuts shortcuts force-pushed the feat/generators-algoliasearch-js branch from c7eff09 to ff45ef0 Compare June 27, 2022 14:50
@shortcuts shortcuts force-pushed the feat/generators-algoliasearch-js branch from e54129e to 89645f8 Compare June 27, 2022 15:30
@shortcuts shortcuts requested review from a team, damcou and millotp and removed request for a team June 27, 2022 15:32
@shortcuts shortcuts marked this pull request as ready for review June 27, 2022 15:32
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.

this is really nice ! Maybe some templates files could be removed from the generated if they are static

@@ -225,10 +225,6 @@ jobs:
if: ${{ steps.cache.outputs.cache-hit != 'true' && matrix.client.language != 'php' }}
run: yarn cli build clients ${{ matrix.client.language }} ${{ matrix.client.toBuild }}

- name: Build JavaScript 'algoliasearch' client
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is beautiful

}
export const GENERATORS = Object.entries(
openapiConfig['generator-cli'].generators
).reduce((current, [key, { output, ...gen }]) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think fromEntries would be more readable, up to you

// We want to also delete the nested `lite` client or folders that only exists in JS
if (clientName === 'algoliasearch') {
await run(
`rm -rf ${toAbsolutePath(path.resolve('..', output, 'lite'))}`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should bump the characters per line to 140 ahah this is ridiculous

Copy link
Member Author

Choose a reason for hiding this comment

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

maybe 120 would do it, I'll try at the very end of this PR just to see

@@ -0,0 +1,3 @@
## Usage
Copy link
Collaborator

Choose a reason for hiding this comment

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

those files could stay in their final form, why generated them ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Mostly for portability, and also because they are (almost) identical, except for the requester/timeouts part. I thought it made more sense for later, once the code has been removed from here

@millotp
Copy link
Collaborator

millotp commented Jun 27, 2022

I think there is an issue with the run cts command,the prompt should expect or ask for a client as we can only run all of them

@shortcuts shortcuts requested a review from millotp June 28, 2022 07:56
@shortcuts shortcuts force-pushed the feat/generators-algoliasearch-js branch from 0de3389 to f179252 Compare June 28, 2022 08:15
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.

Looks good !

@shortcuts shortcuts merged commit a3c1861 into main Jun 28, 2022
@shortcuts shortcuts deleted the feat/generators-algoliasearch-js branch June 28, 2022 12:30
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