cli: Add basic install support for linux
continuous-integration/appveyor/branch AppVeyor build succeeded Details

http: Fix so listenAsync defaults to all hosts
package: Increment version
master v3.0.0-beta.9
Jonatan Nilsson 2022-03-13 01:22:45 +00:00
parent 4a508d20a4
commit 2edcedb1b7
3 changed files with 24 additions and 4 deletions

24
cli.mjs
View File

@ -82,9 +82,18 @@ if (args[0] === 'checkconfig') {
const runner = path.join(process.cwd(), './runner.mjs')
fs.stat(runner).catch(function() {
console.log('Creating runner.mjs')
return fs.writeFile(runner, basicRunnerTemplate)
}).then(function() {
console.log('Linking local service-core instance')
return util.runCommand('npm', ['link', 'service-core'], null, function(stream) {
console.log(stream.replace('\n', ''))
})
}).then(function() {
return Promise.all([
util.runCommand('npm', ['link', 'service-core'], null, function(stream) {
console.log(stream.replace('\n', ''))
}),
fs.readFile(configFile),
import('node-windows'),
])
@ -124,8 +133,19 @@ if (args[0] === 'checkconfig') {
svc.install();
})
} else {
console.log('non windows install targets are currently unsupported')
process.exit(2)
const runner = path.join(process.cwd(), './runner.mjs')
fs.stat(runner).catch(function() {
console.log('Creating runner.mjs')
return fs.writeFile(runner, basicRunnerTemplate)
}).then(function() {
console.log('Linking local service-core instance')
return util.runCommand('npm', ['link', 'service-core'], null, function(stream) {
console.log(stream.replace('\n', ''))
})
}).then(function() {
console.log('Runner is ready to be added to init.d')
})
}
} else if (args[0] === 'uninstall') {
if(os.platform() === 'win32') {

View File

@ -28,7 +28,7 @@ export default class HttpServer {
return new Promise((res, rej) => {
server.once('error', rej)
server.listen(port, host || '0.0.0.0', () => {
server.listen(port, host || '::', () => {
server.off('error', rej)
res()
})

View File

@ -1,6 +1,6 @@
{
"name": "service-core",
"version": "3.0.0-beta.8",
"version": "3.0.0-beta.9",
"description": "Core boiler plate code to install node server as windows service",
"main": "index.mjs",
"scripts": {