groovecoder / discord

GitHub webhook that analyzes pull requests and adds comments about incompatible CSS
Mozilla Public License 2.0
29 stars 13 forks source link

Change processor to call a doiuse.com server (micro-service) #167

Open groovecoder opened 8 years ago

groovecoder commented 8 years ago

This is a big architectural change and may require updates to the doiuse.com code-base itself.

When we make more doiuse interfaces - editor plugins, browser extensions, site monitors, etc., we want them to call a single doiuse.com server, so we can update all clients with the latest and greatest doiuse functionality with a single server deployment.

So, we should change discord to call to a doiuse.com server instead of using postcss(doiuse()) directly. E.g., something like:

/**
 * Runs postcss for each of the processors
 */
function _postcss(config, contents, handle, filename) {
...
          var doiuseURL = 'https://moz-doiuse.herokuapp.com';
          var doiuseXHR = new XMLHttpRequest();
          doiuseXHR.open('POST', doiuseURL);

          doiuseXHR.onreadystatechange = function () {
            if (doiuseXHR.readyState === XMLHttpRequest.DONE) {
              if (doiuseXHR.status === 200) {
                var doiuseOutput = doiuseXHR.responseText;
                alert(doiuseOutput);
              }
            }
          };

          if (styleSheetContent) {
            doiuseXHR.send('{"css":' + JSON.stringify(contents) + '}');
          }
...
}
Faeranne commented 8 years ago

Doesn't doiuse.com already exist like this? Perhaps we should ask the owner about assisting with the already existing server, rather than spinning up a brand new one.

Faeranne commented 8 years ago

unless we have some other micro-services to attach to this aswell. :wink:

groovecoder commented 8 years ago

I'm not sure what you're asking? I'm talking about changing this GitHub web hook code to use doiuse.com "api" instead of installing the doiuse module into the web hook itself. I've sent issues and PRs upstream to the doiuse.com repository.

Faeranne commented 8 years ago

You have http://moz-doiuse.herokuapp.com in your example code. I assumed that would be a newly created service.

On Thu, Jan 14, 2016, 17:33 luke crouch notifications@github.com wrote:

I'm not sure what you're asking? I'm talking about changing this GitHub web hook code to use doiuse.com "api" instead of installing the doiuse module into the web hook itself. I've sent issues and PRs upstream to the doiuse.com repository.

— Reply to this email directly or view it on GitHub https://github.com/mdn/discord/issues/167#issuecomment-171816982.


Q: Why is this email five sentences or less? A: http://five.sentenc.es

groovecoder commented 8 years ago

Newly created? You doubt my powers? https://moz-doiuse.herokuapp.com/ is working with all the modifications we need! ;)