fis-command-release
Advanced tools
Comparing version 0.8.0 to 0.8.1
{ | ||
"name" : "fis-command-release", | ||
"description" : "fis release command.", | ||
"version" : "0.8.0", | ||
"version" : "0.8.1", | ||
"author" : "FIS Team <fis@baidu.com>", | ||
@@ -20,5 +20,6 @@ "homepage" : "http://fis.baidu.com/", | ||
"dependencies" : { | ||
"chokidar" : "0.6.2" | ||
"chokidar" : "0.6.2", | ||
"livereload-server" : "0.2.3" | ||
}, | ||
"devDependencies": {} | ||
} |
@@ -11,9 +11,13 @@ # fis-command-release | ||
-d, --dest <names> release output destination | ||
-r, --root <path> set project root | ||
-w, --watch monitor the changes of project | ||
-c, --clean clean cache before releasing | ||
--md5 <level> md5 release option | ||
--domain add domain | ||
--lint with lint | ||
--optimize with optimize | ||
--pack with package | ||
-L, --live automatically reload your browser | ||
-c, --clean clean compile cache | ||
-m, --md5 [level] md5 release option | ||
-D, --domains add domain name | ||
-l, --lint with lint | ||
-t, --test with unit testing | ||
-o, --optimize with optimizing | ||
-p, --pack with package | ||
-u, --unique use unique compile caching | ||
--debug debug mode |
@@ -19,2 +19,5 @@ /* | ||
clearTimeout(timer); | ||
if(LRServer){ | ||
clearTimeout(LRTimer); | ||
} | ||
timer = setTimeout(function(){ | ||
@@ -47,2 +50,3 @@ release(opt); | ||
var LRServer, LRTimer; | ||
var lastModified = {}; | ||
@@ -52,2 +56,20 @@ var collection = {}; | ||
function reload(){ | ||
fis.util.map(LRServer.connections, function(id, connection){ | ||
try { | ||
connection.send({ | ||
command: 'reload', | ||
path: '*', | ||
liveCSS: true | ||
}); | ||
process.stdout.write('\n Ψ'.bold.yellow + '35729'); | ||
} catch (e) { | ||
try { | ||
connection.close(); | ||
} catch (e) {} | ||
delete LRServer.connections[id]; | ||
} | ||
}); | ||
} | ||
function release(opt){ | ||
@@ -100,2 +122,6 @@ var flag, cost, start = Date.now(); | ||
collection = {}; | ||
if(LRServer){ | ||
clearTimeout(LRTimer); | ||
LRTimer = setTimeout(reload, 500); | ||
} | ||
return; | ||
@@ -121,2 +147,3 @@ } | ||
.option('-w, --watch', 'monitor the changes of project') | ||
.option('-L, --live', 'automatically reload your browser') | ||
.option('-c, --clean', 'clean compile cache', Boolean, false) | ||
@@ -198,2 +225,27 @@ .option('-m, --md5 [level]', 'md5 release option', Number) | ||
if(options.live){ | ||
var LiveReloadServer = require('livereload-server'); | ||
LRServer = new LiveReloadServer({ | ||
id: 'com.baidu.fis', | ||
name: 'fis-reload', | ||
version : fis.cli.info.version, | ||
protocols: { | ||
monitoring: 7 | ||
} | ||
}); | ||
LRServer.on('livereload.js', function(req, res) { | ||
var script = fis.util.read(__dirname + '/vendor/livereload.js'); | ||
res.writeHead(200, {'Content-Length': script.length, 'Content-Type': 'text/javascript'}); | ||
res.end(script); | ||
}); | ||
LRServer.listen(function(err) { | ||
if (err) { | ||
err.message = 'LiveReload server Listening failed: ' + err.message; | ||
fis.log.error(err); | ||
} | ||
process.stdout.write('\n Ψ'.bold.yellow + '35729'); | ||
}); | ||
delete options.live; | ||
} | ||
switch (typeof options.md5){ | ||
@@ -200,0 +252,0 @@ case 'undefined': |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
49731
8
1335
22
2
1
+ Addedlivereload-server@0.2.3
+ Addedcommander@0.6.1(transitive)
+ Addeddebug@0.7.4(transitive)
+ Addedlivereload-protocol@0.2.2(transitive)
+ Addedlivereload-server@0.2.3(transitive)
+ Addedoptions@0.0.6(transitive)
+ Addedtinycolor@0.0.1(transitive)
+ Addedwebsocket.io@0.2.1(transitive)
+ Addedws@0.4.20(transitive)