Replaced coffescript task with grunt-coffee #522

Closed
wants to merge 6 commits into
from

Conversation

Projects
None yet
6 participants
Contributor

blakeblackshear commented Sep 21, 2012

This replaces the coffee task with grunt-coffee, it has several features that grunt-contrib-coffee doesn't. The biggest one is the ability to maintain a directory structure when compiling the app directory to the temp directory. This addresses issues #407, #387.

I have also opened a pull request to update the generators as well.

Contributor

blakeblackshear commented Sep 22, 2012

I have signed the CLA

Owner

sindresorhus commented Sep 22, 2012

Thanks, but you're using grunt-coffee, instead of grunt-contrib-coffee. Can you change that?

Also make sure the test suite passes locally. I know Travis fails now because it depends on the generator PR, but it should pass locally with both changes.

Sidenote: In the future, please notice if the issue is assigned or not. I was actually in the middle of making this change.

Also link to the other PR by link. GitHub will make it pretty. This makes us not having to hunt it down.

Owner

sindresorhus commented Sep 22, 2012

Also, issue 385 looks like the wrong reference.

Contributor

blakeblackshear commented Sep 22, 2012

I can look again, but i didn't see the ability to preserve the directory
structure with the contrib project.
On Sep 22, 2012 8:26 AM, "Sindre Sorhus" notifications@github.com wrote:

Thanks, but you're using grunt-coffee, instead of grunt-contrib-coffee.
Can you change that?

Also make sure the test suite passes locally. I know Travis fails now
because it depends on the generator PR, but it should pass locally with
both changes.

Sidenote: In the future, please notice if the issue is assigned or not.
I was actually in the middle of making this change.

Also link to the other PR by link. GitHub will make it pretty. This makes
us not having to hunt it down.


Reply to this email directly or view it on GitHubhttps://github.com/yeoman/yeoman/pull/522#issuecomment-8788749.

@sindresorhus sindresorhus commented on an outdated diff Sep 22, 2012

cli/package.json
@@ -55,7 +55,8 @@
"prompt": "~0.1.12",
"colors": "~0.6.0",
"grunt-mocha": "~0.1.3",
- "es6-collections": ">=0.2.0"
+ "es6-collections": ">=0.2.0",
+ "grunt-coffee": "0.0.6"
@sindresorhus

sindresorhus Sep 22, 2012

Owner

"grunt-contrib-coffee": "~0.2.0"

Contributor

blakeblackshear commented Sep 22, 2012

The TravisCI failure looks like something didnt fetch from bower correctly. The tests pass locally, and this pull request isn't dependent on the other one. The other one is dependent on this one.

blakeblackshear referenced this pull request in yeoman/generator Sep 22, 2012

Closed

Update for grunt-coffee task #62

Contributor

blakeblackshear commented Sep 22, 2012

Tests also pass locally when I update the generators with my pull request.

Contributor

blakeblackshear commented Sep 22, 2012

Unless I am missing something, grunt-contrib-coffee does not give me the ability to preserve the directory structure when compiled to temp. This will break rjs when it tries to trace the dependencies.

Owner

sindresorhus commented Sep 22, 2012

Unless I am missing something, grunt-contrib-coffee does not give me the ability to preserve the directory structure when compiled to temp. This will break rjs when it tries to trace the dependencies.

You might be right about that. However grunt-contrib-coffee is the official one, and grunt-coffee is probably going to be deprecated.

Can you add a PR on the grunt-contrib-coffee repo to add that? And we'll just pull in your fork for the time being.

Contributor

blakeblackshear commented Sep 22, 2012

Will do.

Owner

sindresorhus commented Sep 24, 2012

@blakeblackshear Can you update to use the suggested method in the PR? Latest grunt-contrib-coffee is available on NPM.

pheuter commented Sep 24, 2012

@sindresorhus Tried using the suggested method via grunt-contrib-coffee, getting the following warning when building Yeoman project:

Running "coffee:dist" (coffee) task
<WARN> Unable to write "app/scripts/compiled" file (Error code: EISDIR). Use --force to continue. </WARN>

Aborted due to warnings.

In Gruntfile.js, I have:

coffee: {
      dist: {
        src: 'app/scripts/**/*.coffee',
        dest: 'app/scripts/compiled',

        options: {
          base_path: 'app/scripts',
          preserve_dirs: true
        }
      }
},
Contributor

