Giter VIP home page Giter VIP logo

compat-db's Introduction

amilajack

Build Status

my personal w̶e̶b̶s̶i̶t̶e̶ npm module.

Usage

Here's how you install and run the module

npx amilajack

Install

Run this if you would like to have the module installed globally

npm install -g amilajack

compat-db's People

Contributors

amilajack avatar chrischuck avatar jooohhn avatar renovate-bot avatar renovate[bot] avatar

Stargazers

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

Watchers

 avatar  avatar

compat-db's Issues

Instance tests

Create tests that instantiate new objects and run some type introspection on those new objects to determine compatibility.

Helps avoid the following errors:

The SVGElement.ondurationchange getter can only be used on instances of SVGElement

DetermineAPIType Implementation

display: 'block'
^ property    ^ value
fetch()
^ function

Array.prototype.length
^ number

JS should determine: string, function, object, array, null
CSS should determine: property, value

Enable Safari tests

IE tests were disabled due to issues with saucelabs. Make sure to reenable the tests

e2e testing

write e2e tests that mock saucelabs. assert that the algorithm halts, assert TmpDatabase is empty, assert JobQueue is empty, and expected records exist

tmp-records not being written to

Upon running npm run build-compat-db, no records are inserted into tmp-records.

Solutions:

  • Write tests that check build-compat-db
  • Debug the reason for failure to write

migrate to typescript

  • uninstall all flow related dependencies
  • install all @types/x definitions for dependencies
  • eslint, babel integration
  • add typedoc integration

Test Assertion Compression

A leading cause of test failure on sauce labs is because our tests are too large in size. Limiting our tests batches to a couple hundred solves this issue but limits our performance. Migrating from statically generated tests to a more dynamic solution can solve this. This will fix tests on safari, which seem to fail on almost every test execution batch

Support for different JS contexts

Some tests can only be run in certain contexts. WebGL and Workers are examples of this. We currently do some primitive prototype lookups to check if an API is defined in the global context. For other contexts, we'll need to make some modifications:

example:

// Try this in chrome, which has support for webgl:
WebGLRenderingContext.clearColor === undefined // true

// We need to do this instead:
const canvas = document.getElementById('glCanvas');
var webglContext = canvas.getContext('webgl')
 
webglContext.clearColor === undefined // false

PR/Feature: Records validator

We need some way of checking all the records in the TmpRecordDatabase.

We need to check:

  • If any records are missing
  • If any browser or versions are missing from a record
  • If every record has the necessary fields (type, name, etc)
  • If there are duplicate records

The logic for this should be added under ./src/helpers/RecordsValidator. I recommend using the the RecordType (which should be renamed to RecordsType). It describes the typing information of the records.

API Bindings to `all.json`

We need to expose some kind of API wrapper around all.json. Users should be able to query it like so:

CompatDB.search({
  type: 'js',
  protoChainId: 'Array.push'
})

// Should return `DatabaseRecordType`

Requirements/Description

Requirements:

  • given an api, find the first version of every single browser that supports
    the given api (if any version does)
  • execute in a reasonable amount of time. assume connecting to a browser, executing
    the tests and closing the connection to the browser is an expensive operation (5min).
    Batching tests will be necessary
  • there are 50 version of firefox and chrome. 10 of safari, 10 of ie
    • determine the first versions for all these browsers
  • We have >= 10K APIs we want to test
  • Need to output a json file with all the all apis with first version of each browser supported

Given:

  • browser test runner, execute js code on any version of any browser
  • database (mysql)
  • you can generate compat tests for any api
    • (api: Object) => true
  • given list of APIs
  • Can only run 5 tests at a time

Assumptions

  • APIs cannot be deprecated

Initial database creation

The PR for this is responsible for writing the actual databases to be consumed by users. The database should implement src/DatabaseType.js.

The database should be split into separate modules. This will allow for better traversal performance. The databases will be split into css.json, js.json and all.json.

Migrate from Flow to TypeScript

This has been something I've been planning on doing for a while. The reasoning for this mostly stems from better tooling around the typescript community. Future contributors are also probably more familiar with TypeScript than flow because of the greater adoption of TS.

Refactor: TmpDatabase -> TmpRecordDatabase

Initially we were only using one database table, which was responsible for storing records. TmpDatabase was initially written as a collection of pure functions that all interaction with the database without side effects. As the project architecture changed to allow for better optimizations, we added a new 'jobs' table which is responsible for handling the JobQueue. It is likely that in the future more tables and databases will be added. With this in mind, I created an AbstractDatabase class which is intended to be extended by future database API's.

We need to implement a replacement for TmpDatabase which extends the AbstractDatabase. See the JobQueueDatabase implementation for an example. Here's some requirements for the PR:

  • Don't remove the TmpDatabase module. Just create a new TmpRecordDatabase module
  • Write the appropriate tests for TmpRecordDatabase

PR/Feature: Support for mobile browsers

We can reach browser parity with caniuse by supporting mobile browsers. This can be done by adding the name mappings and browserName and version's to src/helpers/Constants.js.

Determine CSS property compatibility

Determine if an API is supported in a certain browser. The CSS.supports() api can suffice in many cases but what if the browser doesn't even support CSS.supports()?

We need a function that can determine if a css property

function determineCSSRuleCompat(property: string, value: string): bool {
  // We need a CSS.supports() polyfill in case browser doesn't support the CSS.supports()
  // See this: https://github.com/termi/CSS.supports
}

We also need to find all the possible supported CSS rule values.

function getAllCSSPropertyValues(property: string): Array<string> {
  // Return all supported css property values
}

For example, getAllCSSPropertyValues('display') would return ['flex', 'block', 'inline', ...etc]. This will probably requiring reverse-engineering this polyfill.

Note: project being refactored into monorepo

compat-db has become a pretty large project. I found it useful to split the project into smaller projects. I have created a new project called ast-node-type-verifier. This new project takes the responsibility of inferring metadata about API's (specifically the ast node types of API's). The responsibility of compat-db will shift to focus solely on testing the compatibility of certain API's.

Batch 'remove' query

Building the compatibility database is limited by how fast we remove finished jobs. Batching a single remove query would significantly improve performance.

Dependency deprecation warning: babel-preset-es2015 (npm)

On registry https://registry.npmjs.org/, the "latest" version (v6.24.1) of dependency babel-preset-es2015 has the following deprecation notice:

🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!

Marking the latest version of an npm package as deprecated results in the entire package being considered deprecated, so contact the package author you think this is a mistake.

Please take the actions necessary to rename or substitute this deprecated package and commit to your base branch. If you wish to ignore this deprecation warning and continue using babel-preset-es2015 as-is, please add it to your ignoreDeps array in Renovate config before closing this issue, otherwise another issue will be recreated the next time Renovate runs.

Affected package file(s): package.json

Use CSS compat to update JS compat

window.CSSStyleDeclaration.overflowX is not defined in safari, yet it supports the css property overflow-x: '' CSS property. We need to write some functionality that subsequently uses the CSS compat records to update the JS records.

Bug: Mapping APICatalogueProvider IDL Definitions to implementation

There are a number of API's that marked as unsupported because the protoChain parsed from APICatalogue is of the WebIDL definition. Here's an example of the inconsistency:

// returned from APICatalogue:
protoChain: ['window', 'Window', 'requestAnimationFrame']

// Expected:
protoChain: ['window', 'requestAnimationFrame']

We should also consider dropping the default 'window.*' prefix

Build artifacts

