Skip to content

Commit

Permalink
Merge pull request #10440 from murdos/chore/simplify-vite-vitest-config
Browse files Browse the repository at this point in the history
chore: use vite-tsconfig-paths to simplify generated vite and vitest configuration
  • Loading branch information
murdos authored Jul 29, 2024
2 parents 361a1e8 + 02de949 commit bff542e
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) {
.addDevDependency(packageName("typescript"), COMMON)
.addDevDependency(packageName("ts-node"), REACT)
.addDevDependency(packageName("vite"), COMMON)
.addDevDependency(packageName("vite-tsconfig-paths"), REACT)
.addDevDependency(packageName("vite-tsconfig-paths"), COMMON)
.addDevDependency(packageName("vitest"), COMMON)
.addDevDependency(packageName("vitest-sonar-reporter"), COMMON)
.addDependency(packageName("react"), REACT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public JHipsterModule buildVueModule(JHipsterModuleProperties properties) {
.addDevDependency(packageName("jsdom"), COMMON)
.addDevDependency(packageName("typescript"), COMMON)
.addDevDependency(packageName("vite"), COMMON)
.addDevDependency(packageName("vite-tsconfig-paths"), COMMON)
.addDevDependency(packageName("vitest"), COMMON)
.addDevDependency(packageName("vitest-sonar-reporter"), COMMON)
.addDevDependency(packageName("vue-tsc"), VUE)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
import react from '@vitejs/plugin-react';
import path from 'path';

export default defineConfig({
plugins: [react()],
plugins: [react(), tsconfigPaths()],
build: {
outDir: '../../../{{projectBuildDirectory}}/classes/static',
},
resolve: {
alias: [
{ find: '@', replacement: path.resolve(__dirname, 'src/main/webapp/app') },
{ find: '@assets', replacement: path.resolve('src/main/webapp/assets') },
],
},
root: 'src/main/webapp',
server: {
port: 9000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
import react from '@vitejs/plugin-react';
import path from 'path';

export default defineConfig({
plugins: [react(), tsconfigPaths()],
resolve: {
alias: [{ find: '@', replacement: path.resolve(__dirname, 'src/main/webapp/app') }],
},
test: {
reporters: ['verbose', 'vitest-sonar-reporter'],
outputFile: {
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/generator/client/vue/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"strict": true,
"jsx": "preserve",
"skipLibCheck": true,
"allowJs": true,
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
Expand All @@ -22,7 +23,8 @@
"src/main/webapp/**/*.d.ts",
"src/main/webapp/**/*.tsx",
"src/main/webapp/**/*.vue",
"src/test/javascript/spec/**/*.ts"
"src/test/javascript/spec/**/*.ts",
"src/test/javascript/spec/**/*.vue"
],
"exclude": ["./node_modules"]
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
import vue from '@vitejs/plugin-vue';
import path from 'path';

// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: {
'@': path.resolve(__dirname, './src/main/webapp/app'),
},
},
plugins: [vue()],
plugins: [vue(), tsconfigPaths()],
build: {
outDir: '../../../{{projectBuildDirectory}}/classes/static',
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/// <reference types="vitest" />

import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
import vue from '@vitejs/plugin-vue';
import path from 'path';

export default defineConfig({
plugins: [vue()],
resolve: {
alias: [{ find: '@', replacement: path.resolve(__dirname, 'src/main/webapp/app') }],
},
plugins: [vue(), tsconfigPaths()],
test: {
reporters: ['verbose', 'vitest-sonar-reporter'],
outputFile: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"ts-jest": "29.2.3",
"typescript": "5.5.4",
"vite": "5.3.5",
"vite-tsconfig-paths": "4.3.2",
"vitest": "2.0.4",
"vitest-sonar-reporter": "2.0.0"
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/generator/dependencies/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"eslint-plugin-react": "7.35.0",
"react-scripts": "5.0.1",
"sass": "1.77.8",
"ts-node": "10.9.2",
"vite-tsconfig-paths": "4.3.2"
"ts-node": "10.9.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ void shouldCreateVueModule() {
.containing(nodeDependency("jsdom"))
.containing(nodeDependency("typescript"))
.containing(nodeDependency("vite"))
.containing(nodeDependency("vite-tsconfig-paths"))
.containing(nodeDependency("vitest"))
.containing(nodeDependency("vitest-sonar-reporter"))
.containing(nodeDependency("vue-tsc"))
Expand Down

0 comments on commit bff542e

Please sign in to comment.