blakeblackshear commented Sep 24, 2012

Tests will fail until this generators pull request is in: https://github.com/yeoman/generators/pull/62
I have verified that they pass locally.

Owner

sindresorhus commented Sep 24, 2012

Landed. Keep up the good work @blakeblackshear :D

Owner

sindresorhus commented Sep 25, 2012

@blakeblackshear Looks like yeoman server isn't working after this PR:

Running "watch" task
Verifying properties watch.coffee.files, watch.coffee.tasks exist in config...ERROR
>> Unable to process task.
<WARN> Required config property "watch.coffee.files" missing. Use --force to continue. </WARN>

Could you take a look?

Owner

addyosmani commented Sep 25, 2012

Confirmed.

Running "watch" task
Verifying properties watch.coffee.files, watch.coffee.tasks exist in config...ERROR
>> Unable to process task.
<WARN> Required config property "watch.coffee.files" missing. Use --force to continue. </WARN>

Aborted due to warnings.
addyo at dhcp-172-16-23-68 in ~/projects/test/556
Contributor

blakeblackshear commented Sep 25, 2012

Looking into it. The contrib coffee task also fails if there are no coffee files, not sure what is the best way to handle that.

Owner

sindresorhus commented Sep 25, 2012

The contrib coffee task also fails if there are no coffee files, not sure what is the best way to handle that.

Fixed that some hours ago. Pull and npm install.

Contributor

blakeblackshear commented Sep 25, 2012

Thanks. The problem is the config for the watch coffee task. It is trying to lookup from <config:coffee.dist.src>, but the new coffee config looks like this:

coffee: {
      compile: {
        files: {
          'temp/scripts/*.js': 'app/scripts/**/*.coffee'
        },
        options: {
          basePath: 'app/scripts'
        }
      }
    }

It can be fixed by just putting 'app/scripts/**/*.coffee' instead of <config:coffee.dist.src>, but I am sure it would be better to look it up. I am not sure how to do a lookup on the new coffee config.

Owner

sindresorhus commented Sep 25, 2012

It would be better to look it up, but we'll go for the temporary fix for now, just to get an release out.

Can you open an issue about this to get it fixed for real, so we don't forget?

Contributor

blakeblackshear commented Sep 25, 2012

Should I also issue a pull request with the temporary fix on the generators repo?

Owner

addyosmani commented Sep 25, 2012

No worries. I've tested the fix and am making the updates to the generators now. Need to test this works with all of them.

Contributor

blakeblackshear commented Sep 25, 2012

Ok. Thanks. Sorry for breaking the build.

Contributor

sleeper commented Sep 26, 2012

I confirm it's working.

Just a question on top of my head: Shouldn't we add something related to this change in the FAQ (i.e. to indicate how the Gruntfile.js needs to be changed, for people that had Gruntfile.js instantiated with previous versions of yeoman) ?

+1 To fixing this. +1 for putting this in the FAQs. You may also want to add that you need to run npm install grunt-contrib-coffee in /usr/local/lib/node_modules/yeoman/node_modules/.

Owner

sindresorhus commented Sep 26, 2012

Agree on fixing and faq.

The last point is incorrect. If you upgrade though npm it's done automatically. If you use master, you can just do 'mom install' in the /cli folder

Contributor

sleeper commented Sep 26, 2012

@sindresorhus I've added an entry in the Additional FAQ ("Q: I just upgraded to 0.9.1 and my coffee files are not compiled anymore" near end of the FAQ)

Owner

sindresorhus commented Sep 26, 2012

@sleeper Much appreciated :)

@sindresorhus When yeoman autoupdated to 0.9.2 it complained that I didn't have the package.

Shouldn't the FAQs reference upgrading to 0.9.2 not 0.9.1?

Contributor

sleeper commented Sep 27, 2012

Actually looking at the changelog, this change has been part of 0.9.1.

@szinya szinya pushed a commit to menthainternet/yeoman that referenced this pull request Sep 17, 2014

@blakeblackshear @sindresorhus blakeblackshear + sindresorhus Close GH-522: Replaced coffescript task with grunt-coffee. Fixes #407,…
… Fixes #387
c0c2040
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment