Skip to content

Commit

Permalink
[Build] Add VueJS frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
Schaka committed Nov 7, 2024
1 parent 3b981cc commit d489e3a
Show file tree
Hide file tree
Showing 29 changed files with 2,707 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ node_modules
.env.local
.env.*.local
pnpm-debug.log*
.frontend-gradle-plugin/
node
.vite

### MacOS crap ###
.DS_Store
Expand Down
31 changes: 31 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ plugins {
id("com.google.cloud.tools.jib") version "3.4.4"
id("nu.studer.jooq") version "9.0"
id("org.flywaydb.flyway") version "10.20.0"
id("org.siouan.frontend-jdk21") version "9.0.0"

kotlin("jvm") version "2.0.21"
kotlin("plugin.spring") version "2.0.21"
Expand Down Expand Up @@ -183,6 +184,36 @@ tasks.withType<KotlinCompile> {
}
}

frontend {
nodeDistributionProvided.set(false)
nodeVersion.set("22.11.0")
nodeInstallDirectory.set(project.layout.projectDirectory.dir("node"))
corepackVersion.set("latest")

installScript.set("install")
cleanScript.set("run clean")
assembleScript.set("run build")
//checkScript.set("run type-check")
//publishScript.set("run publish")

packageJsonDirectory.set(project.layout.projectDirectory.dir("src/main/frontend"))
cacheDirectory.set(project.layout.projectDirectory.dir(".frontend-gradle-plugin"))
}

tasks.register<Copy>("processFrontendResources") {
// Directory containing the artifacts produced by the frontend project
val frontendBuildDir = project.layout.projectDirectory.dir("src/main/frontend/dist")
val frontendResourcesDir = project.layout.buildDirectory.dir("resources/main/public")

dependsOn(":assembleFrontend")
from(frontendBuildDir)
into(frontendResourcesDir)
}

tasks.named<Task>("processResources") {
dependsOn("processFrontendResources")
}

configure<VersioningExtension> {
/**
* Add GitHub CI branch name environment variable
Expand Down
30 changes: 30 additions & 0 deletions src/main/frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

*.tsbuildinfo
1 change: 1 addition & 0 deletions src/main/frontend/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
13 changes: 13 additions & 0 deletions src/main/frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
31 changes: 31 additions & 0 deletions src/main/frontend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "frontend",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --build --force"
},
"dependencies": {
"pinia": "^2.2.6",
"vue": "^3.5.12",
"vue-router": "^4.4.5"
},
"devDependencies": {
"@tsconfig/node20": "^20.1.4",
"@types/node": "^20.17.6",
"@vitejs/plugin-vue": "^5.1.4",
"@vitejs/plugin-vue-jsx": "^4.0.1",
"@vue/tsconfig": "^0.5.1",
"npm-run-all2": "^7.0.1",
"typescript": "~5.6.3",
"vite": "^5.4.10",
"vite-plugin-vue-devtools": "^7.5.4",
"vue-tsc": "^2.1.10"
},
"packageManager": "[email protected]"
}
Loading

0 comments on commit d489e3a

Please sign in to comment.