1
0
mirror of https://github.com/SomboChea/ui synced 2024-12-26 22:24:26 +07:00
verdaccio-ui/tools/verdaccio.js

24 lines
642 B
JavaScript
Raw Normal View History

/**
* @prettier
*/
2019-04-06 22:42:52 +07:00
const fs = require('fs');
const startServer = require('verdaccio').default;
const yalm = require('js-yaml');
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}`);
});
process.on('SIGTERM', () => {
webServer.close(() => {
console.log('Process terminated');
});
});
2019-04-06 22:42:52 +07:00
};
startServer(configJsonFormat, 8080, '', '1.0.0', 'verdaccio', handler);