2019-04-09 03:29:20 +07:00
|
|
|
/**
|
|
|
|
* @prettier
|
|
|
|
*/
|
|
|
|
|
2019-04-06 22:42:52 +07:00
|
|
|
const fs = require('fs');
|
|
|
|
const startServer = require('verdaccio').default;
|
|
|
|
const yalm = require('js-yaml');
|
|
|
|
|
2019-04-06 22:51:26 +07:00
|
|
|
const configJsonFormat = yalm.safeLoad(fs.readFileSync('./tools/_config.yaml', 'utf8'));
|
2019-04-06 22:42:52 +07:00
|
|
|
|
|
|
|
const handler = function(webServer, addr, pkgName, pkgVersion) {
|
|
|
|
webServer.listen(addr.port || addr.path, addr.host, () => {
|
|
|
|
console.log(`${pkgName}:${pkgVersion} running ${addr.proto}://${addr.host}:${addr.port}`);
|
|
|
|
});
|
2019-04-06 22:51:26 +07:00
|
|
|
|
|
|
|
process.on('SIGTERM', () => {
|
|
|
|
webServer.close(() => {
|
2019-04-09 03:29:20 +07:00
|
|
|
console.log('Process terminated');
|
|
|
|
});
|
|
|
|
});
|
2019-04-06 22:42:52 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
startServer(configJsonFormat, 8080, '', '1.0.0', 'verdaccio', handler);
|