Skip to content

Commit

Permalink
Merge pull request #922 from roblg/cli-expose-watch
Browse files Browse the repository at this point in the history
Export 'watch' as an npm script to speed dev on react-server-cli
  • Loading branch information
mlolson authored Jun 21, 2017
2 parents bc46fee + 2100c7a commit d274578
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
25 changes: 14 additions & 11 deletions packages/react-server-cli/gulpfile.babel.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
import eslint from "gulp-eslint";
import gulp from "gulp";
import babel from "gulp-babel";
import changed from "gulp-changed";
import jasmine from "gulp-jasmine";
import logging from "react-server-gulp-module-tagger";

gulp.task("default", () => {
var dest = "target";
return gulp.src("src/**/*.js")
.pipe(changed(dest))
.pipe(logging())
.pipe(babel())
.pipe(gulp.dest("target"));
.pipe(gulp.dest(dest));
});

gulp.task("eslint", [], () => {
return gulp.src("src/**/*.js")
// eslint() attaches the lint output to the eslint property
// of the file object so it can be used by other modules.
.pipe(eslint())
// eslint.format() outputs the lint results to the console.
// Alternatively use eslint.formatEach() (see Docs).
.pipe(eslint.format())
// To have the process exit with an error code (1) on
// lint error, return the stream and pipe to failOnError last.
.pipe(eslint.failAfterError());
// eslint() attaches the lint output to the eslint property
// of the file object so it can be used by other modules.
.pipe(eslint())
// eslint.format() outputs the lint results to the console.
// Alternatively use eslint.formatEach() (see Docs).
.pipe(eslint.format())
// To have the process exit with an error code (1) on
// lint error, return the stream and pipe to failOnError last.
.pipe(eslint.failAfterError());
});

gulp.task("test", ["default", "eslint"], () => {
Expand All @@ -30,5 +33,5 @@ gulp.task("test", ["default", "eslint"], () => {
});

gulp.task("watch", () => {
gulp.watch("src/*.js", ['default']);
gulp.watch("src/**/*.js", ['default']);
});
2 changes: 2 additions & 0 deletions packages/react-server-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"prepublish": "gulp",
"lint": "gulp eslint",
"watch": "gulp && gulp watch",
"test": "npm run ava && gulp test && nsp check",
"ava": "ava",
"ava-watch": "ava --watch",
Expand Down Expand Up @@ -60,6 +61,7 @@
"fs-readdir-recursive": "^1.0.0",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-changed": "^1.3.2",
"gulp-eslint": "^3.0.1",
"gulp-jasmine": "^2.4.2",
"memory-stream": "0.0.3",
Expand Down

0 comments on commit d274578

Please sign in to comment.