Giter VIP home page Giter VIP logo

mdn-compat-data-explorer's Introduction

MDN Browser Compatibility Data Explorer

pipeline status

This is a Rails app that lets the user explore the browser compatibility data that MDN is collecting in the browser-compat-data repo.

Deprecated

This was hard to update consistently and has been essentially dormant for nearly two years. If you'd like to update it, feel free to fork it :) It is now deprecated and archived, and the Heroku app has been taken offline.

Development

Running the application locally

You'll need:

  • Postgres 11
  • Ruby 2.6.x
  • Node.js 10.x
  • Yarn
  • Graphviz

Run the following commands:

  1. gem install bundler
  2. bundle install
  3. yarn install
  4. bundle exec rails db:create
  5. bundle exec rails db:migrate
  6. bundle exec rails s

With that, the site should be up at localhost:3000.

Updating the mdn-browser-compat-data package

You can update the mdn-browser-compat-data package using bundle exec rake update:update_mdn_package. This Rake task will walk you through the steps of updating the package. Alternatively, you can update it manually, described below.

You can update the mdn-browser-compat-data package manually by doing the following:

  1. Edit the mdn-browser-compat-data package version in package.json and run yarn install.
  2. Update the config.mdn_bcd_version variable in config/application.rb to the current version.
  3. Run node lib/build.js to regenerate the public/data.json file.
  4. Commit these changes and open a pull request.

Updating the database

You can update the database (where all the data is stored) by running bundle exec rake db:seed. Note that this will delete the database and fill it with whatever data is in public/data.json based on db/seeds.rb.

The application essentially uses a static data set. It uses a database simply because I wanted to learn more about databases and wanted an easier means of querying the data.

Updating the database with test data

You can use data from public/data-test.json by running USE_TEST_DATA=true bundle exec rake db:seed. This is useful for ensuring accuracy, since you can manipulate the JSON and will know, e.g. how many features should be listed as true.

CI and Docker

This project uses GitLab CI.

