-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support vue3 template setup & vue-ts template
- Loading branch information
jerrywu
committed
Dec 1, 2022
1 parent
2f722cf
commit 2f77e6e
Showing
7 changed files
with
358 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
/** | ||
* @hidden | ||
*/ | ||
export const VUE_TS_TEMPLATE = { | ||
files: { | ||
'/src/App.vue': { | ||
code: `<template> | ||
<div id="app"> | ||
<h1>Hello {{ msg }}</h1> | ||
<button @click="add">add</button> | ||
<p>count: {{ count }}</p> | ||
</div> | ||
</template> | ||
<script lang="ts"> | ||
import Vue from "vue"; | ||
export default Vue.extend({ | ||
name: "App", | ||
data() { | ||
return { | ||
msg: "", | ||
count: 1, | ||
}; | ||
}, | ||
methods: { | ||
add() { | ||
this.count += 1; | ||
}, | ||
}, | ||
mounted() { | ||
this.msg = "world"; | ||
}, | ||
}); | ||
</script>`, | ||
}, | ||
'/src/main.ts': { | ||
code: `import Vue from "vue"; | ||
import App from "./App.vue"; | ||
Vue.config.productionTip = false; | ||
new Vue({ | ||
render: h => h(App) | ||
}).$mount("#app"); | ||
`, | ||
}, | ||
'/public/index.html': { | ||
code: `<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width,initial-scale=1.0" /> | ||
<link rel="icon" href="<%= BASE_URL %>favicon.ico" /> | ||
<title>codesandbox</title> | ||
</head> | ||
<body> | ||
<noscript> | ||
<strong | ||
>We're sorry but codesandbox doesn't work properly without JavaScript | ||
enabled. Please enable it to continue.</strong | ||
> | ||
</noscript> | ||
<div id="app"></div> | ||
<!-- built files will be auto injected --> | ||
</body> | ||
</html> | ||
`, | ||
}, | ||
'/src/shims-vue.d.ts': `declare module '*.vue' { | ||
import Vue from 'vue' | ||
export default Vue | ||
}`, | ||
'/package.json': { | ||
code: JSON.stringify({ | ||
name: 'vue-ts', | ||
version: '0.1.0', | ||
private: true, | ||
main: '/src/main.ts', | ||
scripts: { | ||
serve: 'vue-cli-service serve', | ||
build: 'vue-cli-service build', | ||
}, | ||
dependencies: { | ||
'core-js': '^3.26.1', | ||
vue: '^2.7.14', | ||
}, | ||
devDependencies: { | ||
'@vue/cli-plugin-babel': '^5.0.8', | ||
'@vue/cli-plugin-typescript': '^5.0.8', | ||
'@vue/cli-service': '^5.0.8', | ||
typescript: '^4.9.3', | ||
'vue-template-compiler': '^2.7.14', | ||
}, | ||
}), | ||
}, | ||
'/tsconfig.json': { | ||
code: JSON.stringify({ | ||
compilerOptions: { | ||
target: 'esnext', | ||
module: 'esnext', | ||
strict: true, | ||
jsx: 'preserve', | ||
moduleResolution: 'node', | ||
skipLibCheck: true, | ||
esModuleInterop: true, | ||
allowSyntheticDefaultImports: true, | ||
forceConsistentCasingInFileNames: true, | ||
useDefineForClassFields: true, | ||
sourceMap: true, | ||
baseUrl: '.', | ||
types: [ | ||
'webpack-env', | ||
], | ||
paths: { | ||
'@/*': [ | ||
'src/*', | ||
], | ||
}, | ||
lib: [ | ||
'esnext', | ||
'dom', | ||
'dom.iterable', | ||
'scripthost', | ||
], | ||
}, | ||
include: [ | ||
'src/**/*.ts', | ||
'src/**/*.tsx', | ||
'src/**/*.vue', | ||
'tests/**/*.ts', | ||
'tests/**/*.tsx', | ||
], | ||
exclude: [ | ||
'node_modules', | ||
], | ||
}, null, 2), | ||
}, | ||
}, | ||
main: '/src/App.vue', | ||
environment: 'vue-cli', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.