still not fixed
This commit is contained in:
parent
14050a1a04
commit
7464f9b4e9
18
lib/adb.js
Normal file
18
lib/adb.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
const gfin = require('get-files-in')
|
||||||
|
const shellExec = require('shell-exec')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
getListOfAPk: () => {
|
||||||
|
this.apkListToInstall = gfin('./data/apps', matchFiletypes = ["apk"], checkSubDirectories = false)
|
||||||
|
},
|
||||||
|
installApk: async () => {
|
||||||
|
await module.exports.getListOfAPk()
|
||||||
|
for (let element of this.apkListToInstall) {
|
||||||
|
await shellExec('adb install -r ' + element).then(function (result) {
|
||||||
|
console.log('Installing ' + element + ' - ' + result.stdout);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// console.log(chalk.green('Removal Complete'))
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
53
lib/files.js
53
lib/files.js
@ -1,6 +1,10 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const dl = require('download-file-with-progressbar');
|
// const dl = require('download-file-with-progressbar');
|
||||||
|
const {
|
||||||
|
DownloaderHelper
|
||||||
|
} = require('node-downloader-helper');
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
getCurrentDirectoryBase: () => {
|
getCurrentDirectoryBase: () => {
|
||||||
@ -28,19 +32,36 @@ module.exports = {
|
|||||||
console.log(err)
|
console.log(err)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
downloadFile: async (element) => {
|
downloadFile: (element) => {
|
||||||
option = {
|
// option = {
|
||||||
dir: './data/apps',
|
// dir: './data/apps',
|
||||||
onDone: (info)=>{
|
// onDone: (info) => {
|
||||||
console.log('Latest ' + element.name + ' Downloaded')
|
// console.log('Latest ' + element.name + ' Downloaded')
|
||||||
},
|
// },
|
||||||
onError: (err) => {
|
// onError: (err) => {
|
||||||
console.log('error', err);
|
// console.log('error', err);
|
||||||
},
|
// },
|
||||||
onProgress: (curr, total) => {
|
// onProgress: (curr, total) => {},
|
||||||
},
|
// }
|
||||||
}
|
// dl(element.url, option);
|
||||||
|
// }
|
||||||
|
// const options = {
|
||||||
|
// override: true,
|
||||||
|
// }
|
||||||
|
// const dl = new DownloaderHelper(element.url, './data/apps', options);
|
||||||
|
|
||||||
var dd = dl(element.url, option);
|
// dl.on('end', () => console.log('Download Completed'))
|
||||||
}
|
|
||||||
};
|
// dl.start();
|
||||||
|
var promise = new Promise(function (resolve, reject) {
|
||||||
|
setTimeout(function () {
|
||||||
|
resolve('hello world');
|
||||||
|
}, 2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
promise.then(function (data) {
|
||||||
|
console.log(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
10
package-lock.json
generated
10
package-lock.json
generated
@ -547,6 +547,11 @@
|
|||||||
"universalify": "^0.1.0"
|
"universalify": "^0.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"get-files-in": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-files-in/-/get-files-in-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-bufY50S4KnOmEVG9yeioI1QTBAIb1B3c6Ks+1ysu0zScfrld8dmhdGB7Fw/rQSTE6ryVrra+AkznvgiR3H4zRA=="
|
||||||
|
},
|
||||||
"getpass": {
|
"getpass": {
|
||||||
"version": "0.1.7",
|
"version": "0.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
|
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
|
||||||
@ -857,6 +862,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz",
|
||||||
"integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw="
|
"integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw="
|
||||||
},
|
},
|
||||||
|
"node-downloader-helper": {
|
||||||
|
"version": "1.0.12",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-downloader-helper/-/node-downloader-helper-1.0.12.tgz",
|
||||||
|
"integrity": "sha512-2t3h3g3xK5kxhRbwD+0WgKotHyoVEQlE+V93rn97tqzUtbw8cFpHn0uhsc2LeKkDlsQI1iy5XZoS3vACzBdW8A=="
|
||||||
|
},
|
||||||
"oauth-sign": {
|
"oauth-sign": {
|
||||||
"version": "0.9.0",
|
"version": "0.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
|
||||||
|
@ -20,9 +20,11 @@
|
|||||||
"figlet": "^1.3.0",
|
"figlet": "^1.3.0",
|
||||||
"foreachasync": "^5.1.3",
|
"foreachasync": "^5.1.3",
|
||||||
"fs": "0.0.1-security",
|
"fs": "0.0.1-security",
|
||||||
|
"get-files-in": "^1.2.0",
|
||||||
"inquirer": "^7.1.0",
|
"inquirer": "^7.1.0",
|
||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.15",
|
||||||
"minimist": "^1.2.5",
|
"minimist": "^1.2.5",
|
||||||
|
"node-downloader-helper": "^1.0.12",
|
||||||
"path": "^0.12.7",
|
"path": "^0.12.7",
|
||||||
"path-exists": "^4.0.0",
|
"path-exists": "^4.0.0",
|
||||||
"pkg": "^4.4.7",
|
"pkg": "^4.4.7",
|
||||||
|
@ -4,19 +4,23 @@ const inquirer = require('../lib/inquirer');
|
|||||||
const shellExec = require('shell-exec')
|
const shellExec = require('shell-exec')
|
||||||
const files = require('../lib/files')
|
const files = require('../lib/files')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
|
const adb = require('../lib/adb')
|
||||||
module.exports = {
|
module.exports = {
|
||||||
compatibleApps: async () => {
|
compatibleApps: async () => {
|
||||||
common.header('Install Compatible Apps')
|
common.header('Install Compatible Apps')
|
||||||
const compatibleApps = JSON.parse(fs.readFileSync('./data/compatibleApps.json', 'utf8'));
|
const compatibleApps = JSON.parse(fs.readFileSync('./data/compatibleApps.json', 'utf8'));
|
||||||
const value = await inquirer.compatibleApps();
|
const value = await inquirer.compatibleApps();
|
||||||
|
|
||||||
for (let element of value.removeAppsList) {
|
for (let element of value.removeAppsList) {
|
||||||
for (let element2 of compatibleApps) {
|
for (let element2 of compatibleApps) {
|
||||||
if (element === element2.name) {
|
if (element === element2.name) {
|
||||||
await files.downloadFile(element2)
|
files.downloadFile(element2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// console.log(element)
|
||||||
}
|
}
|
||||||
|
// await adb.installApk()
|
||||||
|
console.log('finished')
|
||||||
},
|
},
|
||||||
removeApps: async () => {
|
removeApps: async () => {
|
||||||
common.header('Remove Apps')
|
common.header('Remove Apps')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user