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

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.0 to 0.1.1

lib/3rd/yuicompressor.jar

10

lib/assets/app.json

@@ -1,1 +0,9 @@

{}
{
"domain":"ufo",
"apache_url":"http://ufo.sogou-inc.com/~{username}/",
"apache_path_reg":"public_html\\/(.*)",
"port":8150,
"rewrite":{
"/aaaaaa":"http://www.sogou.com"
}
}

10

lib/management/commands/build.js

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

var yuicompressor = __dirname + '/../../3rd/yuicompressor.jar';
var confJs = {

@@ -32,2 +36,4 @@ baseUrl: process.cwd() + '/static/js',

exports.run = function(params , options){
options = options || {};
utils.removeFolder('build');

@@ -48,3 +54,3 @@ utils.createFolder('build');

if( options.compile ){
exec( 'java -jar /etc/tools/yuicompressor.jar --type js --charset utf-8 ' + confJs.out + ' -o ' + confJs.out , function(error){
exec( 'java -jar '+ yuicompressor +' --type js --charset utf-8 ' + confJs.out + ' -o ' + confJs.out , function(error){
if( !error ){

@@ -57,3 +63,3 @@ utils.success('Compress javascript file success.');

exec( 'java -jar /etc/tools/yuicompressor.jar --type css --charset utf-8 ' + confCss.out + ' -o ' + confCss.out , function(error){
exec( 'java -jar '+ yuicompressor +' --type css --charset utf-8 ' + confCss.out + ' -o ' + confCss.out , function(error){
if( !error ){

@@ -60,0 +66,0 @@ utils.success('Compress css file success.');

@@ -1,2 +0,1 @@

var fs = require('fs');

@@ -6,3 +5,3 @@ var utils = require('../utils');

var APP_JSON = 'app.json';
var appconf = require('../conf').config;

@@ -15,14 +14,6 @@ exports.usage = 'ufo start [port]\n';

var root = process.cwd(),
appconf = null,
port = 8150;
var conffile = root + '/' + APP_JSON;
if( !fs.statSync( conffile ).isFile() ){
utils.error("Can't find app.json, make sure you are in the app directory." , '' , true);
}
appconf = JSON.parse(fs.readFileSync( conffile , 'utf8' ));
port = params[0] || appconf.port || port;

@@ -42,5 +33,5 @@

utils.success('\tUFO started' +
' on http://ufo:' + port );
' on http://'+ (appconf.domain || 'ufo') +':' + port );
});
};

@@ -5,3 +5,6 @@

var request = require('request');
var fs = require('fs');
var appconf = require('./conf').config;
var APP = function(port){

@@ -21,16 +24,18 @@ this.port = port;

app.get(/\/(\w*\.html)$/ , function(req,res){
app.get(/\/(\w*\.html)$/ , function(req,res){ //html file
var param = req.params;
var file = process.cwd() + '/html/' + param;
var path = utils.getApacheLocation(file);
request.get(path).pipe(res);
res.header('Content-type' , 'text/html');
res.send( fs.readFileSync(file) );
});
app.get(/(.*)/ , function(req,res){
app.get(/\/(\w*\.o)$/ , function(req,res){ //php file
var param = req.params;
var file = process.cwd() + param;
var file = process.cwd() + '/' + param;
var path = utils.getApacheLocation(file) + '.php';
var url = utils.getApacheLocation(file) ;
var path = url.path + url.file.replace('.o' , '.php');

@@ -40,3 +45,14 @@ request.get(path).pipe(res);

if( appconf.rewrite ){
for( var reg in appconf.rewrite ){
app.get( /(\w*)$/ , function(reg){
return function( req , res){
var url = appconf.rewrite[reg];
request.get(url).pipe(res);
};
}(reg) );
}
}
app.listen(this.port);

@@ -43,0 +59,0 @@

@@ -6,2 +6,3 @@

var util = require('util');
var appconf = require('./conf').config;

@@ -39,8 +40,27 @@ var log = function(message){

var getApacheLocation = function(filepath){
var url = 'http://ufo.sogou-inc.com/~{username}/{path}';
var url = appconf.apache_url ;
var username = '' , path = '' , file='';
if( filepath.indexOf('/search') == 0 ){//assume on the ufo server
username = /\/search\/(\w*)\//.exec(filepath)[1];
}
var username = /\/search\/(\w*)\//.exec(filepath)[1];
var path = /public_html\/(.*)/.exec(filepath)[1];
var path_reg = new RegExp(appconf.apache_path_reg);
try{
path = path_reg.exec(filepath)[1];
}catch(e){
error('Error apache path reg.');
}
if( path[path.length-1] != '/' ){
var path_arr = path.split('/');
file = path_arr.pop();
path = path_arr.join('/') + '/';
}
return url.replace('{username}' , username).replace('{path}' , path);
return {
path: url.replace('{username}' , username) + path,
file: file
};
};

@@ -47,0 +67,0 @@

{
"name": "ufo",
"version": "0.1.0",
"version": "0.1.1",
"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