Skip to content

Commit

Permalink
move to vite
Browse files Browse the repository at this point in the history
  • Loading branch information
tamland committed Feb 19, 2025
1 parent b58626c commit e5afdb5
Show file tree
Hide file tree
Showing 21 changed files with 629 additions and 4,782 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module.exports = {
'space-before-function-paren': ['error', 'never'],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
},
overrides: [
{
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:

- name: Build
run: |
export VUE_APP_BUILD=$VERSION
export VUE_APP_BUILD_DATE=$(date --iso-8601)
export VITE_BUILD=$VERSION
export VITE_BUILD_DATE=$(date --iso-8601)
yarn build
- name: Upload artifact
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:

- name: Build
run: |
export VUE_APP_BUILD=$VERSION
export VUE_APP_BUILD_DATE=$(date --iso-8601)
export VITE_BUILD=$VERSION
export VITE_BUILD_DATE=$(date --iso-8601)
yarn build
- name: Build docker image
Expand Down
5 changes: 0 additions & 5 deletions babel.config.js

This file was deleted.

20 changes: 20 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!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, shrink-to-fit=no">
<meta name="theme-color" content="#000" />
<link rel="icon" href="/icon.svg">
<link rel=manifest href="/manifest.webmanifest">
<script src="/env.js"></script>
<title>Airsonic (refix)</title>
</head>
<body>
<noscript>
<strong>We're sorry but this application doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<script type="module" src="src/main.ts"></script>
</body>
</html>
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"version": "0.0.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"@iconify-icons/bi": "^1.2.2",
Expand All @@ -25,21 +25,23 @@
"@types/lodash-es": "^4.17.6",
"@typescript-eslint/eslint-plugin": "^5.18.0",
"@typescript-eslint/parser": "^5.18.0",
"@vue/cli-plugin-babel": "^5.0.4",
"@vue/cli-plugin-eslint": "^5.0.4",
"@vue/cli-plugin-typescript": "^5.0.4",
"@vue/cli-service": "^5.0.4",
"@vitejs/plugin-vue2": "^2.3.3",
"@vue/eslint-config-standard": "^8.0.1",
"@vue/eslint-config-typescript": "^11.0.2",
"autoprefixer": "^10.4.20",
"eslint": "^8.13.0",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-standard": "^5.0.0",
"eslint-plugin-vue": "^9.5.1",
"rollup-plugin-bundle-analyzer": "^1.6.6",
"sass": "^1.34.0",
"sass-loader": "^13.0.2",
"typescript": "^5.0.4"
"typescript": "^5.0.4",
"vite": "^6.1.0",
"vite-plugin-checker": "^0.8.0",
"vue-tsc": "^2.2.2"
},
"postcss": {
"plugins": {
Expand Down
25 changes: 0 additions & 25 deletions public/index.html

This file was deleted.

4 changes: 2 additions & 2 deletions src/app/About.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
}
},
computed: {
build: () => process.env.VUE_APP_BUILD,
buildDate: () => process.env.VUE_APP_BUILD_DATE,
build: () => import.meta.env.VITE_BUILD,
buildDate: () => import.meta.env.VITE_BUILD_DATE,
url: () => 'https://github.com/tamland/airsonic-refix'
},
})
Expand Down
4 changes: 0 additions & 4 deletions src/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
declare module '*.vue' {
import Vue from 'vue'
export default Vue
}
declare module '*.svg';
declare module 'md5-es';
declare module 'vue-slider-component';
Expand Down
2 changes: 1 addition & 1 deletion src/player/ProgressBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
})
</script>
<style lang="scss" scoped>
@import '~vue-slider-component/theme/material.css';
@use 'vue-slider-component/theme/material.css';
.vue-slider {
height: 4px !important;
Expand Down
2 changes: 1 addition & 1 deletion src/shared/api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AuthService } from '@/auth/service'
import { map, max, orderBy, sumBy, uniq, uniqBy } from 'lodash-es'
import { map, max, orderBy, sumBy, uniqBy } from 'lodash-es'
import { toQueryString } from '@/shared/utils'

