Build: Migrate to grunt 0.4. #867

Merged
merged 3 commits into from Mar 12, 2013

Conversation

Projects
None yet
4 participants
@jzaefferer
Owner

jzaefferer commented Dec 23, 2012

Rename to Gruntfile, upgrade to newer grunt-css and grunt-html, update custom tasks. Drop qunit-junit plugin, not worth the trouble. Update release script to run grunt-prepare after npm-install.

tree diff between old and new dist:

1c1
< dist

---
> dist-0-3/
22d21
< │   ├── Gruntfile.js
270a270
> │   ├── grunt.js

File diff (diff -r -w -q dist dist-0-3/): https://gist.github.com/fb016517fa530ca75213

The banner creation changed: Whitespace is now more consistent, but slightly different. The "Includes: jquery.ui.[component]" line from non-concat files is gone.

Minifiers changed: grunt-contrib-uglify uses uglify2, grunt-css uses clean-css (instead of squish), so all minified files are different as well.

I've dropped the qunit-junit plugin instead of replacing it with the 0.4 compatible grunt-qunit-junit since that doesn't really work yet and the junit reports have provided no value to us while we were using

I'm done here, but would like someone to review and test before a merge to master.

@jzaefferer

This comment has been minimized.

Show comment Hide comment
@jzaefferer

jzaefferer Dec 23, 2012

Owner

Btw. to test just install grunt-cli globally, then you can npm install when switching branches and get the right local grunt version.

Owner

jzaefferer commented Dec 23, 2012

Btw. to test just install grunt-cli globally, then you can npm install when switching branches and get the right local grunt version.

