chore: update @dcloudio/types version

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

View File

@ -46,7 +46,7 @@ module.exports = (api, options, rootOptions) => {
devDependencies: {
"@babel/runtime": "~7.17.9",// 临时指定版本7.13.x 会报错
'postcss-comment': '^2.0.0',
'@dcloudio/types': '^2.6.7',
'@dcloudio/types': '^3.0.4',
'miniprogram-api-typings': '*',
'mini-types': '*'
},
@ -94,6 +94,17 @@ module.exports = (api, options, rootOptions) => {
} else if (template === 'default-ts') {
await generate(path.resolve(__dirname, './template/common-ts'), files)
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 {
const ora = require('ora')
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

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

View File

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