fis3-deploy-imserver
Advanced tools
Comparing version 1.0.1 to 1.0.2
90
index.js
var path = require('path'); | ||
var dtpl = require('d-tpl'); | ||
var archiver = require('archiver'); | ||
@@ -15,11 +14,9 @@ | ||
// 打包类型 | ||
type: 'tar', | ||
type: 'zip', | ||
// 打包参数 | ||
archiverOptions: { | ||
gzip: true | ||
}, | ||
archiverOptions: {}, | ||
// 生成的压缩包文件名 | ||
file: 'imserver.tar.gz', | ||
file: 'pack.zip', | ||
@@ -55,6 +52,6 @@ // 后定义的正则优先级更高 | ||
ws.on('close', function() { | ||
var content = fs.readFileSync(zipPath), | ||
offline = _(options.projectPath, options.zipTo); | ||
_.mkdir(offline); | ||
fs.writeFileSync(_(offline, options.file), content, 'utf-8'); | ||
var content = fs.readFileSync(zipPath); | ||
var distDir = _(options.projectPath, options.zipTo); | ||
_.mkdir(distDir); | ||
fs.writeFileSync(_(distDir, options.file), content, 'utf-8'); | ||
}); | ||
@@ -65,44 +62,4 @@ } | ||
function expo(options, modified, total, next) { | ||
var htmlFileIds = []; | ||
var pageList = options.pageList; | ||
var root = fis.project.getProjectPath(); | ||
var serverRoot = _(root, options.serverRoot || SERVERROOT); | ||
var viewRoot = _(serverRoot, VIEWDIRNAME); | ||
var match; | ||
if (!pageList || !pageList.length) { | ||
next(); | ||
return; | ||
} | ||
for (var i = 0, l = pageList.length; i < l; ++i) { | ||
htmlFileIds.push(pageList[i] + '.html'); | ||
} | ||
modified.forEach(function(file) { | ||
if (~htmlFileIds.indexOf(file.id)) { | ||
var pageName = file.id.replace(/\.html$/, ''); | ||
/* 处理 html 文件 */ | ||
// 创建目录 | ||
_.mkdir(_(viewRoot, pageName)); | ||
// copy 源文件 | ||
_.copy(_(root, '../dist', file.id), _(viewRoot, pageName, file.id)); | ||
// 编译源文件 | ||
var src = file.getContent(); | ||
var tplFun = dtpl.compile({ | ||
raw: src, | ||
onBeginCompile: function($dom, $, vm) { | ||
$dom.find('html').attr('alpaca', 1); | ||
} | ||
}); | ||
_.write(_(viewRoot, pageName, pageName + '.tpl.js'), tplFun.funSerializationStr); | ||
/* 处理 html 文件 */ | ||
} | ||
}); | ||
/* imserver pack */ | ||
options = _.extend({}, DEF_CONF, options); | ||
@@ -112,17 +69,32 @@ | ||
var to = _(projectPath, options.to); | ||
var packFileList = []; | ||
options.projectPath = projectPath; | ||
_.del(to); // 先把原来的文件夹删掉 | ||
_.mkdir(to); // 再创建 | ||
options.packPathSrc.forEach(function(p) { | ||
var srcPath = _(projectPath, p); | ||
var name = path.basename(srcPath); | ||
_.exists(srcPath) && _.copy(srcPath, to + '/' + name); | ||
var zipPath = _(projectPath, options.to, options.file); | ||
var archive = archiver(options.type, options.archiverOptions); | ||
var ws = fs.createWriteStream(zipPath); | ||
archive.pipe(ws); | ||
archive.bulk([{ | ||
expand: true, | ||
cwd: _(projectPath, options.cwd), | ||
src: ['**', '!' + path.basename(zipPath)].concat(options.packPathSrc) | ||
}]); | ||
archive.on('error', function() { | ||
fis.log.error('生成zip错误,路径 --- ' + zipPath); | ||
}); | ||
zip(options); | ||
/* imserver pack */ | ||
archive.finalize(); | ||
if (options.zipTo) { | ||
ws.on('close', function() { | ||
var content = fs.readFileSync(zipPath); | ||
var distDir = _(projectPath, options.zipTo); | ||
_.mkdir(distDir); | ||
fs.writeFileSync(_(distDir, options.file), content, 'utf-8'); | ||
}); | ||
} | ||
next(); | ||
@@ -129,0 +101,0 @@ } |
{ | ||
"name": "fis3-deploy-imserver", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "fis3 deploy plugin for imserver", | ||
@@ -25,5 +25,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"archiver": "^1.3.0", | ||
"d-tpl": "^0.1.0" | ||
"archiver": "^1.3.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
3790
76
- Removedd-tpl@^0.1.0
- Removedabab@1.0.4(transitive)
- Removedacorn@2.7.0(transitive)
- Removedacorn-globals@1.0.9(transitive)
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedboolbase@1.0.0(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcheerio@0.20.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removedcss-select@1.2.0(transitive)
- Removedcss-what@2.1.3(transitive)
- Removedcssom@0.3.8(transitive)
- Removedcssstyle@0.2.37(transitive)
- Removedd-tpl@0.1.0(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddeep-is@0.1.4(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removeddom-serializer@0.1.1(transitive)
- Removeddomelementtype@1.3.1(transitive)
- Removeddomhandler@2.3.0(transitive)
- Removeddomutils@1.5.1(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedentities@1.0.01.1.2(transitive)
- Removedescodegen@1.14.3(transitive)
- Removedesprima@4.0.1(transitive)
- Removedestraverse@4.3.0(transitive)
- Removedesutils@2.0.3(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedfast-levenshtein@2.0.6(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhtmlparser2@3.8.3(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisarray@0.0.1(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjsdom@7.2.2(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedlevn@0.3.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removednth-check@1.0.2(transitive)
- Removednwmatcher@1.4.4(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedoptionator@0.8.3(transitive)
- Removedparse5@1.5.1(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedprelude-ls@1.1.2(transitive)
- Removedpsl@1.15.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedreadable-stream@1.1.14(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsax@1.4.1(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedstring_decoder@0.10.31(transitive)
- Removedsymbol-tree@3.2.4(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtr46@0.0.3(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removedtype-check@0.3.2(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)
- Removedwebidl-conversions@2.0.1(transitive)
- Removedwhatwg-url-compat@0.6.5(transitive)
- Removedword-wrap@1.2.5(transitive)
- Removedxml-name-validator@2.0.1(transitive)