Added build_system.d and changed to --mode=development.
This commit is contained in:
parent
74cf5736f0
commit
e5165330d9
|
@ -34,3 +34,6 @@ build/
|
||||||
|
|
||||||
*.mv.db
|
*.mv.db
|
||||||
*.trace.db
|
*.trace.db
|
||||||
|
|
||||||
|
src/main/resources/app
|
||||||
|
/build_system
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
#!/usr/bin/env dub
|
||||||
|
/+ dub.sdl:
|
||||||
|
dependency "dsh" version="~>1.6.1"
|
||||||
|
+/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This script will build the Rail Signal Vue app, then bundle it into this
|
||||||
|
* Spring project's files under src/main/resources/app/, and will then build
|
||||||
|
* this project into a jar file.
|
||||||
|
*/
|
||||||
|
module build_system;
|
||||||
|
|
||||||
|
import dsh;
|
||||||
|
|
||||||
|
const DIST = "./src/main/resources/app";
|
||||||
|
|
||||||
|
void main(string[] args) {
|
||||||
|
print("Building RailSignalAPI");
|
||||||
|
chdir("railsignal-app");
|
||||||
|
print("Building app...");
|
||||||
|
runOrQuit("npm run build");
|
||||||
|
print("Copying dist to %s", DIST);
|
||||||
|
chdir("..");
|
||||||
|
removeIfExists(DIST);
|
||||||
|
mkdir(DIST);
|
||||||
|
copyDir("railsignal-app/dist", DIST);
|
||||||
|
print("Building API...");
|
||||||
|
runOrQuit("mvn clean package spring-boot:repackage");
|
||||||
|
print("Build complete!");
|
||||||
|
|
||||||
|
if (args.length > 1 && args[1] == "run") {
|
||||||
|
string f = findFile("target", "^.+\\.jar$", false);
|
||||||
|
if (f == null) {
|
||||||
|
error("Could not find jar file!");
|
||||||
|
} else {
|
||||||
|
print("Running the program.");
|
||||||
|
run("java -jar " ~ f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ const DEST = "../src/main/resources/static";
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
print("Deploying Vue app to Spring's /static directory.");
|
print("Deploying Vue app to Spring's /static directory.");
|
||||||
runOrQuit("npm run build");
|
runOrQuit("vite build --base=/app/");
|
||||||
rmdirRecurse(DEST);
|
rmdirRecurse(DEST);
|
||||||
copyDir("./dist", DEST);
|
copyDir("./dist", DEST);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
"vue-router": "^4.0.14"
|
"vue-router": "^4.0.14"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^2.3.1",
|
"@vitejs/plugin-vue": "^2.3.2",
|
||||||
"eslint": "^8.5.0",
|
"eslint": "^8.5.0",
|
||||||
"eslint-plugin-vue": "^8.2.0",
|
"eslint-plugin-vue": "^8.2.0",
|
||||||
"vite": "^2.9.5"
|
"vite": "^2.9.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/parser": {
|
"node_modules/@babel/parser": {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build --base=/app/ --mode=development",
|
||||||
"preview": "vite preview --port 5050",
|
"preview": "vite preview --port 5050",
|
||||||
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
|
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
|
||||||
},
|
},
|
||||||
|
@ -17,9 +17,9 @@
|
||||||
"vue-router": "^4.0.14"
|
"vue-router": "^4.0.14"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^2.3.1",
|
"@vitejs/plugin-vue": "^2.3.2",
|
||||||
"eslint": "^8.5.0",
|
"eslint": "^8.5.0",
|
||||||
"eslint-plugin-vue": "^8.2.0",
|
"eslint-plugin-vue": "^8.2.0",
|
||||||
"vite": "^2.9.5"
|
"vite": "^2.9.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ export function drawComponent(ctx, worldTx, component) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawSignal(ctx, signal) {
|
function drawSignal(ctx) {
|
||||||
roundedRect(ctx, -0.3, -0.5, 0.6, 1, 0.25);
|
roundedRect(ctx, -0.3, -0.5, 0.6, 1, 0.25);
|
||||||
ctx.fillStyle = "black";
|
ctx.fillStyle = "black";
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
|
@ -44,7 +44,7 @@ function drawSignal(ctx, signal) {
|
||||||
ctx.fill();
|
ctx.fill();
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawSegmentBoundary(ctx, segmentBoundary) {
|
function drawSegmentBoundary(ctx) {
|
||||||
ctx.fillStyle = `rgb(150, 58, 224)`;
|
ctx.fillStyle = `rgb(150, 58, 224)`;
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(0, -0.5);
|
ctx.moveTo(0, -0.5);
|
||||||
|
|
|
@ -4,8 +4,9 @@ import App from './App.vue'
|
||||||
import "bootstrap/dist/css/bootstrap.min.css";
|
import "bootstrap/dist/css/bootstrap.min.css";
|
||||||
import "bootstrap";
|
import "bootstrap";
|
||||||
|
|
||||||
const app = createApp(App);
|
|
||||||
const pinia = createPinia();
|
const pinia = createPinia();
|
||||||
|
const app = createApp(App);
|
||||||
app.use(pinia);
|
app.use(pinia);
|
||||||
|
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
|
|
|
@ -5,10 +5,10 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping(path = "/")
|
@RequestMapping(path = {"/", "/app", "/home", "/index.html", "/index"})
|
||||||
public class IndexPageController {
|
public class IndexPageController {
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public String getIndex() {
|
public String getIndex() {
|
||||||
return "index";
|
return "forward:/app/index.html";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,9 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
public class WebConfig implements WebMvcConfigurer {
|
public class WebConfig implements WebMvcConfigurer {
|
||||||
@Override
|
@Override
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
registry.addResourceHandler("/**")
|
// Configure resource handlers to use the /app directory for all vue frontend stuff.
|
||||||
.addResourceLocations("classpath:/static/");
|
registry.addResourceHandler("/app/**")
|
||||||
|
.addResourceLocations("classpath:/app/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue