Muthu Kumar
7 years ago
commit
4a321ff8f9
4 changed files with 338 additions and 0 deletions
@ -0,0 +1 @@ |
|||||
|
node_modules |
@ -0,0 +1,73 @@ |
|||||
|
#!/usr/bin/env node --harmony
|
||||
|
|
||||
|
var program = require('commander'); |
||||
|
var shell = require('shelljs'); |
||||
|
var fs = require('fs-extra'); |
||||
|
var chalk = require('chalk'); |
||||
|
var validator = require('validator'); |
||||
|
var isFQDN = validator.isFQDN |
||||
|
|
||||
|
/* Use in prod |
||||
|
if (!shell.which('nginx')) { |
||||
|
shell.echo('I need nginx to work. Install nginx first. https://nginx.org/'); |
||||
|
shell.exit(1); |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
program |
||||
|
.version('0.0.1') |
||||
|
|
||||
|
program |
||||
|
.command('static <domain> [relativePath]') |
||||
|
.description('Create a static server at this folder.') |
||||
|
.action(function(domain) { |
||||
|
if(!isFQDN(domain)) console.log('Domain is not valid. Please use a valid domain name.') |
||||
|
// Stuff happens here
|
||||
|
}) |
||||
|
|
||||
|
program |
||||
|
.command('proxy <domain> <port>') |
||||
|
.description('Create a proxy server, listening at port number.') |
||||
|
.action(function(domain, port) { |
||||
|
if(!isFQDN(domain)) console.log('Domain is not valid. Please use a valid domain name.') |
||||
|
if(typeof(port) != 'number') console.log('Port should be a number.') |
||||
|
// Stuff happens here
|
||||
|
}) |
||||
|
|
||||
|
program |
||||
|
.command('list') |
||||
|
.description('List all available servers.') |
||||
|
.action(function() { |
||||
|
// Stuff happens here
|
||||
|
}) |
||||
|
|
||||
|
program |
||||
|
.command('kill <domain>') |
||||
|
.description('Kill a server.') |
||||
|
.action(function(domain) { |
||||
|
// Stuff happens here
|
||||
|
}) |
||||
|
|
||||
|
program |
||||
|
.command('*') |
||||
|
.action(function() { |
||||
|
console.log('Invalid command. Type "up --help" for help.') |
||||
|
}) |
||||
|
|
||||
|
program.on('--help', function(){ |
||||
|
console.log(''); |
||||
|
console.log(' Usage:'); |
||||
|
console.log(''); |
||||
|
console.log(' ', chalk.yellow('$ up'), chalk.cyan('static'), chalk.blue('domain-name'), chalk.grey('relative-path(optional)')); |
||||
|
console.log(' Set up a static server at domain-name'); |
||||
|
console.log(''); |
||||
|
console.log(' ', chalk.yellow('$ up'), chalk.cyan('proxy'), chalk.blue('domain-name port-number')); |
||||
|
console.log(' Set up a proxy server listening at port-number'); |
||||
|
console.log(''); |
||||
|
}); |
||||
|
|
||||
|
program.parse(process.argv); |
||||
|
|
||||
|
if (program.peppers) { |
||||
|
console.log('\nPlease add domain name.\nExample: up static domain.name') |
||||
|
} |
@ -0,0 +1,226 @@ |
|||||
|
{ |
||||
|
"name": "up-serve", |
||||
|
"version": "0.0.1", |
||||
|
"lockfileVersion": 1, |
||||
|
"requires": true, |
||||
|
"dependencies": { |
||||
|
"ansi-styles": { |
||||
|
"version": "3.2.0", |
||||
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", |
||||
|
"integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", |
||||
|
"requires": { |
||||
|
"color-convert": "1.9.0" |
||||
|
} |
||||
|
}, |
||||
|
"balanced-match": { |
||||
|
"version": "1.0.0", |
||||
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", |
||||
|
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" |
||||
|
}, |
||||
|
"brace-expansion": { |
||||
|
"version": "1.1.8", |
||||
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", |
||||
|
"integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", |
||||
|
"requires": { |
||||
|
"balanced-match": "1.0.0", |
||||
|
"concat-map": "0.0.1" |
||||
|
} |
||||
|
}, |
||||
|
"chalk": { |
||||
|
"version": "2.3.0", |
||||
|
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", |
||||
|
"integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", |
||||
|
"requires": { |
||||
|
"ansi-styles": "3.2.0", |
||||
|
"escape-string-regexp": "1.0.5", |
||||
|
"supports-color": "4.5.0" |
||||
|
} |
||||
|
}, |
||||
|
"co": { |
||||
|
"version": "4.6.0", |
||||
|
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", |
||||
|
"integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" |
||||
|
}, |
||||
|
"co-prompt": { |
||||
|
"version": "1.0.0", |
||||
|
"resolved": "https://registry.npmjs.org/co-prompt/-/co-prompt-1.0.0.tgz", |
||||
|
"integrity": "sha1-+zcOntrEhXayenMv5dfyHZ/G5vY=", |
||||
|
"requires": { |
||||
|
"keypress": "0.2.1" |
||||
|
} |
||||
|
}, |
||||
|
"color-convert": { |
||||
|
"version": "1.9.0", |
||||
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", |
||||
|
"integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", |
||||
|
"requires": { |
||||
|
"color-name": "1.1.3" |
||||
|
} |
||||
|
}, |
||||
|
"color-name": { |
||||
|
"version": "1.1.3", |
||||
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", |
||||
|
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" |
||||
|
}, |
||||
|
"commander": { |
||||
|
"version": "2.11.0", |
||||
|
"resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", |
||||
|
"integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==" |
||||
|
}, |
||||
|
"concat-map": { |
||||
|
"version": "0.0.1", |
||||
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", |
||||
|
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" |
||||
|
}, |
||||
|
"escape-string-regexp": { |
||||
|
"version": "1.0.5", |
||||
|
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", |
||||
|
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" |
||||
|
}, |
||||
|
"fs-extra": { |
||||
|
"version": "4.0.2", |
||||
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.2.tgz", |
||||
|
"integrity": "sha1-+RcExT0bRh+JNFKwwwfZmXZHq2s=", |
||||
|
"requires": { |
||||
|
"graceful-fs": "4.1.11", |
||||
|
"jsonfile": "4.0.0", |
||||
|
"universalify": "0.1.1" |
||||
|
} |
||||
|
}, |
||||
|
"fs.realpath": { |
||||
|
"version": "1.0.0", |
||||
|
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", |
||||
|
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" |
||||
|
}, |
||||
|
"glob": { |
||||
|
"version": "7.1.2", |
||||
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", |
||||
|
"integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", |
||||
|
"requires": { |
||||
|
"fs.realpath": "1.0.0", |
||||
|
"inflight": "1.0.6", |
||||
|
"inherits": "2.0.3", |
||||
|
"minimatch": "3.0.4", |
||||
|
"once": "1.4.0", |
||||
|
"path-is-absolute": "1.0.1" |
||||
|
} |
||||
|
}, |
||||
|
"graceful-fs": { |
||||
|
"version": "4.1.11", |
||||
|
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", |
||||
|
"integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" |
||||
|
}, |
||||
|
"has-flag": { |
||||
|
"version": "2.0.0", |
||||
|
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", |
||||
|
"integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" |
||||
|
}, |
||||
|
"inflight": { |
||||
|
"version": "1.0.6", |
||||
|
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", |
||||
|
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", |
||||
|
"requires": { |
||||
|
"once": "1.4.0", |
||||
|
"wrappy": "1.0.2" |
||||
|
} |
||||
|
}, |
||||
|
"inherits": { |
||||
|
"version": "2.0.3", |
||||
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", |
||||
|
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" |
||||
|
}, |
||||
|
"interpret": { |
||||
|
"version": "1.0.4", |
||||
|
"resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.4.tgz", |
||||
|
"integrity": "sha1-ggzdWIuGj/sZGoCVBtbJyPISsbA=" |
||||
|
}, |
||||
|
"jsonfile": { |
||||
|
"version": "4.0.0", |
||||
|
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", |
||||
|
"integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", |
||||
|
"requires": { |
||||
|
"graceful-fs": "4.1.11" |
||||
|
} |
||||
|
}, |
||||
|
"keypress": { |
||||
|
"version": "0.2.1", |
||||
|
"resolved": "https://registry.npmjs.org/keypress/-/keypress-0.2.1.tgz", |
||||
|
"integrity": "sha1-HoBFQlABjbrUw/6USX1uZ7YmnHc=" |
||||
|
}, |
||||
|
"minimatch": { |
||||
|
"version": "3.0.4", |
||||
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", |
||||
|
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", |
||||
|
"requires": { |
||||
|
"brace-expansion": "1.1.8" |
||||
|
} |
||||
|
}, |
||||
|
"once": { |
||||
|
"version": "1.4.0", |
||||
|
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", |
||||
|
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", |
||||
|
"requires": { |
||||
|
"wrappy": "1.0.2" |
||||
|
} |
||||
|
}, |
||||
|
"path-is-absolute": { |
||||
|
"version": "1.0.1", |
||||
|
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", |
||||
|
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" |
||||
|
}, |
||||
|
"path-parse": { |
||||
|
"version": "1.0.5", |
||||
|
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", |
||||
|
"integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=" |
||||
|
}, |
||||
|
"rechoir": { |
||||
|
"version": "0.6.2", |
||||
|
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", |
||||
|
"integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", |
||||
|
"requires": { |
||||
|
"resolve": "1.5.0" |
||||
|
} |
||||
|
}, |
||||
|
"resolve": { |
||||
|
"version": "1.5.0", |
||||
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", |
||||
|
"integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", |
||||
|
"requires": { |
||||
|
"path-parse": "1.0.5" |
||||
|
} |
||||
|
}, |
||||
|
"shelljs": { |
||||
|
"version": "0.7.8", |
||||
|
"resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", |
||||
|
"integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", |
||||
|
"requires": { |
||||
|
"glob": "7.1.2", |
||||
|
"interpret": "1.0.4", |
||||
|
"rechoir": "0.6.2" |
||||
|
} |
||||
|
}, |
||||
|
"supports-color": { |
||||
|
"version": "4.5.0", |
||||
|
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", |
||||
|
"integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", |
||||
|
"requires": { |
||||
|
"has-flag": "2.0.0" |
||||
|
} |
||||
|
}, |
||||
|
"universalify": { |
||||
|
"version": "0.1.1", |
||||
|
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz", |
||||
|
"integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=" |
||||
|
}, |
||||
|
"validator": { |
||||
|
"version": "9.1.1", |
||||
|
"resolved": "https://registry.npmjs.org/validator/-/validator-9.1.1.tgz", |
||||
|
"integrity": "sha512-1TGGX1GKilfmcEa9rm+9nI9AqIUQK8oj4jZI0DmTGLTPM5jmowBBhyBIHCks73+P1QPZk2i6oOYUq583uOetHQ==" |
||||
|
}, |
||||
|
"wrappy": { |
||||
|
"version": "1.0.2", |
||||
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", |
||||
|
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,38 @@ |
|||||
|
{ |
||||
|
"name": "up-serve", |
||||
|
"version": "0.0.1", |
||||
|
"description": "A cli tool to quickly create and manage nginx server blocks.", |
||||
|
"main": "index.js", |
||||
|
"scripts": { |
||||
|
"test": "echo \"Error: no test specified\" && exit 1" |
||||
|
}, |
||||
|
"repository": { |
||||
|
"type": "git", |
||||
|
"url": "git+https://github.com/codefeathers/up-serve.git" |
||||
|
}, |
||||
|
"keywords": [ |
||||
|
"up", |
||||
|
"serve", |
||||
|
"nginx", |
||||
|
"server", |
||||
|
"block" |
||||
|
], |
||||
|
"bin": { |
||||
|
"up": "./index.js" |
||||
|
}, |
||||
|
"author": "Muthu Kumar (MKRhere)", |
||||
|
"license": "MIT", |
||||
|
"bugs": { |
||||
|
"url": "https://github.com/codefeathers/up-serve/issues" |
||||
|
}, |
||||
|
"homepage": "https://github.com/codefeathers/up-serve#readme", |
||||
|
"dependencies": { |
||||
|
"chalk": "^2.3.0", |
||||
|
"co": "^4.6.0", |
||||
|
"co-prompt": "^1.0.0", |
||||
|
"commander": "^2.11.0", |
||||
|
"fs-extra": "^4.0.2", |
||||
|
"shelljs": "^0.7.8", |
||||
|
"validator": "^9.1.1" |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue