mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
build - fix copy devMode
This commit is contained in:
parent
4606a23c3f
commit
b2d0e9871c
63
gulpfile.js
63
gulpfile.js
@ -114,6 +114,37 @@ function createCopyTasks(label, opts) {
|
|||||||
copyDevTaskNames.push(copyDevTaskName)
|
copyDevTaskNames.push(copyDevTaskName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copyTask(taskName, opts){
|
||||||
|
const source = opts.source
|
||||||
|
const destination = opts.destination
|
||||||
|
const destinations = opts.destinations || [destination]
|
||||||
|
const pattern = opts.pattern || '/**/*'
|
||||||
|
const devMode = opts.devMode
|
||||||
|
|
||||||
|
return gulp.task(taskName, function () {
|
||||||
|
if (devMode) {
|
||||||
|
watch(source + pattern, (event) => {
|
||||||
|
livereload.changed(event.path)
|
||||||
|
performCopy()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return performCopy()
|
||||||
|
})
|
||||||
|
|
||||||
|
function performCopy() {
|
||||||
|
// stream from source
|
||||||
|
let stream = gulp.src(source + pattern, { base: source })
|
||||||
|
|
||||||
|
// copy to destinations
|
||||||
|
destinations.forEach(function(destination) {
|
||||||
|
stream = stream.pipe(gulp.dest(destination))
|
||||||
|
})
|
||||||
|
|
||||||
|
return stream
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// manifest tinkering
|
// manifest tinkering
|
||||||
|
|
||||||
gulp.task('manifest:chrome', function() {
|
gulp.task('manifest:chrome', function() {
|
||||||
@ -402,38 +433,6 @@ gulp.task('dist',
|
|||||||
|
|
||||||
// task generators
|
// task generators
|
||||||
|
|
||||||
function copyTask(taskName, opts){
|
|
||||||
const source = opts.source
|
|
||||||
const destination = opts.destination
|
|
||||||
const destinations = opts.destinations || [ destination ]
|
|
||||||
const pattern = opts.pattern || '/**/*'
|
|
||||||
const devMode = opts.devMode
|
|
||||||
|
|
||||||
return gulp.task(taskName, performCopy)
|
|
||||||
|
|
||||||
function performCopy(){
|
|
||||||
// stream from source
|
|
||||||
let stream
|
|
||||||
if (devMode) {
|
|
||||||
stream = watch(source + pattern, { base: source })
|
|
||||||
} else {
|
|
||||||
stream = gulp.src(source + pattern, { base: source })
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy to destinations
|
|
||||||
destinations.forEach(function(destination) {
|
|
||||||
stream = stream.pipe(gulp.dest(destination))
|
|
||||||
})
|
|
||||||
|
|
||||||
// trigger reload
|
|
||||||
if (devMode) {
|
|
||||||
stream.pipe(livereload())
|
|
||||||
}
|
|
||||||
|
|
||||||
return stream
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function zipTask(target) {
|
function zipTask(target) {
|
||||||
return () => {
|
return () => {
|
||||||
return gulp.src(`dist/${target}/**`)
|
return gulp.src(`dist/${target}/**`)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user