diff --git a/actions/createProxyServer.js b/actions/createProxyServer.js index 10e9b48..0b0a967 100644 --- a/actions/createProxyServer.js +++ b/actions/createProxyServer.js @@ -31,7 +31,7 @@ function createProxyServer(domain, inPort, outPort) { " }" + EOL + "}" ); - shell.mkdir('-p', npath.confD()); + shell.mkdir('-p', npath.enabledSites()); // Creates directories if doesn't exist shell.ln('-sf', conf(npath.confD(), domain, outPort), diff --git a/actions/killALL.js b/actions/killALL.js index 789253d..c45207b 100644 --- a/actions/killALL.js +++ b/actions/killALL.js @@ -1,6 +1,7 @@ 'use strict'; const shell = require('shelljs'); +const path = require('path'); const { EOL } = require('os'); @@ -17,7 +18,9 @@ function killALL () { shell.mkdir('-p', npath.confD()); shell.mkdir('-p', npath.enabledSites()); shell.mkdir('-p', npath.webRoot()); - shell.cp('./build/defaultNginx.conf', conf(npath.confD())); + console.log(conf(npath.confD())); + shell.cp((path.join(__dirname, '/../build/defaultNginx.conf')), + conf(npath.confD())); // Create the default.conf file shell.ln('-sf', npath.confD() + "default.conf", npath.enabledSites() + "default.conf"); @@ -31,7 +34,7 @@ function killALL () { } function noKill () { - console.log("\nkill-all was interrupted by user."); + console.log(EOL + "kill-all was interrupted by user."); } module.exports.kill = killALL; diff --git a/actions/killAllConfirm.js b/actions/killAllConfirm.js index d6cc380..508e816 100644 --- a/actions/killAllConfirm.js +++ b/actions/killAllConfirm.js @@ -1,12 +1,15 @@ 'use strict'; const readlineSync = require('readline-sync'); + +const { EOL } = require('os'); + const killALL = require('./killALL').kill; const { noKill } = require('./killALL'); function killAllConfirm() { - console.log("\nThis action will destroy all nginx servers and return " - + "to default configuration."); + console.log(EOL + "This action will destroy all nginx servers and return " + + "to default configuration." + EOL); if (readlineSync.keyInYN("Are you sure you want to do this?")) { killALL(); } @@ -15,4 +18,4 @@ function killAllConfirm() { } } -module.exports = killAllConfirm; \ No newline at end of file +module.exports = killAllConfirm; diff --git a/package-lock.json b/package-lock.json index fd51ec5..4ce07c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "up-serve", - "version": "0.1.9", + "version": "0.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/utils/nginxConf.js b/utils/nginxConf.js index bf73bcd..0996371 100644 --- a/utils/nginxConf.js +++ b/utils/nginxConf.js @@ -4,6 +4,8 @@ // concatenates them with ".conf" and returns it. function conf(path, domain, outPort) { + domain = domain || ""; + outPort = outPort || ""; return (path + domain + "." + outPort + ".conf"); }