Skip to content

Conversation

@erunion
Copy link
Member

@erunion erunion commented Sep 14, 2023

🧰 Changes

Installing a codegen'd SDK right now installs all of api which means that our users are getting all of our dependencies for codegen installed (ts-morph, commander, @readme/openapi-parser, the works). Since that's not ideal, and definitely not necessary for an SDK that's been generated, I'm splitting our core library out into a new @api/core package that SDKs will then install.

closes RM-7992

@erunion erunion added enhancement New feature or request refactor Issues about tackling technical debt labels Sep 14, 2023
Copy link
Member Author

Choose a reason for hiding this comment

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

A lot of these SDK fixtures had changes because I slightly bumped our oas dependency and we've fixed a number of issues since the release that this was using:

  • Support for null mixed types
  • Addition of a Default: <default value> suffix to enum descriptions.
  • Improved unused schema removal.

import Oas from 'oas';
import APICore from 'api/dist/core';
import definition from '../../../__fixtures__/definitions/operationid-quirks.json';
import APICore from '@api/core';
Copy link
Member Author

Choose a reason for hiding this comment

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

Moving core also lets us do this clean require instead of having to set this up in exports.

"@types/lodash.merge": "^4.6.7",
"@types/lodash.setwith": "^4.3.7",
"@types/lodash.startcase": "^4.4.7",
"@types/prettier": "^3.0.0",
Copy link
Member Author

Choose a reason for hiding this comment

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

Forgot to remove this when I removed Prettier support last month.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thoughts on bringing in knip? Happy to PR that later

Copy link
Member Author

Choose a reason for hiding this comment

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

Fully into bringing in Knip. Will ticket something on the board.

Copy link
Member Author

Choose a reason for hiding this comment

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

Figure this readme doesn't need any usage or installation info since you won't ever use this package outside the scope of a codegen'd SDK.

{
"name": "@api/core",
"version": "1.0.0",
"description": "The magic behind `api` 🧙",
Copy link
Member Author

Choose a reason for hiding this comment

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

Could stand to give this a better description.

Copy link
Contributor

Choose a reason for hiding this comment

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

Honestly I dig it!

@erunion erunion marked this pull request as ready for review September 14, 2023 01:10
@erunion erunion requested review from a team, Dashron, darrenyong and kanadgupta and removed request for a team September 14, 2023 01:10
Copy link
Contributor

@kanadgupta kanadgupta left a comment

Choose a reason for hiding this comment

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

Really excited for these changes, looking good for the most part! But there are a lot of random fixture changes in the api subpackage and I can't seem to pinpoint why 🧐

{
"name": "@api/core",
"version": "1.0.0",
"description": "The magic behind `api` 🧙",
Copy link
Contributor

Choose a reason for hiding this comment

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

Honestly I dig it!

@@ -0,0 +1 @@
import '@api/test-utils/vitest.matchers';
Copy link
Contributor

Choose a reason for hiding this comment

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

Love this

erunion and others added 2 commits September 14, 2023 15:02
Co-authored-by: Kanad Gupta <8854718+kanadgupta@users.noreply.github.com>
@erunion erunion requested a review from kanadgupta September 14, 2023 22:04
@erunion erunion merged commit 189b8c5 into main Sep 14, 2023
@erunion erunion deleted the feat/core-package branch September 14, 2023 22:19
@erunion erunion added this to the v7 milestone Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request refactor Issues about tackling technical debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants