Git Product home page Git Product logo

Comments (6)

peterbe avatar peterbe commented on July 19, 2024

What do you think @Elchi3 and @ddbeck ?

from yari.

ddbeck avatar ddbeck commented on July 19, 2024

I like the idea of the feature itself, linking to the JSON file directly, a lot. I'd use this on a daily basis. There are a few caveats though.

And the method you've suggested would work in a lot of cases—probably the overwhelming majority—if we passed the full BCD hierarchy into the stumptown JSON (right now it cuts off at the __compat object, though it would be trivial to add the full BCD identifier as part of the browser_compatibility content object type).

Unfortunately, there are still a lot of cases where it wouldn't quite work as you've described. Consider Response.ok as an example. Its BCD identifier is api.Response.ok, but feature data is in the file /api/Response.json (since it's a subfeature of api.Response).

If you had the full hierarchy, you could hard code the depth of features that correspond to a file. You'd have to do this for each of the feature categories (api.*, css.{at-rules,properties,selectors,types}.*, etc.). A better, smarter thing to do might be to give the browser-compat-data package a real API for this sort of thing (e.g., call some method with a feature identifier to get back the GitHub URL for that feature—it'd be possible to get the exact line number, even). I imagine such a thing would be useful for more than just stumptown.

Either way, we could have the stumptown content JSON look something like this:

{
      "type": "browser_compatibility",
      "value": {
        "__compat": { … }
      },
      "source_id": "api.Response.ok",
      "github_source_url": "https://github.com/mdn/browser-compat-data/blob/master/api/Response.json"
}

from yari.

peterbe avatar peterbe commented on July 19, 2024

I don't think I really understood the source_id because if you can make that above JSON block, stumptown-renderer just needs the github_source_url.

from yari.

peterbe avatar peterbe commented on July 19, 2024

So, what would it take to make that stuff a reality in stumptown-content? Can it be done?

from yari.

peterbe avatar peterbe commented on July 19, 2024

@ddbeck Can we close this now? (now that we have the new new-issue link)
Or did you have in mind to do more fine-tuned links directly into the files in the bcd repo.

from yari.

ddbeck avatar ddbeck commented on July 19, 2024

Yep, this is good enough for now. Thank you!

from yari.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.