-
Notifications
You must be signed in to change notification settings - Fork 943
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
Custom compat tables #1791
Custom compat tables #1791
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems reasonable so far
build.js
Outdated
process.argv.slice(2).forEach(function(arg) { | ||
var parts = String(arg).toLowerCase().split('='); | ||
|
||
switch (parts[0]) { | ||
case 'compilers': | ||
useCompilers = true; | ||
break; | ||
case 'environments': | ||
environments = require(parts[1]); | ||
break; | ||
case 'excludecurrent': | ||
excludeCurrentBrowser = true; | ||
break; | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use an args parser instead of rolling our own - https://www.npmjs.com/package/@pkgjs/parseargs will eventually be built into node, so that might be a good choice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the example for the parseargs package, what would be your preferred setup?
- keep
compilers
as a positional? - excludecurrent as a flag? If so, suggestions as to which one?
-e
?
So something like -e --environments=./custom.json compilers
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems fine to me (altho maybe x for exclude)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using @pkgjs/parseargs means upping the minimal NodeJS version for running build.js to NodeJS 15(.14.0), as the package makes use of ??=
assignment operator.
That acceptible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, i think requiring node 16 is fine.
build.js
Outdated
useCompilers = true; | ||
break; | ||
case 'environments': | ||
environments = require(parts[1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dynamic requires should be avoided; can we use fs.readFileSync and JSON.parse instead of require, since this is just json?
build.js
Outdated
} | ||
}); | ||
|
||
if (!environments) environments = require('./environments'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like it could be handled as a default in the args parser
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you mean a default value when destructuring the returnvalue from parseArgs(argv, options);
, as I don't see any way to provide defaults to the parseArgs method.
If so, is it ok to use stuff like desctructuring in build.js, given that pretty much all the code in there now looks like ES5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that’s fine with me; the runtime must be ES3 but the build script can use modern node.
Having to make some adjustments to the Are they still being used? They don't seem to be hosted on https://kangax.github.io/compat-table/ |
@ljharb appreciate it if you could have another look at the direction of this PR: in 35bd089 I added the option to augment the testresults already available in this repo, as to allow supplying testdata, for example for nightlies of environments that are already part of this repo or to supply test results for environments that aren't in this repo (yet) Also updated the readme with the new options and addresses previous review comments If this all still looks good, last step will be to hide some more things form the UI, based on which environments are included |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems pretty straightforward.
It'd probably be good to have separate commits here; one for the "exclude current browser" option, etc.
@@ -1,14 +1,41 @@ | |||
var parseEnvsVersions = require("./parse-envs-versions"); | |||
|
|||
module.exports = function interpolateAllResults(tests, envs) { | |||
module.exports = function interpolateAllResults(tests, envs, customResults = {}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you elaborate on what customResults is for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to be able to supply build.js with test results for browser/browserVersions that aren't part of this repo.
As the test results aren't in json files, but in an exported object in the data-esXxxx.js files, i couldn't come up with another way to provide builds.js with results for for example a nightly.
Also see the changes I made to the readme, in which I (tried to) explain how this would be used.
BTW: did you see my question about whether the es*/compiler-skeleton.html are still being user? I think they are used when using the compilers
argument, but it looks to me that the resulting pages aren't hosted anywhere, so might this all be obsolete stuff that could be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about instead providing an alternative list of browsers/browserVersions?
ok so "customResults" is more like "additionalResults"? it seems like maybe it'd be better for the caller to compose data-esX itself and make its own result object.
i have no idea about the compiler-skeleton stuff; before removing it, i'd want to know what it was for and why it's not being used anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about instead providing an alternative list of browsers/browserVersions?
Not sure I follow: that is what what the environments
param allow you to do
ok so "customResults" is more like "additionalResults"?
correct
it seems like maybe it'd be better for the caller to compose data-esX itself and make its own result object.
I did look at such an approach, but as the test result data is inside the data-es*.js modules, I don't see a way to 'inject' additional testresults into those, except manually or by basically maintaining a modified implementation all the data-es*.js modules, which is something I don't like, because that is verly likely to get out of sync.
Another idea I had was just to refactor all the data-es*.js files to read their test results from another json file, instead of the test results being stored inside the module. But I was thinking that might break existing tooling or process to update the restresults
i have no idea about the compiler-skeleton stuff; before removing it, i'd want to know what it was for and why it's not being used anymore.
I haven't gotten to the bottom of it, but I think the es*/compiler-skeleton.html files are used to create .dedicated html files output files for just compilers. I think it may be that somewhere in the past, the currently hosted index.html files did not contain compiler results and they were hosted on separate pages. But it doesn't look like those separate compiler pages are still generated and hosted.
This comment was marked as spam.
This comment was marked as spam.
- introduce environments commandline param - make platformType headers colspan dynamic based on # on browser - hide platformType header if it doesn't contain any browsers
- introduce excludecurrent commandline param - disable running the tests in the browser - hide current browser columns
As to not have extremely wide columns on custom compat tbales that only show a few browsers
f89167e
to
a0634c8
Compare
Closing this PR in favor of #1881 and yet to create follow-up PRS that offer a cleaner, more versatile approach |
As discussed in #1790 a prototype to allow creating custom compat tables
Usage
node build environments=./custom.json excludecurrent
With
custom.json
being a custom environments file, for example having the following content:This PR is a draft, just to get the discusion going. Needs cleanup + more:
One question: the code in build.js isn't using modern JavaScript features. Is that on purpose?
Closes #1790
Closes #1198