UNPKG

483 BJavaScriptView Raw
1const pkgJSON = require('./pkg-json');
2
3/**
4 * 获取物料仓库的类型(react、vue、angular、etc...)
5 * @param {String} workdir
6 * @returns {String} type
7 */
8function getType(workdir) {
9 const json = pkgJSON.getPkgJSON(workdir);
10
11 // 兼容逻辑
12 if ('blockConfig' in json) {
13 return 'block';
14 }
15
16 if ('scaffoldConfig' in json) {
17 return 'scaffold';
18 }
19
20 if ('componentConfig' in json) {
21 return 'component';
22 }
23
24 return null;
25}
26
27module.exports = getType;