Gruntfile.js
+ jshintrc: ".jshintrc"
+ },
+ files: {
+ src: [ "grunt.js", "build/**/*.js" ]

This comment has been minimized.

Show comment Hide comment
@mikesherov

mikesherov Dec 23, 2012

Member

Gruntfile.js

@mikesherov

mikesherov Dec 23, 2012

Member

Gruntfile.js

This comment has been minimized.

Show comment Hide comment
@jzaefferer

jzaefferer Dec 24, 2012

Owner

Fixed.

package.json
+ "grunt-css": "0.5.1",
+ "grunt-compare-size": "0.3.1",
+ "grunt-html": "0.3.0",
+ "grunt-git-authors": "1.1.0-beta.1",
"rimraf": "2.0.1",

This comment has been minimized.

Show comment Hide comment
@mikesherov

mikesherov Dec 23, 2012

Member

You should add grunt-cli to the package.json file so users, including Jenkins, can run grunt after npm install and be certain to have the right one.

@mikesherov

mikesherov Dec 23, 2012

Member

You should add grunt-cli to the package.json file so users, including Jenkins, can run grunt after npm install and be certain to have the right one.

This comment has been minimized.

Show comment Hide comment
@scottgonzalez

scottgonzalez Dec 24, 2012

Owner

I'd really like to discuss this with the rest of the team. I can't help but feel this is very wrong. grunt-cli should be installed globally before trying to grunt any project; it should be treated as a system-level dependency, like make or java.

@scottgonzalez

scottgonzalez Dec 24, 2012

Owner

I'd really like to discuss this with the rest of the team. I can't help but feel this is very wrong. grunt-cli should be installed globally before trying to grunt any project; it should be treated as a system-level dependency, like make or java.

This comment has been minimized.

Show comment Hide comment
@jzaefferer

jzaefferer Dec 24, 2012

Owner

As I said above: "Btw. to test just install grunt-cli globally, then you can npm install when switching branches and get the right local grunt version.". Jenkins should do the same, then grunt-cli will take care of running whatever grunt version is installed locally. That works great with both 0.3 and 0.4, so I agree with Scott, we shouldn't add grunt-cli as a dependency.

@jzaefferer

jzaefferer Dec 24, 2012

Owner

As I said above: "Btw. to test just install grunt-cli globally, then you can npm install when switching branches and get the right local grunt version.". Jenkins should do the same, then grunt-cli will take care of running whatever grunt version is installed locally. That works great with both 0.3 and 0.4, so I agree with Scott, we shouldn't add grunt-cli as a dependency.

This comment has been minimized.

Show comment Hide comment
@mikesherov

mikesherov Dec 24, 2012

Member

@jzaefferer, sure, I read the comment. I was saying that Jenkins would have a problem, not me. Are you saying that installing grunt-cli on the Jenkins box will take care of both Grunt 0.4 and Grunt 0.3? That's good to know.

However, what about the case for npm test? Is it not good to install grunt-cli so that npm test will work out of the box? Not that I feel strongly about it, but I'm curious what your opinion is.

@mikesherov

mikesherov Dec 24, 2012

Member

@jzaefferer, sure, I read the comment. I was saying that Jenkins would have a problem, not me. Are you saying that installing grunt-cli on the Jenkins box will take care of both Grunt 0.4 and Grunt 0.3? That's good to know.

However, what about the case for npm test? Is it not good to install grunt-cli so that npm test will work out of the box? Not that I feel strongly about it, but I'm curious what your opinion is.

This comment has been minimized.

Show comment Hide comment
@jzaefferer

jzaefferer Dec 28, 2012

Owner

Yes, grunt-cli takes care of both versions. As for npm test, I don't care about that. I consider the grunt binary a system dependency, just as we expect node and npm to exist.

@jzaefferer

jzaefferer Dec 28, 2012

Owner

Yes, grunt-cli takes care of both versions. As for npm test, I don't care about that. I consider the grunt binary a system dependency, just as we expect node and npm to exist.

@mikesherov

This comment has been minimized.

Show comment Hide comment
@mikesherov

mikesherov Dec 23, 2012

Member

One other note, while you're in build/release.js, you might as well change path.existsSync to fs to get rid of that node warning when you run grunt md5.

Member

mikesherov commented Dec 23, 2012

One other note, while you're in build/release.js, you might as well change path.existsSync to fs to get rid of that node warning when you run grunt md5.

Gruntfile.js
- return "<strip_all_banners:" + file + ">";
- });
-}
-
function stripDirectory( file ) {
// TODO: we're receiving the directive, so we need to strip the trailing >

This comment has been minimized.

Show comment Hide comment
@mikesherov

mikesherov Dec 23, 2012

Member

Is this still needed?

@mikesherov

mikesherov Dec 23, 2012

Member

Is this still needed?

This comment has been minimized.

Show comment Hide comment
@jzaefferer

jzaefferer Dec 24, 2012

Owner

Nope, removed.

@jzaefferer

jzaefferer Dec 24, 2012

Owner

Nope, removed.

@mikesherov

This comment has been minimized.

Show comment Hide comment
@mikesherov

mikesherov Dec 23, 2012

Member

Thanks for doing this @jzaefferer ! Also, there was 1 thing that @Krinkle had to modify in Jenkins after we pushed core's upgrade to 0.4. I forgot what it was, but obviously coordinate that with him.

Member

mikesherov commented Dec 23, 2012

Thanks for doing this @jzaefferer ! Also, there was 1 thing that @Krinkle had to modify in Jenkins after we pushed core's upgrade to 0.4. I forgot what it was, but obviously coordinate that with him.

@mikesherov

This comment has been minimized.

Show comment Hide comment
@mikesherov

mikesherov Dec 23, 2012

Member

Last thing to note was, when you add grunt-cli to package.json, you now have a viable npm test command to run, we should consider adding that like we did in core's package.json.

Member

mikesherov commented Dec 23, 2012

Last thing to note was, when you add grunt-cli to package.json, you now have a viable npm test command to run, we should consider adding that like we did in core's package.json.

@Krinkle

This comment has been minimized.

Show comment Hide comment
@Krinkle

Krinkle Dec 24, 2012

Member

What I changed in Jenkins is to use ./node_modules/.bin/grunt <cmd> in the Shell Exec build steps of the Jenkins job(s). Since otherwise it will use the global grunt, which is (and should stay for now at) grunt 0.3.x. We want to use the local version anyway for the reason @mikesherov mentioned.

Member

Krinkle commented Dec 24, 2012

What I changed in Jenkins is to use ./node_modules/.bin/grunt <cmd> in the Shell Exec build steps of the Jenkins job(s). Since otherwise it will use the global grunt, which is (and should stay for now at) grunt 0.3.x. We want to use the local version anyway for the reason @mikesherov mentioned.

@Krinkle

This comment has been minimized.

Show comment Hide comment
@Krinkle

Krinkle Dec 24, 2012

Member

Actually:

[..] executables will be added to the PATH for executing the scripts.
[..] exported into the node_modules/.bin directory on npm install.

Path - scripts - NPM Doc

Testing with scripts.install = "echo $PATH;" I see that the following is added to the PATH for npm scripts:

:/usr/local/bin
:/usr/local/lib/node_modules/npm/bin/node-gyp-bin
:/path/to/your-project/node_modules/.bin
:$PATH

So inside the scripts.test property we don't need to prefix ./node_modules/.bin, unless a global version may exist that can conflict (since that has preference apparently).

Member

Krinkle commented Dec 24, 2012

Actually:

[..] executables will be added to the PATH for executing the scripts.
[..] exported into the node_modules/.bin directory on npm install.

Path - scripts - NPM Doc

Testing with scripts.install = "echo $PATH;" I see that the following is added to the PATH for npm scripts:

:/usr/local/bin
:/usr/local/lib/node_modules/npm/bin/node-gyp-bin
:/path/to/your-project/node_modules/.bin
:$PATH

So inside the scripts.test property we don't need to prefix ./node_modules/.bin, unless a global version may exist that can conflict (since that has preference apparently).

@scottgonzalez

This comment has been minimized.

Show comment Hide comment
@scottgonzalez

scottgonzalez Dec 24, 2012

Owner

What I changed in Jenkins is to use ./node_modules/.bin/grunt in the Shell Exec build steps of the Jenkins job(s). Since otherwise it will use the global grunt, which is (and should stay for now at) grunt 0.3.x. We want to use the local version anyway for the reason @mikesherov mentioned.

Why is that the case? Why do we not want grunt-cli in there globally right now? I really don't think we should be putting grunt-cli in our dependencies.

Owner

scottgonzalez commented Dec 24, 2012

What I changed in Jenkins is to use ./node_modules/.bin/grunt in the Shell Exec build steps of the Jenkins job(s). Since otherwise it will use the global grunt, which is (and should stay for now at) grunt 0.3.x. We want to use the local version anyway for the reason @mikesherov mentioned.

Why is that the case? Why do we not want grunt-cli in there globally right now? I really don't think we should be putting grunt-cli in our dependencies.

@scottgonzalez

This comment has been minimized.

Show comment Hide comment
@scottgonzalez

scottgonzalez Dec 24, 2012

Owner

One thing I've been waiting for is the name change from lint -> jshint. Now that we've got it, I'd like to add a new lint task that lints CSS, HTML, JS.

Owner

scottgonzalez commented Dec 24, 2012

One thing I've been waiting for is the name change from lint -> jshint. Now that we've got it, I'd like to add a new lint task that lints CSS, HTML, JS.

@scottgonzalez

This comment has been minimized.

Show comment Hide comment
@scottgonzalez

scottgonzalez Dec 24, 2012

Owner

I'll try to test this out this week. Still knee-deep in site work right now.

Owner

scottgonzalez commented Dec 24, 2012

I'll try to test this out this week. Still knee-deep in site work right now.

@jzaefferer

This comment has been minimized.

Show comment Hide comment
@jzaefferer

jzaefferer Dec 24, 2012

Owner

Regarding the lint task: Let's make that the default? Or just add it as an extra task? Order should probably be js, css, html.

Owner

jzaefferer commented Dec 24, 2012

Regarding the lint task: Let's make that the default? Or just add it as an extra task? Order should probably be js, css, html.

@scottgonzalez

This comment has been minimized.

Show comment Hide comment
@scottgonzalez

scottgonzalez Dec 24, 2012

Owner

I'm fine with making it the default (I'd still like a named task for it though), unless someone strongly objects to removing tests from the default task.

