cli icon indicating copy to clipboard operation
cli copied to clipboard

[FEATURE] Reduce number of dependencies and install size (v2.17 needs 1700 dependencies, takes 1.7Gb of space)

Open peitschie opened this issue 8 months ago • 12 comments

Why do we need this improvement?

The @asyncapi/cli tool (v2.17.0) requires 1700 additional packages and occupies about 1.7Gb of space on install.

This provides a significant barrier to use within more controlled environments, as the auditing and review of the dependencies is completely impractical.

It also has a significant impact on install size, application performance, and even tool choice.

For example, I'm unable to install this on some machines as they simply don't have enough RAM available to complete the installation without special overrides.

How will this change help?

Reducing the number of dependencies significantly would make this tool a much more attractive option, and likely will reduce the maintenance burden of keeping the dependencies up to date.

It would also increase accessibility to the package.

Screenshots

See attachment for the current result of running npm install @asyncapi/cli in a completely clean directory: dependencies.txt

How could it be implemented/designed?

Some related discussion seems to be in #1657, #1707 and #1703 (these all list identifying and removing redundant dependencies and imports)

  1. Review direct dependencies and determine which are not providing significant features and might be suitable to inline/reimplement.
  2. Review heavy-weight dependencies to evaluate alternative tools or alternative approaches that don't require the massive dependency tree

🚧 Breaking changes

Yes

👀 Have you checked for similar open issues?

  • [x] I checked and didn't find a similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue?

Yes I am willing to submit a PR!

peitschie avatar Apr 03 '25 01:04 peitschie

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

github-actions[bot] avatar Apr 03 '25 01:04 github-actions[bot]

Double down on this one: 2.16.7 is reported to be 367MB on docker hub. 2.16.8 is almost three times heavier!

lmussier avatar Apr 22 '25 13:04 lmussier

Hey @Shurtu-gal was investigating this one and as per above comment comparing the changes between the versions mentioned above the i.e 2.16.7 and 2.16.8 the studio's new version which uses next.js was implemented, hence i believe a seperate issue there needs to open for discussion on reducing size if possible, WDYT or something else can also be done?

neoandmatrix avatar May 10 '25 15:05 neoandmatrix

This is a major concern for us as well — not just due to size, but security. The large number of dependencies makes auditing nearly impossible in controlled environments. Reducing the dependency tree would greatly improve usability and trust.

lfvJonas avatar May 13 '25 07:05 lfvJonas

Could you generate a list dependency sizes @neoandmatrix

Shurtu-gal avatar May 13 '25 08:05 Shurtu-gal

Could you generate a list dependency sizes @neoandmatrix

Okay, will update.

neoandmatrix avatar May 13 '25 08:05 neoandmatrix

Main root Image

Inside asyncapi

Image

inside studio folder

Image

inside build folder

Image

@Shurtu-gal above are the dependency size for the largest modules.

neoandmatrix avatar May 14 '25 04:05 neoandmatrix

Thanks, your earlier suggestion makes sense then. Could you open an issue in studio with this as context.

Can add this link there as well: https://nextjs.org/docs/app/guides/package-bundling

Shurtu-gal avatar May 14 '25 04:05 Shurtu-gal

Thanks, your earlier suggestion makes sense then. Could you open an issue in studio with this as context.

Can add this link there as well: https://nextjs.org/docs/app/guides/package-bundling

Sure.

neoandmatrix avatar May 14 '25 04:05 neoandmatrix

Hey @Shurtu-gal was looking on this further and currently the cli when installed through npm is 1.1Gb

Image

Image

Image

Image

Image

Here from last screenshot its visible that the studio's @next and next and global @next and next are redundant and present twice which ideally should be used from global only.

WDYT as expect these i believe rest of the dependencies are good are not redundant.

neoandmatrix avatar Jun 02 '25 08:06 neoandmatrix

The thing is it was very problematic for me to render out a prebuilt packaged version of studio programmatically using next. It was very well behaved for react though.

I pulled together what I could, to get the preview command up and running. Would need some more work there. That might be the reason of this.

Shurtu-gal avatar Jun 03 '25 09:06 Shurtu-gal

The thing is it was very problematic for me to render out a prebuilt packaged version of studio programmatically using next. It was very well behaved for react though.

I pulled together what I could, to get the preview command up and running. Would need some more work there. That might be the reason of this.

Yeah next sometimes behaves weird, but other than that I don't think much can be reduced and comparing cli to versions prior to next integration the size looks same that is around 300Mb smaller which is around the size of these packages only.

I will once try to confirm that this is not a npm issue if possible.

Thanks.

neoandmatrix avatar Jun 03 '25 09:06 neoandmatrix

the size of this broke our build and prevents us from having up-to-date documentation generated on build 🫠

PanMan avatar Jul 30 '25 12:07 PanMan

Is there any reason @asyncapi/cli comes with @asyncapi/studio? I understand some subcommands of the CLI may use studio, but wouldn't it be better to put such deps in optionalDependencies?

I agree with the original poster that this is the issue of not just the size, but also a large dependency graph and potential security problems that follow. I would rather install the bare minimum of what I need

Vitest somehow suggests to install @vitest/coverage-v8 only after one runs it with --coverage flag. Maybe such approach can be used to suggest to install @asyncapi/studio only if studio subcommand is used

In fact, suggestion and programmatic install is nice, but not necessary if it's tricky to get with package managers/monorepo tools. I would even prefer to just have a message telling me what package is missing

azerum avatar Oct 17 '25 01:10 azerum