To regenerate and push the Docker container up to the GitLab Container Registry:

  • Log into the GitLab CI Docker registry with docker login registry.gitlab.com (you'll need to use a Personal Access Token as your password).
  • Build the container with docker build -f Dockerfile -t registry.gitlab.com/connorshea/mdn-compat-data-explorer .
  • Then use docker push registry.gitlab.com/connorshea/mdn-compat-data-explorer to push the container to the GitLab Container Registry.

Deployment

The live site currently uses Heroku, and is available at mdn-compat-data-explorer.herokuapp.com.

Deployment involves the following:

  • Deploy the current version of the master branch.
  • Run bundle exec rake db:migrate and bundle exec rake db:seed from the Heroku Web Console or with the Heroku CLI.

This should update the site to the current codebase and recreate the database from the db/seeds.rb file.

Dependencies

This project uses:

To view all dependencies used in this project, see the Gemfile and package.json.

Architecture

ERD

Notes

Resources

mdn-compat-data-explorer's People

Contributors

connorshea avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mdn-compat-data-explorer's Issues

Add a filter

When viewing a page full of features, include a filter for entering text and/or a regexp to show only matching features.

Write tests to make sure the scopes properly identify various values

From #12:

The graph values don't quite add up when there are more complex browser support objects, e.g. it handles { version_added: true } but I'm not 100% sure it handles { version_added: true, prefix: '-webkit'} and it definitely doesn't handle support objects that are arrays of these hashes.

I'm pretty sure it handles the second case properly now (not the third though), but it'd be useful to make sure it stays true as development of the Rails app continues.

Rather than using data from data-test.json, which could cause failures any time the data is modified, I think it'd be a good idea to create the Feature objects when running the test suite using something like factory_bot.

I was initially hesitant to do this because I wouldn't be able to make sure the JSON that gets passed by seeds.rb matches the JSON used in the tests, but I think that the benefits outweigh the potential problems. Hopefully I can come up with some way to make sure the data actually in the database and the data in the tests match up.

tl;dr use fixtures/factories to generate Features and write simpler, more resilient tests.

Your .dependabot/config.yml contained invalid details

Dependabot encountered the following error when parsing your .dependabot/config.yml:

The property '#/update_configs/0/allowed_updates/0/match/kind' value "all" did not match one of the following values: security

Please update the config file to conform with Dependabot's specification.

You can mention @dependabot in the comments below to contact the Dependabot team.

Include a link in the feature card to search the GitHub repo for the source file

This is kind of a hack because there's not really a good way to link to the source file from the webapp.

It'd be nice to be able to easily find the feature in the GitHub repo, e.g. have a link in the api.ANGLE_instanced_arrays feature card that directs the user to https://github.com/mdn/browser-compat-data/search?q=ANGLE_instanced_arrays.

Add feature pages

Add pages for each individual feature, e.g. /features/css-font-size.

Make sure subfeatures are actually subfeatures

Subfeatures were introduced in #66, unfortunately the code was written such that the subfeatures didn't require a dot immediately after the feature name.

This leads to problems like api.AnimationEffect being displayed as a subfeature of api.Animation, which it is not.

Implement more visualizations using the dataset

Currently the Graphs page has donut charts with browser support info, it'd be nice to have more graphs.

Ideas:

  • Stacked bar chart of releases vs. releases with release notes for each browser
  • % of tracked features that are standard, % that are experimental, % that are deprecated

Your .dependabot/config.yml contained invalid details

Dependabot encountered the following error when parsing your .dependabot/config.yml:

The property '#/update_configs/0/automerged_updates/1' of type object did not match one or more of the required schemas```

Please update the config file to conform with Dependabot's specification.

You can mention @dependabot in the comments below to contact the Dependabot team.

Improve parsing of support info

Currently in the features_helper.rb file we just send "Yes", "No", "?", or forward the version number, and if there's more than one version hash (e.g. it was prefixed initially and eventually was added without the prefix, or the same thing but with a feature flag) it will only take data from the first hash and ignore everything else.

Similarly, it doesn't care about notes or any of the other possible attributes, it only cares about the version_added attribute.

module FeaturesHelper
def version_added_parser(browser_info)
if browser_info.kind_of?(Array)
version_added = browser_info[0]['version_added']
elsif browser_info.kind_of?(Hash)
version_added = browser_info['version_added']
end
# it would appear false values are changed to nil by Ruby at some point
case version_added
when true
return content_tag(:td, "Yes", class: "bg-true text-center")
when false
return content_tag(:td, "No", class: "bg-false text-center")
when nil
return content_tag(:td, "?", class: "bg-unknown text-center")
else
return content_tag(:td, version_added, class: "bg-true text-center")
end
end
end

When returning the HTML, perhaps we should include attributes like data-flags, data-notes, etc. The problem with this is how we should handle a situation where there are multiple hashes, maybe numbering the data attributes depending on the hash's location in the array.

Maybe a better, more "universal" solution would be to just pass the JSON directly as a data attribute and then have some JavaScript parse it on the client-side and modify the table cells from there.

In the KumaScript repo there's a directory of JSON fixtures, e.g. support_variations.json which will probably be useful for filling out the fixtures in this repo.

There's also a fixture with a support array rather than a hash, this'd be useful to add:

https://github.com/mdn/kumascript/blob/3c264ed0bbf2c3da2b4940fad02b669bd1820f58/tests/macros/fixtures/compat/notes.json

Write system tests for the various search filters

System tests need to be written to make sure the various search filters work properly:

  • Selecting multiple categories, e.g. HTML and CSS.
  • Filtering based on presence of description and mdn_url.
  • Filtering based on status: experimental, deprecated, and standard_track.

List all subfeatures of a feature

All features with a name matching api.ANGLE_instanced_arrays.* would be a subfeature of api.ANGLE_instanced_arrays, so it should be possible to list all subfeatures for each feature. It may be a better idea to determine this information when seeding, but I'm not entirely sure how to go about doing that.

It'd also require some way to link to a given feature. I'd rather not have a page for every feature, but I guess that wouldn't be the worst thing?

Add more information for browser releases

Browser releases could be updated to list all features added in a given release. It'd probably be a good idea to either load this data on-the-fly with JavaScript or to make a separate page for each browser, so as not to put too much strain on the DB when loading the Browsers page.

Your .dependabot/config.yml contained invalid details

Dependabot encountered the following error when parsing your .dependabot/config.yml:

The property '#/update_configs/0/automerged_updates/1' of type object did not match one or more of the required schemas

Please update the config file to conform with Dependabot's specification.

You can mention @dependabot in the comments below to contact the Dependabot team.

Implement caching

The data is static so this should be fairly easy (famous last words).

Add page titles

Add a helper to include a page-specific title to the head of every page.

Add a CHANGELOG

I already have psuedo-changelogs in the Releases view, but that's only for GitHub. A CHANGELOG.md would be better.

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.