Skip to content

Commit e5afdb5

Browse files
committed
move to vite
1 parent b58626c commit e5afdb5

21 files changed

+629
-4782
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module.exports = {
2929
'space-before-function-paren': ['error', 'never'],
3030
'@typescript-eslint/explicit-module-boundary-types': 'off',
3131
'@typescript-eslint/no-explicit-any': 'off',
32+
'@typescript-eslint/no-non-null-assertion': 'off',
3233
},
3334
overrides: [
3435
{

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121

2222
- name: Build
2323
run: |
24-
export VUE_APP_BUILD=$VERSION
25-
export VUE_APP_BUILD_DATE=$(date --iso-8601)
24+
export VITE_BUILD=$VERSION
25+
export VITE_BUILD_DATE=$(date --iso-8601)
2626
yarn build
2727
2828
- name: Upload artifact

.github/workflows/pr.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121

2222
- name: Build
2323
run: |
24-
export VUE_APP_BUILD=$VERSION
25-
export VUE_APP_BUILD_DATE=$(date --iso-8601)
24+
export VITE_BUILD=$VERSION
25+
export VITE_BUILD_DATE=$(date --iso-8601)
2626
yarn build
2727
2828
- name: Build docker image

babel.config.js

-5
This file was deleted.

index.html

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7+
<meta name="theme-color" content="#000" />
8+
<link rel="icon" href="/icon.svg">
9+
<link rel=manifest href="/manifest.webmanifest">
10+
<script src="/env.js"></script>
11+
<title>Airsonic (refix)</title>
12+
</head>
13+
<body>
14+
<noscript>
15+
<strong>We're sorry but this application doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
16+
</noscript>
17+
<div id="app"></div>
18+
<script type="module" src="src/main.ts"></script>
19+
</body>
20+
</html>

package.json

+10-8
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"version": "0.0.0",
44
"private": true,
55
"scripts": {
6-
"serve": "vue-cli-service serve",
7-
"build": "vue-cli-service build",
8-
"lint": "vue-cli-service lint"
6+
"dev": "vite",
7+
"build": "vite build",
8+
"preview": "vite preview"
99
},
1010
"dependencies": {
1111
"@iconify-icons/bi": "^1.2.2",
@@ -25,21 +25,23 @@
2525
"@types/lodash-es": "^4.17.6",
2626
"@typescript-eslint/eslint-plugin": "^5.18.0",
2727
"@typescript-eslint/parser": "^5.18.0",
28-
"@vue/cli-plugin-babel": "^5.0.4",
29-
"@vue/cli-plugin-eslint": "^5.0.4",
30-
"@vue/cli-plugin-typescript": "^5.0.4",
31-
"@vue/cli-service": "^5.0.4",
28+
"@vitejs/plugin-vue2": "^2.3.3",
3229
"@vue/eslint-config-standard": "^8.0.1",
3330
"@vue/eslint-config-typescript": "^11.0.2",
31+
"autoprefixer": "^10.4.20",
3432
"eslint": "^8.13.0",
3533
"eslint-plugin-import": "^2.24.2",
3634
"eslint-plugin-node": "^11.1.0",
3735
"eslint-plugin-promise": "^6.0.0",
3836
"eslint-plugin-standard": "^5.0.0",
3937
"eslint-plugin-vue": "^9.5.1",
38+
"rollup-plugin-bundle-analyzer": "^1.6.6",
4039
"sass": "^1.34.0",
4140
"sass-loader": "^13.0.2",
42-
"typescript": "^5.0.4"
41+
"typescript": "^5.0.4",
42+
"vite": "^6.1.0",
43+
"vite-plugin-checker": "^0.8.0",
44+
"vue-tsc": "^2.2.2"
4345
},
4446
"postcss": {
4547
"plugins": {

public/index.html

-25
This file was deleted.

src/app/About.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
}
5454
},
5555
computed: {
56-
build: () => process.env.VUE_APP_BUILD,
57-
buildDate: () => process.env.VUE_APP_BUILD_DATE,
56+
build: () => import.meta.env.VITE_BUILD,
57+
buildDate: () => import.meta.env.VITE_BUILD_DATE,
5858
url: () => 'https://github.com/tamland/airsonic-refix'
5959
},
6060
})

src/global.d.ts

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
declare module '*.vue' {
2-
import Vue from 'vue'
3-
export default Vue
4-
}
51
declare module '*.svg';
62
declare module 'md5-es';
73
declare module 'vue-slider-component';

src/player/ProgressBar.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
})
4646
</script>
4747
<style lang="scss" scoped>
48-
@import '~vue-slider-component/theme/material.css';
48+
@use 'vue-slider-component/theme/material.css';
4949
5050
.vue-slider {
5151
height: 4px !important;

src/shared/api.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AuthService } from '@/auth/service'
2-
import { map, max, orderBy, sumBy, uniq, uniqBy } from 'lodash-es'
2+
import { map, max, orderBy, sumBy, uniqBy } from 'lodash-es'
33
import { toQueryString } from '@/shared/utils'
44

