Socket
Socket
Sign inDemoInstall

ufo

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ufo - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

lib/assets/html/footer.html

3

lib/assets/static/js/main.js
require.config({
baseUrl: '/static/js'
baseUrl: 'static/js'
});

@@ -9,2 +9,3 @@ var fs = require('fs');

var UFO_JS = '/static/js/ufo.js';

@@ -34,3 +35,30 @@ var confJs = {

var compileHtml = function(){
var base_path = process.cwd() + '/',
html_path = base_path + 'html/';
var header = fs.readFileSync( html_path + 'header.html' );
var footer = fs.readFileSync( html_path + 'footer.html' );
var htmls = fs.readdirSync(html_path);
var result = [];
for (var i = 0; i < htmls.length; i += 1) {
var file = htmls[i];
if( file.indexOf( '.html' ) == -1 ) continue;
if( file == 'header.html' || file == 'footer.html' ) continue;
try{
var body = fs.readFileSync( html_path + file );
fs.writeFileSync( base_path + 'build/' + file , header + body + footer );
result.push(file);
}catch(e){
utils.error('Compile html file ' + file + ' failed');
continue;
};
}
utils.success( 'Compile html files '+ result.join(',') + ' success' );
};
exports.run = function(params , options){

@@ -42,3 +70,3 @@ options = options || {};

utils.processFolder(process.cwd() + '/build' , process.cwd() , ['static', 'build','app.json']);
utils.processFolder(process.cwd() + '/build' , process.cwd() , ['build','app.json']);

@@ -52,4 +80,8 @@ requirejs.optimize(confJs , function(res){

});
fs.writeFileSync( process.cwd() + '/build' + UFO_JS , fs.readFileSync(process.cwd() + UFO_JS) );
compileHtml();
if( options.compile ){

@@ -56,0 +88,0 @@ exec( 'java -jar '+ yuicompressor +' --type js --charset utf-8 ' + confJs.out + ' -o ' + confJs.out , function(error){

@@ -25,6 +25,24 @@

var param = req.params;
var file = process.cwd() + '/html/' + param;
var html_dir = process.cwd() + '/html/';
res.header('Content-type' , 'text/html');
res.send( fs.readFileSync(file) );
try{
res.header('Content-type' , 'text/html');
var body = fs.readFileSync( html_dir + param );
var header = fs.readFileSync( html_dir + 'header.html' );
var footer = fs.readFileSync( html_dir + 'footer.html' );
res.send( header + body + footer );
}catch(e){
try{
res.header('Content-type' , 'text/html');
var body = fs.readFileSync( process.cwd() + '/' + param );
res.send( body);
}catch(e){
res.send(404);
}
}
});

@@ -39,3 +57,3 @@

var path = url.path + url.file.replace('.o' , '.php');
var path = url.path + 'phpd/' + url.file.replace('.o' , '.php');

@@ -47,5 +65,6 @@ request.get(path).pipe(res);

for( var reg in appconf.rewrite ){
app.get( /(\w*)$/ , function(reg){
app.get( new RegExp(reg) , function(reg){
return function( req , res){
var url = appconf.rewrite[reg];
utils.log('Rewrite ' + reg + ' to ' + url );
request.get(url).pipe(res);

@@ -52,0 +71,0 @@ };

{
"name": "ufo",
"version": "0.1.1",
"version": "0.1.2",
"description": "UFO is a develope environment for front-end developer",

@@ -5,0 +5,0 @@ "author": "UFO Team of Sogou-inc.",

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