Skip to content

Commit

Permalink
feat: update vue demo app
Browse files Browse the repository at this point in the history
update dependencies and convert to script setup Composition API
  • Loading branch information
MichaHuhn committed Feb 24, 2025
1 parent 63ea4cc commit 7d3d7a1
Show file tree
Hide file tree
Showing 19 changed files with 252 additions and 250 deletions.
9 changes: 9 additions & 0 deletions apps/vue-vite-app/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue}]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

end_of_line = lf
max_line_length = 120
15 changes: 0 additions & 15 deletions apps/vue-vite-app/.eslintrc.cjs

This file was deleted.

1 change: 1 addition & 0 deletions apps/vue-vite-app/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
2 changes: 2 additions & 0 deletions apps/vue-vite-app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ coverage
*.njsproj
*.sln
*.sw?

*.tsbuildinfo
7 changes: 3 additions & 4 deletions apps/vue-vite-app/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"printWidth": 100,
"printWidth": 120,
"trailingComma": "none"
}
}
7 changes: 6 additions & 1 deletion apps/vue-vite-app/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
"recommendations": [
"Vue.volar",
"dbaeumer.vscode-eslint",
"EditorConfig.EditorConfig",
"esbenp.prettier-vscode"
]
}
13 changes: 3 additions & 10 deletions apps/vue-vite-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,15 @@ This template should help get you started developing with Vue 3 in Vite.

## Recommended IDE Setup

[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).

## Type Support for `.vue` Imports in TS

TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.

If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:

1. Disable the built-in TypeScript Extension
1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.

## Customize configuration

See [Vite Configuration Reference](https://vitejs.dev/config/).
See [Vite Configuration Reference](https://vite.dev/config/).

## Project Setup

Expand Down
24 changes: 24 additions & 0 deletions apps/vue-vite-app/eslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import pluginVue from 'eslint-plugin-vue'
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'

// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
// import { configureVueProject } from '@vue/eslint-config-typescript'
// configureVueProject({ scriptLangs: ['ts', 'tsx'] })
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup

export default defineConfigWithVueTs(
{
name: 'app/files-to-lint',
files: ['**/*.{ts,mts,tsx,vue}'],
},

{
name: 'app/files-to-ignore',
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'],
},

pluginVue.configs['flat/essential'],
vueTsConfigs.recommended,
skipFormatting,
)
43 changes: 22 additions & 21 deletions apps/vue-vite-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,36 @@
"name": "vue-vite-app",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "run-p type-check build-only",
"build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"type-check": "vue-tsc --build",
"lint": "eslint . --fix",
"format": "prettier --write src/"
},
"dependencies": {
"@ffmpeg/ffmpeg": "*",
"@ffmpeg/util": "*",
"vue": "^3.4.18"
"@ffmpeg/ffmpeg": "^0.12.15",
"@ffmpeg/util": "^0.12.2",
"vue": "^3.5.13"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.7.2",
"@tsconfig/node18": "^18.2.2",
"@types/node": "^20.11.17",
"@vitejs/plugin-vue": "^5.0.4",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^12.0.0",
"@vue/tsconfig": "^0.5.1",
"eslint": "^8.56.0",
"eslint-plugin-vue": "^9.21.1",
"npm-run-all": "^4.1.5",
"prettier": "^3.2.5",
"typescript": "~5.3.3",
"vite": "^4.5.2",
"vue-tsc": "^1.8.27"
"@tsconfig/node22": "^22.0.0",
"@types/node": "^22.13.4",
"@vitejs/plugin-vue": "^5.2.1",
"@vue/eslint-config-prettier": "^10.2.0",
"@vue/eslint-config-typescript": "^14.4.0",
"@vue/tsconfig": "^0.7.0",
"eslint": "^9.20.1",
"eslint-plugin-vue": "^9.32.0",
"jiti": "^2.4.2",
"npm-run-all2": "^7.0.2",
"prettier": "^3.5.1",
"typescript": "~5.7.3",
"vite": "^6.1.0",
"vite-plugin-vue-devtools": "^7.7.2",
"vue-tsc": "^2.2.2"
}
}
24 changes: 22 additions & 2 deletions apps/vue-vite-app/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
<script setup lang="ts">
import FFmpegDemo from './components/FFmpegDemo.vue'
import FFmpegDemo from '@/components/FFmpegDemo.vue';
</script>

<template>
<main>
<FFmpegDemo />
<Suspense>
<FFmpegDemo />

<template #fallback>
<div class="loading-message">Loading FFmpeg…</div>
</template>
</Suspense>
</main>
</template>

<style scoped>
main {
position: absolute;
inset: 0;
display: grid;
align-content: center;
}
.loading-message {
display: flex;
justify-content: center;
}
</style>
86 changes: 0 additions & 86 deletions apps/vue-vite-app/src/assets/base.css

This file was deleted.

35 changes: 0 additions & 35 deletions apps/vue-vite-app/src/assets/main.css

This file was deleted.

Loading

0 comments on commit 7d3d7a1

Please sign in to comment.