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

fis-command-upgrade

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fis-command-upgrade - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

0

lib/cssUpgrade.js

@@ -0,0 +0,0 @@ /*

31

lib/jsUpgrade.js

@@ -8,5 +8,6 @@ /*

var util = require('./util.js');
var util = require('./util.js'),
pth = require('path');
exports.update = function(content, namespace) {
exports.update = function(content, namespace, filepath, root) {
var libs = [

@@ -18,2 +19,4 @@ 'tangram',

];
var filepath = filepath,
root = root;

@@ -44,5 +47,16 @@ function inArray (needle, haystack, argStrict) {

var group = '';
if ( v.indexOf(':') == -1 && v.indexOf('.') != 0) {
group = v.split('/');
v = namespace + ':static/' + namespace + '/ui/' + v + '/' + group[group.length-1] + '.js';
if ( v.indexOf(':') == -1) {
if(v.indexOf('.js') == -1){
group = v.split('/');
v = namespace + ':static/' + namespace + '/ui/' + v + '/' + group[group.length-1] + '.js';
}else if(v.indexOf('.') == 0){
v = pth.normalize(pth.dirname(filepath) + '/' + v);
v = v.replace(/[\/\\]+/g, '/');
v = v.replace(root + '/', '');
v = namespace + ':' + v;
}else if(v.indexOf('.js') != -1 && v.indexOf('static') == 0){
v = namespace + ':' + v;
}else if(v.indexOf('.js') != -1 && v.indexOf('/static') == 0){
v = namespace + ':' + v.substring(1);
}
}else if( v.indexOf(':') !== -1){

@@ -144,8 +158,8 @@ group = v.split(':');

function parseFcontent(content){
var reg = /(\bF\.content)(?:\([^)]*\))/g;
var reg = /(\bF\.context)(?:\([^)]*\))/g;
content = content.replace(reg, function (m , value) {
if(m.indexOf(',') !== -1){
m = m.replace('F.content', 'define');
m = m.replace('F.context', 'define');
}else{
m = m.replace('F.content', 'require');
m = m.replace('F.context', 'require');
}

@@ -162,5 +176,4 @@ return m;

content = parseExports(content);
content = parseFcontent(content);
return content;
}

@@ -76,7 +76,7 @@ /*

}
if(!widgetInline){
if(!widgetInline || m == ''){
return m;
}
// path = getWidgetPath(namespace, path);
return '<!--inline[' + path + ']-->';
return '<!--inline[/' + path + ']-->';
});

@@ -164,3 +164,3 @@ return content;

}
return '<!--inline[' + path + ']-->';
return '<!--inline[/' + path.substr(1, path.length-1) + ']-->';
});

@@ -167,0 +167,0 @@ return content;

@@ -10,2 +10,10 @@ /*

util.detContext = function(content){
var reg = /(\bF\.context)(?:\([^)]*\))/g;
if(reg.test(content)){
return true;
}
return false;
}
util.detMarco = function(content){

@@ -12,0 +20,0 @@ var reg = /\{[^}]+{/;

{
"name": "fis-command-upgrade",
"version": "0.0.3",
"version": "0.0.4",
"description": "This tool can help you upgrade your project from FIS-1.x to FIS-2.x.",

@@ -5,0 +5,0 @@ "main": "upgrade.js",

@@ -0,0 +0,0 @@ fis-command-upgrade

@@ -71,5 +71,6 @@ /*

var widget = new Array();
var jsContext = new Array();
fis.util.find(root, /.*\.(tpl|js|html|css)$/).forEach(function(filepath) {
var content = fis.util.read(filepath);
content = js.update(content, namespace);
content = js.update(content, namespace,filepath, root);
filepath = filepath.replace(/[\/\\]+/g, '/');

@@ -92,14 +93,18 @@ content = css.update(content, namespace, filepath, root);

}
if(util.detContext(content)){
jsContext.push(filepath);
}
});
var config = 'fis.config.require(\'pc\');\n'
+ 'fis.config.merge({\n'
+ ' namespace : \'' + namespace +'\',\n'
+ '});';
var config = 'fis.config.merge({\n'
+ ' namespace : \'' + namespace +'\',\n'
+ '});';
var configPath = root + '/fis-conf.js';
fis.util.write(configPath, config);
fis.util.write(root + '/detect.html', createHTML(macro, widget));
if(macro.length >0 && widget.length > 0){
fis.util.write(root + '/detect.html', createHTML(macro, widget,jsContext));
}
});
};
function createHTML(macro, widget){
function createHTML(macro, widget, jsContext){
var html = '<!DOCTYPE html>'

@@ -118,18 +123,40 @@ + '<html>'

var tr = '';
for(var i = 0; i < macro.length; i++){
tr += '<tr class="error">'
+ ' <td style="max-width:500px;word-break:break-all;"> ' + macro[i]+ '</td>'
+ ' <td>此文件中使用了Macro,请替换为Less语法,文件后缀已修改为less,同时请修改跨模块引用此文件的引用方式.</td>'
+ '</tr>'
if(jsContext.length > 0){
for(var i = 0; i < jsContext.length; i++){
tr += '<tr class="error">';
if(i == 0){
tr += '<td style="text-align:center;margin-left:auto;vertical-align: middle;" rowspan="' + macro.length+ '">此文件中使用了F.context,2.0不支持此功能,请替换为其他数据中心.</td>'
}
tr += ' <td style="max-width:500px;word-break:break-all;"> ' + jsContext[i]+ '</td>'
+ '</tr>';
}
}
for(var i = 0; i < widget.length; i++){
tr += '<tr class="error">'
+ ' <td style="max-width:500px;word-break:break-all;"> ' + widget[i]+ '</td>'
+ ' <td >此文件中使用了widget继承,请替换此功能.</td>'
+ '</tr>'
if(macro.length > 0){
for(var i = 0; i < macro.length; i++){
tr += '<tr class="error">';
if(i == 0){
tr += '<td style="text-align:center;margin-left:auto;vertical-align: middle;" rowspan="' + macro.length+ '">此文件中使用了Macro,请替换为Less语法,文件后缀已修改为less,同时请修改跨模块引用此文件的引用方式.</td>'
}
tr += ' <td style="max-width:500px;word-break:break-all;"> ' + macro[i]+ '</td>'
+ '</tr>';
}
}
if(widget.length > 0){
for(var i = 0; i < widget.length; i++){
tr += '<tr class="error">';
if(i == 0){
tr += '<td style="text-align:center;margin-left:auto;vertical-align: middle;" rowspan="' + macro.length+ '">此文件中使用了widget继承,请替换此功能.</td>'
}
tr += ' <td style="max-width:500px;word-break:break-all;"> ' + widget[i]+ '</td>'
+ '</tr>';
}
}
html += '<body>'
+ '<div class="container">'
+ '<table class="table table-hover"><tbody>'
+ '<tr class="table-header"><th>文件路径</th><th>检测功能</th></tr>'
+ '<tr class="table-header"><th>检测功能</th><th>文件路径</th></tr>'
+ tr

@@ -136,0 +163,0 @@ + '</tbody></table>'

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