-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ebe9db
commit 008cdb9
Showing
5 changed files
with
43 additions
and
24 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,44 +1,43 @@ | ||
const gulp = require('gulp'); | ||
const fs = require('fs'); | ||
const del = require('del'); | ||
const inlineStr = require('gulp-inline-str'); | ||
const babel = require('gulp-babel'); | ||
const uglify = require('gulp-uglify'); | ||
const concat = require('gulp-concat'); | ||
const gulp = require('gulp') | ||
const fs = require('fs') | ||
const del = require('del') | ||
const inlineStr = require('gulp-inline-str') | ||
const babel = require('gulp-babel') | ||
const uglify = require('gulp-uglify') | ||
const concat = require('gulp-concat') | ||
|
||
const babelOptions = JSON.parse(fs.readFileSync('./.babelrc', 'utf8')); | ||
const babelOptions = JSON.parse(fs.readFileSync('./.babelrc', 'utf8')) | ||
|
||
const paths = { | ||
scripts: [ 'src/index.js', 'src/getDeviceId.js', 'src/havePropsChanged.js' ], | ||
scripts: [ 'src/index.js', 'src/getDeviceId.js', 'src/havePropsChanged.js', 'src/errors.js' ], | ||
worker: 'src/worker.js', | ||
jsQR: 'node_modules/jsqr/dist/jsQR.js', | ||
destination: './lib', | ||
}; | ||
} | ||
|
||
gulp.task('clean', function() { | ||
return del([ paths.destination + '/*.js' ]); | ||
}); | ||
return del([ paths.destination + '/*.js' ]) | ||
}) | ||
|
||
gulp.task('worker', [ 'clean' ], function() { | ||
return gulp | ||
.src([ paths.jsQR, paths.worker ]) | ||
.pipe(concat('worker.js')) | ||
.pipe(gulp.dest(paths.destination)); | ||
}); | ||
.pipe(gulp.dest(paths.destination)) | ||
}) | ||
|
||
gulp.task('build', [ 'worker' ], function() { | ||
return gulp | ||
.src(paths.scripts) | ||
.pipe(inlineStr({ basePath: paths.destination })) | ||
.pipe(babel(babelOptions)) | ||
.pipe(gulp.dest(paths.destination)); | ||
}); | ||
.pipe(gulp.dest(paths.destination)) | ||
}) | ||
|
||
// Rerun the task when a file changes | ||
gulp.task('watch', function() { | ||
gulp.watch(paths.scripts, [ 'build' ]); | ||
}); | ||
gulp.watch(paths.scripts, [ 'build' ]) | ||
}) | ||
|
||
// The default task (called when you run `gulp` from cli) | ||
gulp.task('default', [ 'watch', 'build' ]); | ||
gulp.task('default', [ 'watch', 'build' ]) |
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,11 @@ | ||
'use strict'; | ||
|
||
function NoVideoInputDevicesError() { | ||
this.name = 'NoVideoInputDevicesError'; | ||
this.message = 'No video input devices found'; | ||
} | ||
NoVideoInputDevicesError.prototype = new Error(); | ||
|
||
module.exports = { | ||
NoVideoInputDevicesError: NoVideoInputDevicesError | ||
}; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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