grafana / jslib.k6.io

Repository of useful utility libs for k6 scripts
https://jslib.k6.io/
GNU Affero General Public License v3.0
53 stars 21 forks source link

Support for multiple target files #74

Open oleiade opened 2 years ago

oleiade commented 2 years ago

Problem definition

As of today, the jslib website only supports linking to one file per version. It works under the assumption that every jslib should consist in either a single js file, or a single bundled js file.

However, with the introduction of k6-jslib-aws, it appeared that in certain scenarios, we might want the website to have the ability to serve multiple files for a given jslib. AWS actually already serves both a bundle file with access to all the services, as well as service-specific files, but the jslib.k6.io website only points to the main aws.js bundle.

Goal

With the recent wish for the summary jslib to exhibit the same behavior, by exposing both a text.js and a junit.js file to the user, we would like to find a meaningful way for the jlib.k6.io website to be able to point the user to multiple files per version of a jslib.

Potential solution

We could replace the existing table present at the root of the jslib.k6.io website: Name Versions Docs
{name} {v1}, {v2}, etc... https://k6.io/docs/javascript-api/jslib/mylib

With either a nested HTML table, in which the versions field would itself consist in a table with each line left row's being the version number, and right row being the published files (linked). Unfortunately, that's not possible to demonstrate an example of that in pure markdown 😒

Another option would be to replace it with a list of tables, one per jslib, which would list one version per row, and list the published files for each, as in:

[utils](points to documentation)

Version Resources
{v1} index.js
{v2} index.js

[AWS](points to documentation)

Version Resources
{v1} aws.js, s3.js, secretsManager.js
{v5} aws.js, s3.js, secretsManager.js, kms.js
{v6} aws.js, s3.js, secretsManager.js, kms.js, kms.js
oleiade commented 2 years ago

This was mentioned and requested as a result of #11 and https://github.com/grafana/k6-jslib-summary/pull/3#issuecomment-1267004585