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

fis3-deploy-imserver

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fis3-deploy-imserver - npm Package Compare versions

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"
}
}
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