export type AlbumSort =
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/IconReplayGainAlbum.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
width="1em" height="1em" fill="currentColor"
viewBox="0 0 24 24"
class="icon bi">
<text x="0" y="50%" dominant-baseline="central" font-family="Arial, sans-serif" font-weight="bold" font-size="16" fill="currentColor">R</text>
<text x="0" y="50%" dominant-baseline="central" font-family="Arial, sans-serif" font-weight="bold" font-size="16" fill="currentColor">R</text>
<text x="52%" y="72%" dominant-baseline="central" font-family="Arial, sans-serif" font-weight="bold" font-size="13" fill="currentColor">A</text>
</svg>
</template>
2 changes: 1 addition & 1 deletion src/shared/components/IconReplayGainTrack.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
width="1em" height="1em" fill="currentColor"
viewBox="0 0 24 24"
class="icon bi">
<text x="0" y="50%" dominant-baseline="central" font-family="Arial, sans-serif" font-weight="bold" font-size="16" fill="currentColor">R</text>
<text x="0" y="50%" dominant-baseline="central" font-family="Arial, sans-serif" font-weight="bold" font-size="16" fill="currentColor">R</text>
<text x="52%" y="72%" dominant-baseline="central" font-family="Arial, sans-serif" font-weight="bold" font-size="13" fill="currentColor">T</text>
</svg>
</template>
2 changes: 1 addition & 1 deletion src/shared/components/Slider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
})
</script>
<style lang="scss" scoped>
@import '~vue-slider-component/theme/material.css';
@use 'vue-slider-component/theme/material.css';
.vue-slider {
cursor: pointer;
Expand Down
2 changes: 1 addition & 1 deletion src/shared/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function setupRouter(auth: AuthService) {
const router = new Router({
mode: 'history',
linkExactActiveClass: 'active',
base: process.env.BASE_URL,
base: import.meta.env.BASE_URL,
routes: [
{
path: '/',
Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import MD5 from 'md5-es'
import { Artist, Track } from '@/shared/api'
import { Track } from '@/shared/api'

export function randomString(): string {
let arr = new Uint8Array(16)
Expand Down
2 changes: 1 addition & 1 deletion src/style/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ a.active {
}

@import './nav-underlined';
@import '~bootstrap/scss/bootstrap';
@import 'bootstrap/scss/bootstrap';
13 changes: 6 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,10 @@
"forceConsistentCasingInFileNames": true,
"useDefineForClassFields": true,
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env"
],
"baseUrl": "./src",
"types": ["vite/client"],
"paths": {
"@/*": [
"src/*"
]
"@/*": ["./*"]
},
"lib": [
"esnext",
Expand All @@ -27,6 +23,9 @@
"scripthost"
]
},
"vueCompilerOptions": {
"skipTemplateCodegen": true
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
Expand Down
39 changes: 39 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue2'
import { fileURLToPath, URL } from 'node:url'
import autoprefixer from 'autoprefixer'
import checker from 'vite-plugin-checker'
import bundleAnalyzer from 'rollup-plugin-bundle-analyzer'

export default defineConfig({
plugins: [
vue(),
checker({
vueTsc: true,
eslint: {
lintCommand: 'eslint . --ext .vue,.ts,.js --ignore-path .gitignore',
},
}),
bundleAnalyzer({
analyzerMode: 'static',
reportFilename: 'report.html'
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
css: {
preprocessorOptions: {
scss: {
silenceDeprecations: ['mixed-decls', 'color-functions', 'global-builtin', 'import']
}
},
postcss: {
plugins: [
autoprefixer()
]
}
}
})
10 changes: 0 additions & 10 deletions vue.config.js

This file was deleted.

Loading

0 comments on commit e5afdb5

Please sign in to comment.