Owner

scottgonzalez commented Dec 24, 2012

I'm fine with making it the default (I'd still like a named task for it though), unless someone strongly objects to removing tests from the default task.

@mikesherov

This comment has been minimized.

Show comment Hide comment
@mikesherov

mikesherov Dec 24, 2012

Member

I like running the tests in the default task personally. But I'd be just as fine removing it.

Member

mikesherov commented Dec 24, 2012

I like running the tests in the default task personally. But I'd be just as fine removing it.

@mikesherov

This comment has been minimized.

Show comment Hide comment
@mikesherov

mikesherov Dec 28, 2012

Member

Can we land this and then make the minor improvements later? I'm anxious to see this working.

Member

mikesherov commented Dec 28, 2012

Can we land this and then make the minor improvements later? I'm anxious to see this working.

@scottgonzalez

This comment has been minimized.

Show comment Hide comment
@scottgonzalez

scottgonzalez Dec 28, 2012

Owner

@mikesherov I don't want to land this until I've had time to do a dry run of the release process. That should happen early next week (I'm currently knee-deep in site work).

Owner

scottgonzalez commented Dec 28, 2012

@mikesherov I don't want to land this until I've had time to do a dry run of the release process. That should happen early next week (I'm currently knee-deep in site work).

@mikesherov

This comment has been minimized.

Show comment Hide comment
@mikesherov

mikesherov Dec 28, 2012

Member

no problem. I've got an itchy trigger finger.

Member

mikesherov commented Dec 28, 2012

no problem. I've got an itchy trigger finger.

@jzaefferer

This comment has been minimized.

Show comment Hide comment
@jzaefferer

jzaefferer Jan 20, 2013

Owner

Just tested and updated this with rc6 and a rebase against master, no changes required for the new rc, just one merge conflict to resolve (in the generate_themes task).

Owner

jzaefferer commented Jan 20, 2013

Just tested and updated this with rc6 and a rebase against master, no changes required for the new rc, just one merge conflict to resolve (in the generate_themes task).

@@ -18,11 +18,11 @@ var
uiFiles = coreFiles.map(function( file ) {
return "ui/" + file;
- }).concat( grunt.file.expandFiles( "ui/*.js" ).filter(function( file ) {
+ }).concat( expandFiles( "ui/*.js" ).filter(function( file ) {

This comment has been minimized.

Show comment Hide comment
@Krinkle

Krinkle Jan 21, 2013

Member

What's with this? Does grunt.file.expandFiles no longer exist? What does it not (or no longer) do that grunt.file.expandMapping (called from expandFiles) does do?

@Krinkle

Krinkle Jan 21, 2013

Member

What's with this? Does grunt.file.expandFiles no longer exist? What does it not (or no longer) do that grunt.file.expandMapping (called from expandFiles) does do?

This comment has been minimized.

Show comment Hide comment
@scottgonzalez

scottgonzalez Jan 22, 2013

Owner

expandFiles is gone and expandMappings returns a map of src -> dest, not an array.

@scottgonzalez

scottgonzalez Jan 22, 2013

Owner

expandFiles is gone and expandMappings returns a map of src -> dest, not an array.

This comment has been minimized.

Show comment Hide comment
@Krinkle

Krinkle Jan 22, 2013

Member

Crap, you're right. It was removed...

@Krinkle

Krinkle Jan 22, 2013

Member

Crap, you're right. It was removed...

@jzaefferer

This comment has been minimized.

Show comment Hide comment
@jzaefferer

jzaefferer Mar 2, 2013

Owner

I've updated to 0.4 final and rebase against master, its working again but also has too much cruft just to migrate to 0.4. I've file an issue against, hopefully we get some help from there: gruntjs/grunt#700

I also want to look into replacing our custom zip task with grunt-contrib-compress, same for grunt-contrib-clean and test the update for grunt-compare-size. Not sure if we should include those here and combine the testing effort, or land this PR asap and do the other updates separately.

Owner

jzaefferer commented Mar 2, 2013

I've updated to 0.4 final and rebase against master, its working again but also has too much cruft just to migrate to 0.4. I've file an issue against, hopefully we get some help from there: gruntjs/grunt#700

I also want to look into replacing our custom zip task with grunt-contrib-compress, same for grunt-contrib-clean and test the update for grunt-compare-size. Not sure if we should include those here and combine the testing effort, or land this PR asap and do the other updates separately.

@mikesherov

This comment has been minimized.

Show comment Hide comment
@mikesherov

mikesherov Mar 5, 2013

Member

I'm all for land ASAP.

On Sat, Mar 2, 2013 at 7:45 AM, Jörn Zaefferer notifications@github.comwrote:

I've updated to 0.4 final and rebase against master, its working again but
also has too much cruft just to migrate to 0.4. I've file an issue against,
hopefully we get some help from there: gruntjs/grunt#700gruntjs/grunt#700

I also want to look into replacing our custom zip task with
grunt-contrib-compresshttps://github.com/gruntjs/grunt-contrib-compress/,
same for grunt-contrib-cleanhttps://github.com/gruntjs/grunt-contrib-cleanand test the update for
grunt-compare-sizehttps://github.com/rwldrn/grunt-compare-size/pull/16#issuecomment-14322746.
Not sure if we should include those here and combine the testing effort, or
land this PR asap and do the other updates separately.


Reply to this email directly or view it on GitHubhttps://github.com/jquery/jquery-ui/pull/867#issuecomment-14327666
.

Mike Sherov
Lead Developer
SNAP Interactive, Inc.
Ticker: STVI.OB

Member

mikesherov commented Mar 5, 2013

I'm all for land ASAP.

On Sat, Mar 2, 2013 at 7:45 AM, Jörn Zaefferer notifications@github.comwrote:

I've updated to 0.4 final and rebase against master, its working again but
also has too much cruft just to migrate to 0.4. I've file an issue against,
hopefully we get some help from there: gruntjs/grunt#700gruntjs/grunt#700

I also want to look into replacing our custom zip task with
grunt-contrib-compresshttps://github.com/gruntjs/grunt-contrib-compress/,
same for grunt-contrib-cleanhttps://github.com/gruntjs/grunt-contrib-cleanand test the update for
grunt-compare-sizehttps://github.com/rwldrn/grunt-compare-size/pull/16#issuecomment-14322746.
Not sure if we should include those here and combine the testing effort, or
land this PR asap and do the other updates separately.


Reply to this email directly or view it on GitHubhttps://github.com/jquery/jquery-ui/pull/867#issuecomment-14327666
.

Mike Sherov
Lead Developer
SNAP Interactive, Inc.
Ticker: STVI.OB

@jzaefferer

This comment has been minimized.

Show comment Hide comment
@jzaefferer

jzaefferer Mar 9, 2013

Owner

@scottgonzalez are you okay with landing this before 1.10.2? I just did another round of testing and it looks good.

Owner

jzaefferer commented Mar 9, 2013

@scottgonzalez are you okay with landing this before 1.10.2? I just did another round of testing and it looks good.

@@ -5,6 +5,19 @@ module.exports = function( grunt ) {
var path = require( "path" ),
fs = require( "fs" );
+function expandFiles( files ) {

This comment has been minimized.

Show comment Hide comment
@scottgonzalez

scottgonzalez Mar 11, 2013

Owner

Why is this expandFiles() different than the other? Why don't we just expose it instead of redefining it?

@scottgonzalez

scottgonzalez Mar 11, 2013

Owner

Why is this expandFiles() different than the other? Why don't we just expose it instead of redefining it?

This comment has been minimized.

Show comment Hide comment
@jzaefferer

jzaefferer Mar 11, 2013

Owner

The other one is used directly, and only points at files. This one is used via tasks and gets folder wildcards as inputs. Folders have to be filtered out.

I'm not sure what you mean with "expose it instead of redefining it".

See also gruntjs/grunt#700

@jzaefferer

jzaefferer Mar 11, 2013

Owner

The other one is used directly, and only points at files. This one is used via tasks and gets folder wildcards as inputs. Folders have to be filtered out.

I'm not sure what you mean with "expose it instead of redefining it".

See also gruntjs/grunt#700

@scottgonzalez

This comment has been minimized.

Show comment Hide comment
@scottgonzalez

scottgonzalez Mar 11, 2013

Owner

If you've tested the release script, then we can land it.

Owner

scottgonzalez commented Mar 11, 2013

If you've tested the release script, then we can land it.

@jzaefferer

This comment has been minimized.

Show comment Hide comment
@jzaefferer

jzaefferer Mar 11, 2013

Owner

The release script still runs "grunt prepare" inside the DB module, but we don't need that anymore, right? I mean, grunt release_cdn works fine as long as you install DB first, but there's no need to run its prepare task. That's the only issue I noticed when running the release script.

Owner

jzaefferer commented Mar 11, 2013

The release script still runs "grunt prepare" inside the DB module, but we don't need that anymore, right? I mean, grunt release_cdn works fine as long as you install DB first, but there's no need to run its prepare task. That's the only issue I noticed when running the release script.

@scottgonzalez

This comment has been minimized.

Show comment Hide comment
@scottgonzalez

scottgonzalez Mar 11, 2013

Owner

Ok, so let's remove the invocation for the prepare task.

Let's just ignore the expandFiles() until later.

Owner

scottgonzalez commented Mar 11, 2013

Ok, so let's remove the invocation for the prepare task.

Let's just ignore the expandFiles() until later.

jzaefferer added some commits Dec 21, 2012

Build: Migrate to grunt 0.4. Rename to Gruntfile, upgrade to newer gr…
…unt-css and grunt-html, update custom tasks. Drop qunit-junit plugin, not worth the trouble. Update release script to run grunt-prepare after npm-install.
@jzaefferer

This comment has been minimized.

Show comment Hide comment
@jzaefferer

jzaefferer Mar 12, 2013

Owner

Probably our fastest build ever, mostly due to the theme generation change. 25 seconds to run the full release_cdn task.

Owner

jzaefferer commented Mar 12, 2013

Probably our fastest build ever, mostly due to the theme generation change. 25 seconds to run the full release_cdn task.

@jzaefferer jzaefferer merged commit ae3af7f into master Mar 12, 2013

@jzaefferer jzaefferer deleted the grunt-0-4 branch Mar 12, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment