-
-
Notifications
You must be signed in to change notification settings - Fork 272
fix: infix .gen to client and core #2396
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
fix: infix .gen to client and core #2396
Conversation
|
|
🦋 Changeset detectedLatest commit: 504edb5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
mrlubos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be all that's needed!
Build the library with pnpm openapi-ts build and then update snapshots with pnpm openapi-ts-tests test:update. If anything fails, you probably need to build the failing dependency as well
FYI, when exec (same for
I assume I will run the commands manually, ergo:
... however I get a lot of file changes that are only changed in eol, even with the .gitattributes 🤷 |
|
ok, I ran There is now another test error: https://github.com/hey-api/openapi-ts/actions/runs/16781162735/job/47519904281?pr=2396#step:10:300 |
|
@Shinigami92 I think it's something around that EDIT: I'd like to see unit tests for the |
similar to the output base directory, the bundled client generates an index.ts file. however this should be an index.ts and not an index.gen.ts, because otherwise we would need to fix even more imports in many other files that just imports from
an answer to what exactly? maybe you should have a look into the snapshot files, because then you can see how the new structure is build. |
|
@dosu any idea why tests are failing? |
|
@Shinigami92 Can you update the snapshots and open the pull request if it's ready for review? I can fix the failing tests after it's merged |
fc09655 to
ce246ca
Compare
|
@Shinigami92 is attempting to deploy a commit to the Hey API Team on Vercel. A member of the Team first needs to authorize it. |
tip, you can use gh tools and checkout this PR with |
|
@Shinigami92 looking at the diff, it's interesting that it detects some changes as file renames while some are treated as new files. Any idea why? bodySerializer and types should be also detected as renamed. Has anything changed inside the files? EDIT: hm, it's just imports |
I was confused as well about that because the changes are not that big. But at the top of these files, obviously the import statements have changed to |
|
Yeah I would've thought it can detect that. I'll merge it and see what's up! |
mrlubos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I found what the problem might be. You added infixDotGenToFiles calls to generateClientBundle. This function is called from both legacy and current output generate step. Try adding a flag argument to generateClientBundle controlling whether infixDotGenToFiles will be called. If it's false (this will apply for the legacy approach), don't call infixDotGenToFiles, i.e. this pull request won't impact it. If you look at the snapshot diffs, the files in test/generated were simply deleted with no replacement found. We don't want to support the legacy stuff, it only complicates things!
What could be the best strategy to clean the |
|
ok, I made one adjustment commit with the legacy flag |
Delete it manually. Whenever you rename or delete snapshots that's what I do. Yes, it should be automated, but isn't right now |
| @@ -135,6 +163,11 @@ export const generateClientBundle = ({ | |||
| ensureDirSync(coreOutputPath); | |||
| const coreDistPath = path.resolve(packageRoot, 'dist', 'clients', 'core'); | |||
| copyRecursivePnP(coreDistPath, coreOutputPath); | |||
|
|
|||
| if (legacy !== true) { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (legacy !== true) { | |
| if (!legacy) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this wont work, as I have not set legacy to false but undefined in the non-legacy variant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!legacy doesn’t mean legacy === false, it means any falsy value. 0, empty string, undefined, null, and false are all falsy values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my brain was not braining
I confused myself with the legacy: false I did before
|
sry I'm playing a game at the side ^^ |
Which game? The new Mafia just came out, are you playing that? |
19ac4de to
504edb5
Compare
|
don't have any more patience for this, I'll just remove that snapshot test |
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2396 +/- ##
==========================================
- Coverage 22.43% 22.42% -0.02%
==========================================
Files 325 325
Lines 32031 32061 +30
Branches 1234 1234
==========================================
+ Hits 7187 7189 +2
- Misses 24835 24863 +28
Partials 9 9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I think this may have broken ESM SDK generation. Have a look at this sample repo I created to reproduce: https://github.com/swisscat/openapi-ts-esm-bug
|
|
Thanks @swisscat! @Shinigami92 are you going to open another pull request? |
I would like first try tomorrow if I have the same issue at company work. I also explicitly didn't touched the shouldAppendJs logic and that's why I added the infix before that blocks. So if we really do not have an issue in our project but @swisscat has in theirs, they should open a new issue and try to fix it. |
|
Sounds good. If the issue persists we might revert this pull request however to avoid breaking the existing functionality which seems to be the case |
everything works fine on our side with 0.80.8 👍 |
|
😎 🤘 |
|
Thanks, I confirm everything is working fine ! |
partially related to #2258 and #2235
clientandcore#2235