-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add module export in project root * Remove npmignore in favor of files array in package.json * Adds minimal Gulp v4 build - clean - lint ( ESLint ./src ) - build ( Babel transpile to ./lib ) - watch ( Standard watch & rebuild ) - default ( Cleans, lints & builds )
- Loading branch information
Showing
7 changed files
with
94 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
node_modules | ||
coverage | ||
dist | ||
lib |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
const gulp = require('gulp') | ||
const del = require('del') | ||
const util = require('gulp-util') | ||
const eslint = require('gulp-eslint') | ||
const babel = require('gulp-babel') | ||
|
||
gulp.task('clean', function(done) { | ||
del([ | ||
'lib/**/*', | ||
]) | ||
done() | ||
}) | ||
|
||
/** | ||
* Lints all the JavaScript in the project. | ||
* Ignores transpiled code & node_modules. | ||
*/ | ||
gulp.task('lint', function(done) { | ||
gulp.src(['**/*.js', '!node_modules/**', '!lib/**']) | ||
.pipe(eslint()) | ||
.pipe(eslint.format()) | ||
.pipe(eslint.failAfterError()) | ||
done() | ||
}) | ||
|
||
/** | ||
* Transpiles with Babel based on defined presets. | ||
*/ | ||
gulp.task('build', function(done) { | ||
gulp.src('src/**/*.js') | ||
.pipe(babel({ | ||
presets: ['es2015', 'stage-2'] | ||
})) | ||
.pipe(gulp.dest('lib')) | ||
done() | ||
}) | ||
|
||
/** | ||
* Watches for changes in the src directory. | ||
* "on change" transpiles incrementally. | ||
* "on unlink" removes the transpiled version of the deleted file. | ||
*/ | ||
gulp.task('watch', function() { | ||
gulp.watch('src/**/*.js') | ||
.on('change', function(path) { | ||
gulp.src(path) | ||
.pipe(babel({ | ||
presets: ['es2015', 'stage-2'] | ||
})) | ||
.pipe(gulp.dest('lib')) | ||
util.log(`File "${path}" rebuilt`) | ||
}) | ||
.on('unlink', function(path) { | ||
util.log(`File "${path}" removed`) | ||
let filePathFromSrc = path.relative(path.resolve('src')) | ||
let destFilePath = path.resolve('build', filePathFromSrc) | ||
|
||
del.sync(destFilePath) | ||
}) | ||
}) | ||
|
||
/** | ||
* Entrypoint for running watch. | ||
*/ | ||
gulp.task('build.watch', gulp.series('build', 'watch', function(done) { | ||
done() | ||
})) | ||
|
||
gulp.task('default', gulp.series('clean', 'lint', 'build', function(done) { | ||
done() | ||
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* | ||
MIT License http://www.opensource.org/licenses/mit-license.php | ||
Author Tobias Koppers @sokra | ||
*/ | ||
module.exports = require('./lib/karma-webpack') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.