0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-06 22:40:26 -05:00
verdaccio/bin/npmrepod

25 lines
979 B
Text
Raw Normal View History

2013-05-22 01:48:04 -05:00
#!/usr/bin/env node
2013-05-31 01:26:11 -05:00
var fs = require('fs');
var yaml = require('js-yaml');
2013-05-22 01:48:04 -05:00
var commander = require('commander');
2013-05-31 01:26:11 -05:00
var pkg = yaml.safeLoad(fs.readFileSync('../package.yaml', 'utf8'));
var server = require('../lib/index');
2013-05-22 01:48:04 -05:00
commander
2013-05-31 01:26:11 -05:00
.option('-l, --listen <[host:]port>', 'host:port number to listen on (default: localhost:4873)', '4873')
2013-05-22 01:48:04 -05:00
.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/")')
2013-05-31 01:26:11 -05:00
.option('-c, --config <file.yaml>', 'use this configuration file')
.version(pkg.version)
2013-05-22 01:48:04 -05:00
.parse(process.argv);
2013-05-31 01:26:11 -05:00
var hostport = commander.listen.split(':');
if (hostport.length < 2) {
hostport = [undefined, hostport[0]];
2013-05-22 01:48:04 -05:00
}
2013-05-31 01:26:11 -05:00
server({}).listen(hostport[1], hostport[0]);
console.log('Server is listening on http://%s:%s/', hostport[0] || 'localhost', hostport[1]);
2013-05-22 01:48:04 -05:00