jscc icon indicating copy to clipboard operation
jscc copied to clipboard

Node Module

Open andrewrota opened this issue 10 years ago • 19 comments

Very cool! What about creating a version of these checks as a standalone node module? That way it could be easily integrated into code sniffs or other static analysis tools.

andrewrota avatar Oct 24 '14 19:10 andrewrota

:+1:

azu avatar Oct 25 '14 00:10 azu

:+1:

hugooliveirad avatar Oct 25 '14 03:10 hugooliveirad

:+1:

d-simon avatar Oct 25 '14 13:10 d-simon

:+1: would love to integrate into build tasks

atticoos avatar Oct 26 '14 18:10 atticoos

:+1:

elijahmanor avatar Oct 27 '14 01:10 elijahmanor

I agree, this would useful to have as a standalone module which can be integrated into something else. I have no experience in making Node modules but I think I should be able to create a Grunt plug-in. Would be something you're interested in?

tbusser avatar Oct 27 '14 09:10 tbusser

No doubt a grunt plugin would be conducive to a port to a node module. Plus - grunt plugin! All for it.

doot0 avatar Oct 27 '14 13:10 doot0

Grunt plugin would be fantastic. If you're able create a grunt plugin, if you create a separate file that you can require into that grunt plugin, you should be easily able to turn that dependency into a standalone module

atticoos avatar Oct 27 '14 13:10 atticoos

I believe the recommended way to create grunt plugins, is to make them wrappers around node modules. If no one else has time to look at this in the next couple of days, I can look into it later this week.

mroderick avatar Oct 27 '14 15:10 mroderick

Yep yep ^^, should just be an interface/wrapper to your node module, so node module first, grunt plugin second. Really should be :cake:

atticoos avatar Oct 27 '14 15:10 atticoos

Okay, so Node it is. Any suggestions as to what would make a good repository name? Perhaps node-jscc?

tbusser avatar Oct 28 '14 08:10 tbusser

I think it would be preferable to have a library that works in the browser as well. Using something similar to this pattern perhaps

 if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
    module.exports = jscc;
 } else {
    window.jscc = jscc;
 }

d-simon avatar Oct 28 '14 08:10 d-simon

:+1:

Also module for Gulp would be nice :)

bl4de avatar Oct 28 '14 09:10 bl4de

@d-simon Everything is already wrapped in a UMD pattern, so that is covered. I've refactored the way the compatibility data is loaded so it will be easier to have the data come from either an URL or the file system. I think a Node module should be possible without a huge effort.

tbusser avatar Oct 28 '14 09:10 tbusser

I have a basic Node.js version available of the JSCC. It can consume a glob, loads the compatibility data and analyses the files matching the glob. I have no previous experience in building Node modules so I am sure there is room for improvement.

I also haven't build anything that reports the findings as I am not sure what would be the best way to go about it (write it to the console, put something in a file, etc). All ideas are more than welcome.

I am going to publish the code that I have to a new repository, I would appreciate if you can give feedback and suggestions for the Node.js version on the new repository.

tbusser avatar Oct 29 '14 16:10 tbusser

@tbusser, cool, thanks for putting this together! Logging to the console with stdout would probably be the most helpful for the output (since it can be piped into anything), though a separate option for writing to a file might be a feature to add after (JSON format maybe?).

andrewrota avatar Oct 30 '14 02:10 andrewrota

@andrewrota Thanks! Logging to the console it will be for now. Expect an update soon. The repository for the Node.js version is up and can be found here.

tbusser avatar Oct 30 '14 09:10 tbusser

:+1:

Gulp would be nice!

codylindley avatar Nov 25 '14 16:11 codylindley

here is a version made for gulp: https://github.com/mozesmagyar/gulp-browser-compat

arroo avatar Jun 22 '16 20:06 arroo