jakejs / jake

JavaScript build tool, similar to Make or Rake. Built to work with Node.js.
http://jakejs.com
Apache License 2.0
1.97k stars 190 forks source link

Should have namespace() { task('default') } #265

Open kud opened 10 years ago

kud commented 10 years ago

Yes I know, you can do:

desc('Compile assets.')
task('compile', function() {

  console.log( chalk.blue('❯ Compiling...\n') )

  jake.exec('gulp compile', { interactive: true }, function() {
    console.log( chalk.green('\n✔ Compiled!') )
  })

})

namespace('compile', function () {
  desc('Compile assets with optimisation.')
  task('production', function() {

    console.log( chalk.blue('❯ Compiling...\n') )

    jake.exec('gulp compile --dist', { interactive: true }, function() {
      console.log( chalk.green('\n✔ Compiled!') )
    })

  })
})

But I think it's clearer and more logical to do:

namespace('compile', function () {

desc('Compile assets.')
task('default', function() {

  console.log( chalk.blue('❯ Compiling...\n') )

  jake.exec('gulp compile', { interactive: true }, function() {
    console.log( chalk.green('\n✔ Compiled!') )
  })

})

  desc('Compile assets with optimisation.')
  task('production', function() {

    console.log( chalk.blue('❯ Compiling...\n') )

    jake.exec('gulp compile --dist', { interactive: true }, function() {
      console.log( chalk.green('\n✔ Compiled!') )
    })

  })
})
mde commented 10 years ago

So are you saying that Jake would essentially create a base-level "compile" alias for "compile:default"?

kud commented 10 years ago

Yes :)

mde commented 10 years ago

I'm not opposed to this. Would you like to make a PR?