Configure travis to npm run build-compat-db and publish the npm package. Requires using env variables

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • Update dependency babel-plugin-add-module-exports to ^1.0.4
  • Update dependency bookshelf to v0.15.2
  • Update dependency cross-env to ^5.2.1
  • Update dependency mysql to v5.7.37
  • Update dependency nightmare to ^3.0.2
  • Update Node.js to >=v4.9.1
  • Update dependency chai to ^4.3.6
  • Update dependency eslint-plugin-flowtype-errors to ^4.5.0
  • Update dependency http-server to ^0.13.0
  • Update dependency selenium-webdriver to ^4.1.1
  • Update dependency sequelize to ^5.22.5
  • Update dependency sqlite3 to ^4.2.0
  • Update dependency webdriverio to ^5.23.0
  • Update jest monorepo to ^24.9.0 (babel-jest, expect, jest-cli)
  • Update npm to >=3.10.10
  • Update Node.js to v16
  • Update dependency bookshelf to v1
  • Update dependency chromedriver to v99
  • Update dependency cross-env to v7
  • Update dependency dotenv to v16
  • Update dependency eslint to v8
  • Update dependency eslint-config-bliss to v6
  • Update dependency flow-typed to v3
  • Update dependency http-server to v14
  • Update dependency husky to v7
  • Update dependency knex to v1
  • Update dependency lint-staged to v12
  • Update dependency mocha to v9
  • Update dependency mysql to v8
  • Update dependency sequelize to v6
  • Update dependency sqlite3 to v5
  • Update dependency webdriverio to v7
  • Update jest monorepo to v27 (major) (babel-jest, expect, jest-cli)
  • Update npm to v8

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

  • Update dependency caniuse-db to v1.0.30001320
  • Update babel monorepo (@babel/cli, @babel/core, @babel/node, @babel/plugin-proposal-class-properties, @babel/plugin-proposal-decorators, @babel/plugin-proposal-do-expressions, @babel/plugin-proposal-export-default-from, @babel/plugin-proposal-export-namespace-from, @babel/plugin-proposal-function-bind, @babel/plugin-proposal-function-sent, @babel/plugin-proposal-json-strings, @babel/plugin-proposal-logical-assignment-operators, @babel/plugin-proposal-nullish-coalescing-operator, @babel/plugin-proposal-numeric-separator, @babel/plugin-proposal-optional-chaining, @babel/plugin-proposal-pipeline-operator, @babel/plugin-proposal-throw-expressions, @babel/plugin-syntax-dynamic-import, @babel/plugin-syntax-import-meta, @babel/plugin-transform-flow-strip-types, @babel/plugin-transform-modules-umd, @babel/plugin-transform-runtime, @babel/polyfill, @babel/preset-env, @babel/preset-flow, @babel/register, babel-eslint, babel-loader)
  • Update dependency flow-bin to ^0.174.1
  • Update dependency flow-typed to ^2.6.2
  • Update dependency knex to v0.95.15
  • Update dependency mocha to ^6.2.3
  • Update dependency mysql to ^2.18.1
  • Click on this checkbox to rebase all open PRs at once

  • Check this box to trigger a request for Renovate to run again on this repository

PR/Enhancement: Run RecordMetadata tests against developer preview browsers

Developer preview browsers (Safari Technology Preview, Chrome Canary, FirefixNightly, etc) have support for far more API's than regular browsers. Testing against them will allow us to determine the metadata of a significantly larger number of API's (namely, the APIs that are experimental). We'll need to use selenium to target local browser installations.

This will require migrating from nightmare to selenium

Add SauceLabs Integration

The tests (which can be run with npm run spec) should be able to run on SauceLabs' servers. This is the initial step for us to retrieving the coverage from tests across all browsers. Lets try to have the tests running on at least chrome, firefox, safari, and edge.

Here is a related tutorial that I found which will help with configuring webdriverio tests to run on saucelabs.

http://webdriver.io/guide/services/sauce.html

Enable concurrency across processes and async

Currently, webdriverio runs synchronously. For example, if we use browser.execute() inside of a for-loop, we cant move to the next iteration until browser.exexute() finishes. Enabling async tests will allow this. webdriverio has support for this. This will require using async/await and chaning the wdio.conf.js.

Another performance enhancement would include enabling concurrent processes. At the moment, webdriverio processes are limited to a maximum of 40. We can increase this but that means we can't write to shared memory so we can avoid race conditions. This can be solved by having each browser have its own in-memory storage. Once all the tests for all the browsers are done, the in-memory storages of all the browser tests can be merged into the compiled database (./lib/all.json)

Currently we can complete tests at a rate of 120 tests per minute. We have a total of 14000 tests so that'll take around 2 hours to finish.

Support checking if an API is supported or not

This should be done in the formatCSSAssertion() and formatJSAssertion() fn's. Try to convert the hasPrefix() method to a string (hasPrefix.toString()) and include it in those methods. Also remember to add the test cases for this

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.