Commit d560d0e2 by 刘旭阳

Merge branch '0.0.9' into 'master'

feat:优化 See merge request !10
parents 77152e9f a87c93a0
{
"name": "babel-plugin-ry-istanbul-web",
"version": "0.0.9",
"version": "0.1.0",
"author": "Thai Pangsakulyanont @dtinth",
"license": "BSD-3-Clause",
"description": "A babel plugin that adds istanbul instrumentation to ES6 code",
......
......@@ -118,8 +118,8 @@ export default declare(api => {
this.nycConfig = findConfig(this.opts)
const realPath = getRealpath(this.file.opts.filename)
const { instrmenttation = {} } = this.nycConfig // npm引入参数
let IS_PITCHING_PILE_DATA = true
let INCREMENT_DATA = true
let IS_PITCHING_PILE_DATA = false
let INCREMENT_DATA = 'false'
let BRANCH_DATA = 'origin/master'
let processData = {}
Object.keys(process.env).forEach(item => {
......@@ -137,13 +137,13 @@ export default declare(api => {
})
// 全局变量优先
if (Object.keys(instrmenttation).length) {
BRANCH_DATA = isValue(instrmenttation.BRANCH, false, BRANCH_DATA)
INCREMENT_DATA = isValue(instrmenttation.INCREMENT, false, INCREMENT_DATA)
IS_PITCHING_PILE_DATA = isValue(instrmenttation.IS_PITCHING_PILE, false, IS_PITCHING_PILE_DATA)
BRANCH_DATA = isValue(instrmenttation.BRANCH, false, 'origin/master')
INCREMENT_DATA = isValue(instrmenttation.INCREMENT, false, 'false')
IS_PITCHING_PILE_DATA = isValue(instrmenttation.IS_PITCHING_PILE, false, false)
} else if (Object.keys(processData).length) {
BRANCH_DATA = isValue(processData.BRANCH, false, BRANCH_DATA)
INCREMENT_DATA = isValue(processData.INCREMENT, false, INCREMENT_DATA)
IS_PITCHING_PILE_DATA = isValue(processData.IS_PITCHING_PILE, false, IS_PITCHING_PILE_DATA)
BRANCH_DATA = isValue(processData.BRANCH, false, 'origin/master')
INCREMENT_DATA = isValue(processData.INCREMENT, false, 'false')
IS_PITCHING_PILE_DATA = isValue(processData.IS_PITCHING_PILE, false, false)
}
// instrumenttation (branch: git diff 跟那个分支对比, increment 是否开启增量代码检测) 拿配置到底是全量代码还是增量代码
if (!IS_PITCHING_PILE_DATA || IS_PITCHING_PILE_DATA === 'false') {
......@@ -158,7 +158,7 @@ export default declare(api => {
// })
// 后面解开
if ((INCREMENT_DATA || INCREMENT_DATA === 'true') && BRANCH_DATA) {
const gitDiffCode = execSync(`git diff ${BRANCH_DATA}`)
const gitDiffCode = execSync(`git add . && git diff ${BRANCH_DATA}`)
const diffData = parseDiffData(gitDiffCode.toString())
diffScreen = diffData.find(item => {
return realPath.indexOf(item.to) > -1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment