absolvent / gore-gulp

Simple way to run and maintain React.js projects without any configuration.
MIT License
1 stars 0 forks source link

Have you consider npm as build tool? #9

Closed zangrafx closed 9 years ago

zangrafx commented 9 years ago

Since your gulp configs are so extensive, have you considered not using gulp and take npm approach like this guy: http://blog.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool/ ? There is reasonig http://blog.keithcirkel.co.uk/why-we-should-stop-using-grunt/

mcharytoniuk commented 9 years ago

Why we should use gulp

I am using gulp instead of such NPM approach because of:

gulp.task("foo", doSomething);
gulp.task("bar", ["foo"], doSomethingElse);
gulp.task("baz", ["foo"], doAnotherThing);
gulp.task("foo", function () {
  return gulp.src("src/**/*.js")
    .pipe(firstTransform())
    .pipe(secondTransform())
    .pipe(thirdTransform())
    .pipe(gulp.dest("./output"));
});
{
  ... 
  "scripts": {
    "lint": "gulp lint",
    "test": "gulp test"
  }
  ...
}
gulp.task("foo", function (done) {
   if ("production" === process.env.NODE_ENV) {
    doSomething(done);
   } else {
    doSomethingElse(done);
   }
});
gulp.task("foo", doFoo);
gulp.task("bar", ["foo"], function () {
  return Promise(function (resolve, reject) {
    if ("development" === process.env.NODE_ENV) {
      try {
        doSomething(resolve);
      } catch (e) {
        reject(e);
      }
    } else {
      resolve();
    }
  }).then(somethingElse);
});
function commonPart(param) {
  return new Promise(...)
}

gulp.task("foo", function () {
  return doFoo().then(commonPart);
});

gulp.task("bar", function () {
  return doBar().then(commonPart);
});
zangrafx commented 9 years ago

Not every library I want to use in Gulp has CLI interface

I guess you can write js wrapper in such cases.

Streams for faster file processing (...)

"scripts": {
    "lint": "jshint **.js --reporter checkstyle > checkstyle.xml"
}

Thanks for explaining, it seems you are right for most such cases.

Anyway such tools like gulp/grunt feels like workaround for npm shortcommings, not the final solution.

mcharytoniuk commented 9 years ago

I agree. If you find some solution more reliable than Gulp, please let me know.