move to files
This commit is contained in:
parent
c9ff7cc977
commit
0dbdc924a6
@ -1,22 +1,10 @@
|
||||
const chalk = require('chalk');
|
||||
const clear = require('clear');
|
||||
const figlet = require('figlet');
|
||||
const pathExists = require('path-exists');
|
||||
const fs = require('fs')
|
||||
const path = require("path");
|
||||
|
||||
|
||||
module.exports = {
|
||||
writeIpAddress: (value) => {
|
||||
const data = {
|
||||
ipAddress: value
|
||||
}
|
||||
try {
|
||||
fs.writeFileSync('./data/MiWatch.json', JSON.stringify(data))
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
},
|
||||
header: (page) => {
|
||||
clear();
|
||||
console.log(
|
||||
|
12
lib/files.js
12
lib/files.js
@ -8,5 +8,15 @@ module.exports = {
|
||||
|
||||
directoryExists: (filePath) => {
|
||||
return fs.existsSync(filePath);
|
||||
}
|
||||
},
|
||||
writeIpAddress: (value) => {
|
||||
const data = {
|
||||
ipAddress: value
|
||||
}
|
||||
try {
|
||||
fs.writeFileSync('./data/MiWatch.json', JSON.stringify(data))
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
},
|
||||
};
|
@ -2,6 +2,7 @@ const chalk = require('chalk');
|
||||
const common = require('../lib/common');
|
||||
const inquirer = require('../lib/inquirer');
|
||||
const shellExec = require('shell-exec')
|
||||
const files = require('../lib/files')
|
||||
|
||||
|
||||
module.exports = {
|
||||
@ -24,7 +25,7 @@ module.exports = {
|
||||
module.exports.connectWifi()
|
||||
} else {
|
||||
console.log(chalk.green('MiWatch Connected'))
|
||||
common.writeIpAddress(miWatchIpaddress)
|
||||
files.writeIpAddress(miWatchIpaddress)
|
||||
await common.pause(3000)
|
||||
module.exports.mainMenu()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user