nuke-debug-util
Version:
qap调试库函数
65 lines (62 loc) • 1.35 kB
JavaScript
/*
* 模拟器检测及配置
* feature:
* 1、ios&&android模拟器应用安装指引
* 2、千牛&&手淘应用安装 [mds]
* 3、启动应用或到调试页面
* 4、mds?
*/
;
const semver = require('semver');
const which = require('which');
const spawn = require('cross-spawn');
const fs = require('fs');
const path = require('path');
/**
* 检测weex-toolkit
* @method function
* @return promise
*/
module.exports.checkWeexToolkit = function() {
return new Promise((resolve, reject) => {
which('weex', function(err, resolvePath) {
if (err) resolve(false);
resolve(true);
});
});
};
/**
* 检测是否已经安装了mds
* @method function
* @return {[type]} [description]
*/
module.exports.mds = function() {
var mds = spawn.sync('which', ['mds']);
if (mds.status == 1) return false;
else {
return true;
}
};
/*
* 判断模拟器是否安装,直接mds调试
*/
module.exports.checkIosTB = function() {
return false;
};
/*
* 判断千牛模拟器是否存在
*/
module.exports.checkIosQN = function() {
return false;
};
/**
* 是否是qap应用
* rootPath:项目根目录路径
*/
module.exports.checkQAP = function(rootPath) {
var qap = false;
if (fs.existsSync(path.resolve(rootPath, 'qap.json'))) {
qap = true;
}
return qap;
};