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

fis-command-release

Package Overview
Dependencies
Maintainers
2
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.11.3 to 0.11.4

101

lib/deploy.js

@@ -27,2 +27,3 @@ /*

}
return '127.0.0.1';

@@ -34,2 +35,3 @@ })();

from = from.replace(/\/$/, '');
if(subOnly){

@@ -46,19 +48,21 @@ return path.substring(from.length);

}
return path;
}
function prepareDeploy(dest, file, callback){
if(file.release){
function prepareDeploy(dest, file, callback) {
if(file.release) {
var release = replaceFrom(file.release, dest.from, dest.subOnly);
var content = file.getContent();
var charset = file.charset;
if(file.isText() && content.length){
if(dest.replace && dest.replace.from){
if(file.isText() && content.length) {
if(dest.replace && dest.replace.from) {
var reg = dest.replace.from;
if(typeof reg === 'string'){
if(typeof reg === 'string') {
reg = new RegExp(fis.util.escapeReg(reg), 'g');
} else if(!(reg instanceof RegExp)){
} else if(!(reg instanceof RegExp)) {
fis.log.error('invalid deploy.replace.from [' + reg + ']');
}
content = content.replace(reg, dest.replace.to);

@@ -75,2 +79,3 @@ }

}
return m;

@@ -88,10 +93,20 @@ });

file.setContent(content);
}
if(file.useHash && dest.opt.md5 > 0){
if (!processors[dest._type]){
fis.log.error('invalid deploy plugin [' + dest._type + ']');
}
if(file.useHash && dest.opt.md5 > 0) {
if (dest.opt.md5 > 1) {
//保留不带md5的文件,release
callback && callback(processors[dest._type], dest, release, file, content, settings[dest._name]);
}
release = file.getHashRelease(release);
}
if (!processors[dest._type]){
fis.log.error('invalid deploy plugin [' + dest._type + ']');
}
callback && callback(processors[dest._type], dest, release, file, content, settings[dest._name]);
} else {

@@ -107,2 +122,3 @@ fis.log.error('unreleasable file [' + file.realpath + ']');

}
return str.replace(/\/$/, '') + '/';

@@ -122,13 +138,13 @@ }

function doTask(tasks, done){
function doTask(tasks, done) {
var asyncTasks = [];
tasks.forEach(function(task){
asyncTasks.push(function(cb){
prepareDeploy(task.dest, task.file, function(processor, dest, release, file, content, settings){
processor({to: dest.to, release: release}, file, content, dest, function(){
tasks.forEach(function(task) {
asyncTasks.push(function(cb) {
prepareDeploy(task.dest, task.file, function(processor, dest, release, file, content, settings) {
processor({to: dest.to, release: release}, file, content, dest, function() {
//https://github.com/caolan/async/issues/75
//call async.parallelLimit with a sync function might cause Maximum call stack size exceeded
setTimeout(function(){
setTimeout(function() {
cb && cb();
},0);
}, 0);
});

@@ -138,2 +154,3 @@ });

});
async.parallelLimit(asyncTasks, exports.MAX_TASK_SIZE, done);

@@ -144,7 +161,7 @@ }

var asyncTasks = [];
fis.util.map(packTasks, function(name, tasks){
fis.util.map(packTasks, function(name, tasks) {
var files = [];
var taskSettings, taskProcessor;
tasks.forEach(function(task){
prepareDeploy(task.dest, task.file, function(processor, dest, release, file, content, settings){
tasks.forEach(function(task) {
prepareDeploy(task.dest, task.file, function(processor, dest, release, file, content, settings) {
taskSettings = settings;

@@ -162,10 +179,14 @@ taskProcessor = processor;

});
if (taskProcessor){
asyncTasks.push(function(cb){
asyncTasks.push(function(cb) {
taskProcessor(files, taskSettings, cb);
});
}else{
} else {
fis.log.warning('invalid pack deploy content: empty')
}
});
async.parallelLimit(asyncTasks, exports.MAX_TASK_SIZE, done);

@@ -189,6 +210,6 @@ }

var tasks = flaten ? [] : {};
fis.util.map(files, function(subpath, file){
fis.util.map(depolyConfs, function(name, depolyConf){
fis.util.map(files, function(subpath, file) {
fis.util.map(depolyConfs, function(name, depolyConf) {
var target = flaten? tasks : (tasks[name] = tasks[name] || []);
depolyConf.forEach(function(d){
depolyConf.forEach(function(d) {
if(

@@ -198,8 +219,11 @@ file.release &&

fis.util.filter(file.release, d.include, d.exclude)
){
) {
target.push({dest : d, file : file });
}
});
});
});
return tasks;

@@ -242,24 +266,32 @@ }

});
var deployConfs = {};
var packDeployConfs = {};
//choose deploy config by deploy option
opt.dest.split(/,/g).forEach(function(destName){
if (!destName){
if (!destName) {
return false;
}
var dest = settings[destName] || {};
if (!dest._type){
dest._type = DEFAULT_DEPLOY_KEY;
}
var target;
if (dest._fullpack){
if (dest._fullpack) {
target = packDeployConfs[destName] = packDeployConfs[destName] || [];
}else{
} else {
target = deployConfs[destName] = deployConfs[destName] || [];
}
if(fis.util.is(dest, 'Array')){
dest.forEach(function(item){
if(fis.util.is(dest, 'Array')) {
dest.forEach(function(item) {
target.push(factory(item, opt, root));
});
}else {
} else {
//only used when deploy type is default or none

@@ -271,3 +303,3 @@ if(!dest.to && dest._type == DEFAULT_DEPLOY_KEY){

fis.util.isAbsolute(destName) //absolute path
){
) {
dest.to = destName;

@@ -279,2 +311,3 @@ dest._type = DEFAULT_DEPLOY_KEY;

}
target.push(factory(dest, opt, root));

@@ -281,0 +314,0 @@ }

@@ -0,0 +0,0 @@ Copyright (C) 2013 baidu.com

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

@@ -23,3 +23,3 @@ "homepage": "http://fis.baidu.com/",

"async": "0.9.0",
"chokidar": "0.8.4",
"chokidar": "0.12.5",
"livereload-server-spec": "0.2.3"

@@ -26,0 +26,0 @@ },

@@ -0,0 +0,0 @@ # fis-command-release

@@ -17,9 +17,29 @@ /*

var ignoredReg = /[\/\\](?:output\b[^\/\\]*([\/\\]|$)|\.|fis-conf\.js$)/i;
function listener(path){
if(safePathReg.test(path)){
clearTimeout(timer);
timer = setTimeout(function(){
release(opt);
}, 500);
}
opt.srcCache = fis.project.getSource();
function listener(type){
return function (path) {
if(safePathReg.test(path)){
var file = fis.file.wrap(path);
if (type == 'add' || type == 'change') {
if (!opt.srcCache[file.subpath]) {
var file = fis.file(path);
opt.srcCache[file.subpath] = file;
}
} else if (type == 'unlink') {
if (opt.srcCache[file.subpath]) {
delete opt.srcCache[file.subpath];
}
} else if (type == 'unlinkDir') {
fis.util.map(opt.srcCache, function (subpath, file) {
if (file.realpath.indexOf(path) !== -1) {
delete opt.srcCache[subpath];
}
});
}
clearTimeout(timer);
timer = setTimeout(function(){
release(opt);
}, 500);
}
};
}

@@ -51,5 +71,6 @@

})
.on('add', listener)
.on('change', listener)
.on('unlink', listener)
.on('add', listener('add'))
.on('change', listener('change'))
.on('unlink', listener('unlink'))
.on('unlinkDir', listener('unlinkDir'))
.on('error', function(err){

@@ -315,2 +336,2 @@ //fis.log.error(err);

});
};
};

@@ -0,0 +0,0 @@ (function() {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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