Skip to content

Commit 331da1d

Browse files
committedOct 30, 2019
feat(alita): 移除 areslabs库的无效警告
1 parent 3582da9 commit 331da1d

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed
 

‎src/util/geneWXPackageJSON.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ export default function geneWXPackageJSON(wxName, dm) {
5454
newDep[name] = version
5555
}
5656
} else {
57-
console.log(`${depKey} 未指定微信小程序版本,请确认此包在小程序环境运行正常!`.warn)
57+
58+
if (!depKey.startsWith('@areslabs')) {
59+
console.log(`${depKey} 未指定微信小程序版本,请确认此包在小程序环境运行正常!`.warn)
60+
}
61+
5862
newDep[depKey] = pack.dependencies[depKey]
5963
}
6064
})

‎src/util/isReactCompFile.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Copyright (c) Areslabs.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
*/
8+
9+
import fse from 'fs-extra'
10+
import {getFileInfo, parseCode} from "./uast";
11+
12+
//TODO 读文件的开销??
13+
export default function isReactCompFile(filepath) {
14+
if (filepath.endsWith('.js') || filepath.endsWith('.jsx')) {
15+
const code = fse.readFileSync(filepath).toString()
16+
const ast = parseCode(code)
17+
18+
const {isRF} = getFileInfo(ast)
19+
20+
return isRF
21+
22+
23+
}
24+
25+
return false
26+
27+
}

0 commit comments

Comments
 (0)