cli: Add basic install support for linux
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
http: Fix so listenAsync defaults to all hosts package: Increment version
This commit is contained in:
parent
4a508d20a4
commit
2edcedb1b7
3 changed files with 24 additions and 4 deletions
24
cli.mjs
24
cli.mjs
|
@ -82,9 +82,18 @@ if (args[0] === 'checkconfig') {
|
||||||
const runner = path.join(process.cwd(), './runner.mjs')
|
const runner = path.join(process.cwd(), './runner.mjs')
|
||||||
|
|
||||||
fs.stat(runner).catch(function() {
|
fs.stat(runner).catch(function() {
|
||||||
|
console.log('Creating runner.mjs')
|
||||||
return fs.writeFile(runner, basicRunnerTemplate)
|
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() {
|
}).then(function() {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
|
util.runCommand('npm', ['link', 'service-core'], null, function(stream) {
|
||||||
|
console.log(stream.replace('\n', ''))
|
||||||
|
}),
|
||||||
fs.readFile(configFile),
|
fs.readFile(configFile),
|
||||||
import('node-windows'),
|
import('node-windows'),
|
||||||
])
|
])
|
||||||
|
@ -124,8 +133,19 @@ if (args[0] === 'checkconfig') {
|
||||||
svc.install();
|
svc.install();
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
console.log('non windows install targets are currently unsupported')
|
const runner = path.join(process.cwd(), './runner.mjs')
|
||||||
process.exit(2)
|
|
||||||
|
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') {
|
} else if (args[0] === 'uninstall') {
|
||||||
if(os.platform() === 'win32') {
|
if(os.platform() === 'win32') {
|
||||||
|
|
|
@ -28,7 +28,7 @@ export default class HttpServer {
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
server.once('error', rej)
|
server.once('error', rej)
|
||||||
|
|
||||||
server.listen(port, host || '0.0.0.0', () => {
|
server.listen(port, host || '::', () => {
|
||||||
server.off('error', rej)
|
server.off('error', rej)
|
||||||
res()
|
res()
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "service-core",
|
"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",
|
"description": "Core boiler plate code to install node server as windows service",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in a new issue