Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fis-command-release

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fis-command-release - npm Package Compare versions

Comparing version 0.9.1 to 0.9.2

57

lib/deploy.js

@@ -7,2 +7,20 @@ /*

'use strict';
var port = fis.config.get('livereload.port', 8132);
var hostname = fis.config.get('livereload.hostname', (function(){
var net = require('os').networkInterfaces();
for(var key in net){
if(net.hasOwnProperty(key)){
var details = net[key];
if(details && details.length){
for(var i = 0, len = details.length; i < len; i++){
var ip = String(details[i].address).trim();
if(ip && /^\d+(?:\.\d+){3}$/.test(ip) && ip !== '127.0.0.1'){
return ip;
}
}
}
}
}
return '127.0.0.1';
})());

@@ -93,2 +111,11 @@ function upload(receiver, to, release, content, subpath, callback){

}
if(dest.opt.live && file.isHtmlLike){
var code = '<script type="text/javascript" charset="utf-8" src="http://' + hostname + ':' + port + '/livereload.js"></script>';
content = content.replace(/"(?:[^\\"\r\n\f]|\\[\s\S])*"|'(?:[^\\'\n\r\f]|\\[\s\S])*'|(<\/body>)/ig, function(m, $1){
if($1){
m = code + m;
}
return m;
});
}
if(charset !== 'utf8' && charset !== 'utf-8'){

@@ -99,10 +126,10 @@ content = fis.util.toEncoding(content, charset);

if(dest.receiver){
if(!file.useHash || dest.md5 != 1){
if(!file.useHash || dest.opt.md5 != 1){
upload(dest.receiver, dest.to, release, content, file.subpath, callback);
}
if(file.useHash && dest.md5 > 0){
if(file.useHash && dest.opt.md5 > 0){
upload(dest.receiver, dest.to, file.getHashRelease(release), content, file.subpath, callback);
}
} else {
deliver(dest.to, dest.md5, release, content, file, callback);
deliver(dest.to, dest.opt.md5, release, content, file, callback);
}

@@ -123,5 +150,5 @@ } else {

var cwd = process.cwd();
function factory(opt, md5, root){
var ret = fis.util.clone(opt);
ret.md5 = md5;
function factory(dest, opt, root){
var ret = fis.util.clone(dest);
ret.opt = opt;
ret.root = ret.root || root;

@@ -162,14 +189,14 @@ ret.from = normilize(ret.from);

exports = module.exports = function(dest, md5, collection){
exports = module.exports = function(opt, collection){
var settings = fis.config.get('deploy', {});
var root = fis.project.getProjectPath();
var dests = [];
dest.split(/,/g).forEach(function(d){
var opt = settings[d] || {};
if(fis.util.is(opt, 'Array')){
opt.forEach(function(item){
dests.push(factory(item, md5, root));
opt.dest.split(/,/g).forEach(function(d){
var dest = settings[d] || {};
if(fis.util.is(dest, 'Array')){
dest.forEach(function(item){
dests.push(factory(item, opt, root));
});
} else {
if(!opt.to){
if(!dest.to){
if(

@@ -180,3 +207,3 @@ d === 'preview' || //release to preivew

){
opt.to = d;
dest.to = d;
} else {

@@ -186,3 +213,3 @@ fis.log.error('invalid deploy destination options [' + d + ']');

}
dests.push(factory(opt, md5, root));
dests.push(factory(dest, opt, root));
}

@@ -189,0 +216,0 @@ });

{
"name" : "fis-command-release",
"description" : "fis release command.",
"version" : "0.9.1",
"version" : "0.9.2",
"author" : "FIS Team <fis@baidu.com>",

@@ -6,0 +6,0 @@ "homepage" : "http://fis.baidu.com/",

@@ -119,4 +119,4 @@ /*

}
deploy(opt.dest, opt.md5, collection);
deploy(opt.dest, opt.md5, ret.pkg);
deploy(opt, collection);
deploy(opt, ret.pkg);
collection = {};

@@ -225,2 +225,3 @@ return;

var LiveReloadServer = require('livereload-server-spec');
var port = fis.config.get('livereload.port', 8132);
LRServer = new LiveReloadServer({

@@ -230,2 +231,3 @@ id: 'com.baidu.fis',

version : fis.cli.info.version,
port : port,
protocols: {

@@ -236,3 +238,3 @@ monitoring: 7

LRServer.on('livereload.js', function(req, res) {
var script = fis.util.read(__dirname + '/vendor/livereload.js');
var script = fis.util.fs.readFileSync(__dirname + '/vendor/livereload.js');
res.writeHead(200, {'Content-Length': script.length, 'Content-Type': 'text/javascript'});

@@ -247,4 +249,4 @@ res.end(script);

});
process.stdout.write('\n Ψ '.bold.yellow + '35729');
delete options.live;
process.stdout.write('\n Ψ '.bold.yellow + port + '\n');
//delete options.live;
}

@@ -251,0 +253,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc