UNPKG

423 BJavaScriptView Raw
1const fs = require('fs-extra')
2const path = require('path')
3
4module.exports = (program, infoType) => {
5 const pkgPath = path.join(program.cwd, './package.json')
6 const jsonContent = fs.readJsonSync(pkgPath)
7 switch (infoType) {
8 case 'type':
9 return jsonContent.type
10 case 'name':
11 return jsonContent.name
12 case 'displayType':
13 return jsonContent.displayType
14 default:
15 return null
16 }
17}