Skip to content

Reduce the size of the package (v7) #1501

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

Closed
1 task
kazuma1989 opened this issue Jan 11, 2024 · 3 comments
Closed
1 task

Reduce the size of the package (v7) #1501

kazuma1989 opened this issue Jan 11, 2024 · 3 comments
Labels
enhancement New feature or request openapi-ts Relevant to the openapi-typescript library PRs welcome PRs are welcome to solve this issue!

Comments

@kazuma1989
Copy link

Description

I would like to reduce the size of the package. (v7)

Currently, the package install size is 38 MB, but reducing it should improve the speed of npx and npm install on CI.
cf. https://packagephobia.com/[email protected]

Of the 38 MB, 30 MB is the typescript package and 7 MB is the @redocly/openapi-core package.
cf. https://packagephobia.com/result?p=%40redocly%2Fopenapi-core%2C+typescript

The typescript package is probably in peer if you use openapi-typescript, so there is no need to have it in dependencies.
The @redocly/openapi-core package may possibly be a core feature of openapi typescript, but if it is not, but is a package that does remote schema acquisition and validation, it is fine to have it in peer.

Proposal

Move dependencies on typescript from dependencies to peerDependencies.
In addition, if possible, move dependencies on @redocly/openapi-core from dependencies to peerDependencies as well.

If you want to use the all-in-one openapi-typescript, you can install the whole package including the peers, or if you only want schema-to-type conversion functionality or if you want fine-grained control, you can install only the lightweight openapi-typescript.

Checklist

Sorry, but no. I'm not familiar with @redocly/openapi-core. 😢

@kazuma1989 kazuma1989 added enhancement New feature or request PRs welcome PRs are welcome to solve this issue! openapi-ts Relevant to the openapi-typescript library labels Jan 11, 2024
@wolfy1339
Copy link

Typescript is used for it's AST, in this case it is a production dependency.

The package uses @redocly/openapi-core for parsing schemas, and validation, and some other things.

See the v7 release notes: #1368 (comment)

@drwpow
Copy link
Contributor

drwpow commented Jan 16, 2024

I’m not opposed to making both deps peerDeps. It’s a safe assumption every consumer will have typescript as you said. Redocly could remain as a dep, but also people may find they want to use some features of this tool outside of openapi-typescript at which point it should be an explicit dep. So it’s not a huge ask.

@drwpow
Copy link
Contributor

drwpow commented Jan 19, 2024

Update: the next @next package will move typescript to peerDeps, but I’m going to keep @redocly/openapi-core in deps for now. Reason is that’s more of an internal package that people probably won’t consume directly. If we end up needing the CLI, that should be a peerDep. But @redocly/openapi-core is fairly lightweight, all things considered.

@drwpow drwpow closed this as completed Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request openapi-ts Relevant to the openapi-typescript library PRs welcome PRs are welcome to solve this issue!
Projects
None yet
Development

No branches or pull requests

3 participants