0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-13 22:48:31 -05:00
verdaccio/bin/npmrepod
2013-05-31 10:26:11 +04:00

24 lines
979 B
JavaScript
Executable file

#!/usr/bin/env node
var fs = require('fs');
var yaml = require('js-yaml');
var commander = require('commander');
var pkg = yaml.safeLoad(fs.readFileSync('../package.yaml', 'utf8'));
var server = require('../lib/index');
commander
.option('-l, --listen <[host:]port>', 'host:port number to listen on (default: localhost:4873)', '4873')
.option('-s, --storage <path>', 'path to package cache (default: "~/.npmrepod")')
// todo: need something to do with invalid https certificate, but we just can't use http by default
.option('-u, --uplink <url>', 'parent registry (default: "https://registry.npmjs.org/")')
.option('-c, --config <file.yaml>', 'use this configuration file')
.version(pkg.version)
.parse(process.argv);
var hostport = commander.listen.split(':');
if (hostport.length < 2) {
hostport = [undefined, hostport[0]];
}
server({}).listen(hostport[1], hostport[0]);
console.log('Server is listening on http://%s:%s/', hostport[0] || 'localhost', hostport[1]);