为普通项目增加 uni、plus 相关接口提示

This commit is contained in:
qiang 2019-03-21 17:47:38 +08:00
parent 498cee1cc4
commit 33bebac0f9
2 changed files with 13 additions and 3 deletions

View File

@ -32,6 +32,16 @@ async function generate (dir, files, base = '', rootOptions = {}) {
} }
module.exports = (api, options, rootOptions) => { module.exports = (api, options, rootOptions) => {
if (options.template !== 'default-ts') {
api.extendPackage(pkg => {
return {
devDependencies: {
'@types/uni-app': '*',
'@types/html5plus': '*'
}
}
})
}
if (options.template === 'default-ts') { // 启用 typescript if (options.template === 'default-ts') { // 启用 typescript
api.extendPackage(pkg => { api.extendPackage(pkg => {
return { return {
@ -41,8 +51,7 @@ module.exports = (api, options, rootOptions) => {
}, },
devDependencies: { devDependencies: {
'@babel/plugin-syntax-typescript': '^7.2.0', '@babel/plugin-syntax-typescript': '^7.2.0',
'@types/uni-app': '*', '@dcloudio/types': '*',
'@types/html5plus': '*',
'@vue/cli-plugin-typescript': '^3.3.0', '@vue/cli-plugin-typescript': '^3.3.0',
'typescript': api.hasPlugin('eslint') ? '~3.1.1' : '^3.0.0' 'typescript': api.hasPlugin('eslint') ? '~3.1.1' : '^3.0.0'
} }

View File

@ -12,7 +12,8 @@
"sourceMap": true, "sourceMap": true,
"baseUrl": ".", "baseUrl": ".",
"types": [ "types": [
"webpack-env" "webpack-env",
"@dcloudio/types/uni-app"
], ],
"paths": { "paths": {
"@/*": [ "@/*": [