Commit d560d0e2 by 刘旭阳

Merge branch '0.0.9' into 'master'

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