Skip to content

chore(js): decouple workspaces APIC-550 #739

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 13 commits into from
Jun 24, 2022
Merged

chore(js): decouple workspaces APIC-550 #739

merged 13 commits into from
Jun 24, 2022

Conversation

millotp
Copy link
Collaborator

@millotp millotp commented Jun 23, 2022

🧭 What and Why

🎟 JIRA Ticket: APIC-550

Remove js client and tests from the monorepo workspaces, this allows for more control for when we want to install the deps and should reduce CI times.
Also useful because we don't need to bump the playground and the tests because we use relative path instead of version.

It should make it easier for the release too, there is only one place where we need to run YARN_ENABLE_IMMUTABLE_INSTALLS=false (after the generation)

It may make things more difficult when editing package.json, you need to make sure to run yarn install at some point

Changes included:

  • Create yarn.lock for js client and js tests
  • Cache the deps for all node_modules
  • Remove supportingFile for js cts, because we use relative path

🧪 Test

run the playground

@millotp millotp self-assigned this Jun 23, 2022
@netlify
Copy link

netlify bot commented Jun 23, 2022

Deploy Preview for api-clients-automation canceled.

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

@millotp millotp marked this pull request as draft June 23, 2022 17:02
@millotp millotp force-pushed the chore/decouple-js branch from 6d0aeae to 56b2d02 Compare June 23, 2022 17:07
@algolia-bot
Copy link
Collaborator

algolia-bot commented Jun 23, 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.

@millotp millotp requested review from a team, damcou and shortcuts and removed request for a team June 23, 2022 18:08
@millotp millotp marked this pull request as ready for review June 23, 2022 18:08
Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

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

I understand the motivations but not sure to see the benefits compared to the working solution we have (for now).

However, as we plan to remove generated code from this repo so it’s a great first step!

@millotp
Copy link
Collaborator Author

millotp commented Jun 24, 2022

I understand the motivations but not sure to see the benefits compared to the working solution we have (for now).

The benefits is that this remove some of the specific logic for js, and allows to work like any other language (if we didn't cache the node_modules, maybe this could be done dynamically), and it makes sure that our playground and cts is always coupled to the correct api client version, not a random one on npm

Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

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

The benefits is that this remove some of the specific logic for js

I agree, but wanted to know if there was any other compared to the logic in place. Again, it's a first step of removing generated code so it's great

shortcuts
shortcuts previously approved these changes Jun 24, 2022
Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

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

Mostly style comments, feel free to pick

GG :D

@@ -21,11 +21,12 @@ async function buildPerClient(
`yarn workspace ${npmNamespace}/${additionalProperties.packageName} clean`,
{
verbose,
cwd: getLanguageFolder(language),
Copy link
Member

Choose a reason for hiding this comment

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

maybe in this file the const cwd = get... would make calls cleaner but it's a detail

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it's in 2 separated functions so it's complicated, I'll leave it like this for now 😃

Copy link
Member

Choose a reason for hiding this comment

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

yup not a big deal

steps:
- uses: actions/checkout@v2

- name: Cache bundled specs
id: cache
uses: actions/cache@v3
with:
key: ${{ matrix.client.cacheKey }}
path: ${{ matrix.client.bundledPath }}
key: ${{ fromJSON(needs.setup.outputs.SPECS_MATRIX).cacheKey }}
Copy link
Member

Choose a reason for hiding this comment

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

we can set an env for the job level e.g. under needs

env:
  matrix: ${{ fromJSON(needs.setup.outputs.SPECS_MATRIX) }}

so we can use it everywhere in it :D

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no way !

Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

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

Nice!

@@ -96,15 +96,17 @@ jobs:
runs-on: ubuntu-20.04
timeout-minutes: 10
needs: setup
env:
matrix: ${{ fromJSON(needs.setup.outputs.SPECS_MATRIX) }}
Copy link
Member

Choose a reason for hiding this comment

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

c'est bo hein

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