added node-ip and updated CLI

This commit is contained in:
bill bittner 2018-08-15 13:53:09 -07:00
parent c037c934b0
commit 61e258e3fb
3 changed files with 12 additions and 1 deletions

View file

@ -2,6 +2,7 @@ const inquirer = require('inquirer');
const fs = require('fs'); const fs = require('fs');
const Path = require('path'); const Path = require('path');
const axios = require('axios'); const axios = require('axios');
const ip = require('ip');
const mysqlQuestions = require(Path.resolve(__dirname, 'questions/mysqlQuestions.js')); const mysqlQuestions = require(Path.resolve(__dirname, 'questions/mysqlQuestions.js'));
const siteQuestions = require(Path.resolve(__dirname, 'questions/siteQuestions.js')); const siteQuestions = require(Path.resolve(__dirname, 'questions/siteQuestions.js'));
@ -158,7 +159,11 @@ inquirer
siteConfig['details']['port'] = results.port; siteConfig['details']['port'] = results.port;
siteConfig['details']['title'] = results.title; siteConfig['details']['title'] = results.title;
siteConfig['details']['host'] = results.host; siteConfig['details']['host'] = results.host;
siteConfig['details']['ipAddress'] = ip.address();
siteConfig['publishing']['uploadDirectory'] = results.uploadDirectory; siteConfig['publishing']['uploadDirectory'] = results.uploadDirectory;
})
.then(() => {
// create the siteConfig.json file
const fileLocation = Path.resolve(__dirname, '../config/siteConfig.json'); const fileLocation = Path.resolve(__dirname, '../config/siteConfig.json');
const fileContents = JSON.stringify(siteConfig, null, 2); const fileContents = JSON.stringify(siteConfig, null, 2);
fs.writeFileSync(fileLocation, fileContents, 'utf-8'); fs.writeFileSync(fileLocation, fileContents, 'utf-8');
@ -166,7 +171,7 @@ inquirer
}) })
.then(() => { .then(() => {
console.log('\nYou\'re all done!'); console.log('\nYou\'re all done!');
console.log('Next step: run "npm run build" to build your server, then "npm run start" to start your server!'); console.log('Next step: run "npm run start" to build and start your server!');
console.log('If you want to change any settings, you can edit the files in the "/config" folder.'); console.log('If you want to change any settings, you can edit the files in the "/config" folder.');
process.exit(0); process.exit(0);
}) })

5
package-lock.json generated
View file

@ -6677,6 +6677,11 @@
"resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz",
"integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY="
}, },
"ip": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz",
"integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo="
},
"ip-regex": { "ip-regex": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz",

View file

@ -54,6 +54,7 @@
"helmet": "^3.13.0", "helmet": "^3.13.0",
"image-size": "^0.6.3", "image-size": "^0.6.3",
"inquirer": "^5.2.0", "inquirer": "^5.2.0",
"ip": "^1.1.5",
"make-dir": "^1.3.0", "make-dir": "^1.3.0",
"module-alias": "^2.1.0", "module-alias": "^2.1.0",
"mysql2": "^1.6.1", "mysql2": "^1.6.1",