55
export type AlbumSort =

src/shared/components/IconReplayGainAlbum.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
width="1em" height="1em" fill="currentColor"
44
viewBox="0 0 24 24"
55
class="icon bi">
6-
<text x="0" y="50%" dominant-baseline="central" font-family="Arial, sans-serif" font-weight="bold" font-size="16" fill="currentColor">R</text>
6+
<text x="0" y="50%" dominant-baseline="central" font-family="Arial, sans-serif" font-weight="bold" font-size="16" fill="currentColor">R</text>
77
<text x="52%" y="72%" dominant-baseline="central" font-family="Arial, sans-serif" font-weight="bold" font-size="13" fill="currentColor">A</text>
88
</svg>
99
</template>

src/shared/components/IconReplayGainTrack.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
width="1em" height="1em" fill="currentColor"
44
viewBox="0 0 24 24"
55
class="icon bi">
6-
<text x="0" y="50%" dominant-baseline="central" font-family="Arial, sans-serif" font-weight="bold" font-size="16" fill="currentColor">R</text>
6+
<text x="0" y="50%" dominant-baseline="central" font-family="Arial, sans-serif" font-weight="bold" font-size="16" fill="currentColor">R</text>
77
<text x="52%" y="72%" dominant-baseline="central" font-family="Arial, sans-serif" font-weight="bold" font-size="13" fill="currentColor">T</text>
88
</svg>
99
</template>

src/shared/components/Slider.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
})
3838
</script>
3939
<style lang="scss" scoped>
40-
@import '~vue-slider-component/theme/material.css';
40+
@use 'vue-slider-component/theme/material.css';
4141
4242
.vue-slider {
4343
cursor: pointer;

src/shared/router.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function setupRouter(auth: AuthService) {
2323
const router = new Router({
2424
mode: 'history',
2525
linkExactActiveClass: 'active',
26-
base: process.env.BASE_URL,
26+
base: import.meta.env.BASE_URL,
2727
routes: [
2828
{
2929
path: '/',

src/shared/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import MD5 from 'md5-es'
2-
import { Artist, Track } from '@/shared/api'
2+
import { Track } from '@/shared/api'
33

44
export function randomString(): string {
55
let arr = new Uint8Array(16)

src/style/main.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,4 @@ a.active {
117117
}
118118

119119
@import './nav-underlined';
120-
@import '~bootstrap/scss/bootstrap';
120+
@import 'bootstrap/scss/bootstrap';

tsconfig.json

+6-7
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,10 @@
1111
"forceConsistentCasingInFileNames": true,
1212
"useDefineForClassFields": true,
1313
"sourceMap": true,
14-
"baseUrl": ".",
15-
"types": [
16-
"webpack-env"
17-
],
14+
"baseUrl": "./src",
15+
"types": ["vite/client"],
1816
"paths": {
19-
"@/*": [
20-
"src/*"
21-
]
17+
"@/*": ["./*"]
2218
},
2319
"lib": [
2420
"esnext",
@@ -27,6 +23,9 @@
2723
"scripthost"
2824
]
2925
},
26+
"vueCompilerOptions": {
27+
"skipTemplateCodegen": true
28+
},
3029
"include": [
3130
"src/**/*.ts",
3231
"src/**/*.tsx",

vite.config.js

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { defineConfig } from 'vite'
2+
import vue from '@vitejs/plugin-vue2'
3+
import { fileURLToPath, URL } from 'node:url'
4+
import autoprefixer from 'autoprefixer'
5+
import checker from 'vite-plugin-checker'
6+
import bundleAnalyzer from 'rollup-plugin-bundle-analyzer'
7+
8+
export default defineConfig({
9+
plugins: [
10+
vue(),
11+
checker({
12+
vueTsc: true,
13+
eslint: {
14+
lintCommand: 'eslint . --ext .vue,.ts,.js --ignore-path .gitignore',
15+
},
16+
}),
17+
bundleAnalyzer({
18+
analyzerMode: 'static',
19+
reportFilename: 'report.html'
20+
}),
21+
],
22+
resolve: {
23+
alias: {
24+
'@': fileURLToPath(new URL('./src', import.meta.url))
25+
}
26+
},
27+
css: {
28+
preprocessorOptions: {
29+
scss: {
30+
silenceDeprecations: ['mixed-decls', 'color-functions', 'global-builtin', 'import']
31+
}
32+
},
33+
postcss: {
34+
plugins: [
35+
autoprefixer()
36+
]
37+
}
38+
}
39+
})

vue.config.js

-10
This file was deleted.

0 commit comments

Comments
 (0)