Skip to content
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

chore: generate more efficient assets #1189

Merged
merged 1 commit into from
Jun 1, 2020
Merged

Conversation

P0lip
Copy link
Contributor

@P0lip P0lip commented May 31, 2020

Checklist

  • Tests added / updated
  • Docs added / updated

Does this PR introduce a breaking change?

  • Yes
  • No

Additional Context

Compression does its job when it comes to file size, yet it obviously doesn't solve the issue with unnecessary high memory consumption in Studio.

The gain in size comes from the $ref resolver change as well as using import type that makes sure we do not import any code.

Before:

ls -lh rulesets/assets
total 1,6M
-rw-rw-r-- 1 p0lip p0lip 1,6M maj 31 22:25 assets.json

Before (gzipped):

 ls -lh rulesets/assets
total 44K
-rw-rw-r-- 1 p0lip p0lip 43K maj 31 22:25 assets.json.gz

After:

ls -lh rulesets/assets
total 324K
-rw-rw-r-- 1 p0lip p0lip  63K maj 31 22:13 assets.asyncapi.json
-rw-rw-r-- 1 p0lip p0lip 159K maj 31 22:13 assets.json
-rw-rw-r-- 1 p0lip p0lip  97K maj 31 22:13 assets.oas.json

After (gzipped):

ls -lh rulesets/assets
total 48K
-rw-rw-r-- 1 p0lip p0lip 7,5K maj 31 22:27 assets.asyncapi.json.gz
-rw-rw-r-- 1 p0lip p0lip  21K maj 31 22:27 assets.json.gz
-rw-rw-r-- 1 p0lip p0lip  14K maj 31 22:27 assets.oas.json.gz

Tested in Studio & it works.

@P0lip P0lip added the chore label May 31, 2020
@P0lip P0lip requested a review from nulltoken May 31, 2020 20:32
@P0lip P0lip self-assigned this May 31, 2020
'node_modules/@stoplight/types/dist/index.js': ['DiagnosticSeverity'],
},
}),
commonjs(),
Copy link
Contributor Author

@P0lip P0lip May 31, 2020

Choose a reason for hiding this comment

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

Addresses the following warning.
image

Copy link
Contributor

@nulltoken nulltoken left a comment

Choose a reason for hiding this comment

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

Wow. Just tested it locally. That's just... impressive!

🚀

@P0lip P0lip merged commit f23d009 into develop Jun 1, 2020
@P0lip P0lip deleted the chore/assets-generation branch June 1, 2020 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants