chore: update @dcloudio/types version

This commit is contained in:
zhenyuWang 2022-06-17 19:49:06 +08:00
parent 8bbf5c3f6a
commit c533f65165
5 changed files with 25 additions and 6 deletions

View File

@ -46,7 +46,7 @@ module.exports = (api, options, rootOptions) => {
devDependencies: { devDependencies: {
"@babel/runtime": "~7.17.9",// 临时指定版本7.13.x 会报错 "@babel/runtime": "~7.17.9",// 临时指定版本7.13.x 会报错
'postcss-comment': '^2.0.0', 'postcss-comment': '^2.0.0',
'@dcloudio/types': '^2.6.7', '@dcloudio/types': '^3.0.4',
'miniprogram-api-typings': '*', 'miniprogram-api-typings': '*',
'mini-types': '*' 'mini-types': '*'
}, },
@ -94,6 +94,17 @@ module.exports = (api, options, rootOptions) => {
} else if (template === 'default-ts') { } else if (template === 'default-ts') {
await generate(path.resolve(__dirname, './template/common-ts'), files) await generate(path.resolve(__dirname, './template/common-ts'), files)
await generate(path.resolve(__dirname, './template/default-ts'), files, base, rootOptions) await generate(path.resolve(__dirname, './template/default-ts'), files, base, rootOptions)
// default-ts 模板删除 jsconfig.json
process.nextTick(() => {
const folderPath = path.resolve(process.cwd(),rootOptions.projectName)
const jsconfigPath = path.resolve(folderPath,'./jsconfig.json')
const tsconfigPath = path.resolve(folderPath,'./tsconfig.json')
if(fs.existsSync(jsconfigPath) && fs.existsSync(tsconfigPath)){
fs.unlinkSync(jsconfigPath)
}
})
} else { } else {
const ora = require('ora') const ora = require('ora')
const home = require('user-home') const home = require('user-home')

11
template/common/sfc.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
import Vue from 'vue'
declare module "vue/types/options" {
type Hooks = App.AppInstance & Page.PageInstance;
interface ComponentOptions<V extends Vue> extends Hooks {
/**
*
*/
mpType?: string;
}
}

View File

@ -9,6 +9,7 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
export default Vue.extend({ export default Vue.extend({
data() { data() {
return { return {

View File

@ -1,4 +0,0 @@
declare module "*.vue" {
import Vue from 'vue'
export default Vue
}