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