jquery / 2012-dev-summit

Information regarding the 2012 Developer Summit in DC
14 stars 14 forks source link

Verify there are no non-ASCII chars in built files #25

Closed dmethvin closed 12 years ago

dmethvin commented 12 years ago

I fixed #12690 for 1.8.3 but there's nothing in place to prevent a regression. Seems like it should be doable with the appropriate grep options in a grunt build step.

scottgonzalez commented 12 years ago

Share the love with jQuery UI and jQuery Mobile too :-)

gnarf commented 12 years ago

Grunt plugin?

dmethvin commented 12 years ago

As long as the grunt plugin doesn't involve opening the file with node and reading it char by char, I'm good with it.

scottgonzalez commented 12 years ago

Potential implementation:

content = fs.readFileSync( filePath, "utf8" );
isBad = content.length !== Buffer.byteLength( content, "utf8" );
dmethvin commented 12 years ago

I put together some code based on that, which is fortunate because it helped find a bug. This could be turned into a grunt task during the Summit: https://github.com/jquery/jquery/commit/1450305402ee8f36825fd5fa44df913a3be2f4c8

gnarf commented 12 years ago

Out of curiosity, should we request uglifyjs add a flag to use/allow escapes in output instead of utf8?

dmethvin commented 12 years ago

It was already there, I just didn't see it.

dmethvin commented 12 years ago

See also http://bugs.jquery.com/ticket/12725

dmethvin commented 12 years ago

Final code is in https://github.com/jquery/jquery/blob/995f816cf4e0a404075c27e0d249db0b4a07a97e/grunt.js#L404 perhaps the whole task could be converted to a plugin?

jzaefferer commented 12 years ago

Yes please! @rwldrn wanna publish more npm modules?