File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818 "generate:api" : " npm run generate:api:intelligence-service && npm run generate:api:application-server" ,
1919 "format:java" : " node --import tsx scripts/run-quiet.ts prettier --write \" server/application-server/src/**/*.java\" --config-precedence prefer-file --config server/application-server/.prettierrc.yaml --ignore-path server/application-server/.prettierignore" ,
2020 "format:java:check" : " node --import tsx scripts/run-quiet.ts prettier --check \" server/application-server/src/**/*.java\" --config-precedence prefer-file --config server/application-server/.prettierrc.yaml --ignore-path server/application-server/.prettierignore" ,
21- "lint:java" : " cd server/application-server && ./ mvnw pmd:check -q" ,
22- "lint:java:report" : " cd server/application-server && ./ mvnw pmd:pmd && echo 'Report: server/application-server/target/site/pmd.html'" ,
21+ "lint:java" : " node --import tsx scripts/run- mvnw.ts pmd:check -q" ,
22+ "lint:java:report" : " node --import tsx scripts/run- mvnw.ts pmd:pmd && echo 'Report: server/application-server/target/site/pmd.html'" ,
2323 "format:intelligence-service" : " npm -w server/intelligence-service run format" ,
2424 "format:intelligence-service:check" : " npm -w server/intelligence-service run format:check" ,
2525 "lint:intelligence-service" : " npm -w server/intelligence-service run lint" ,
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env node
2+ /**
3+ * Cross-platform Maven wrapper runner.
4+ * Resolves ./mvnw (Unix) or mvnw.cmd (Windows) automatically.
5+ *
6+ * Usage: node --import tsx scripts/run-mvnw.ts [maven-args...]
7+ * Example: node --import tsx scripts/run-mvnw.ts pmd:check -q
8+ */
9+
10+ import { spawnSync } from "node:child_process" ;
11+ import path from "node:path" ;
12+ import process from "node:process" ;
13+ import { fileURLToPath } from "node:url" ;
14+
15+ const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
16+ const mvnwDir = path . resolve ( __dirname , ".." , "server" , "application-server" ) ;
17+ const isWindows = process . platform === "win32" ;
18+
19+ function main ( ) : void {
20+ // shell: true is required on Windows for .cmd files (CVE-2024-27980).
21+ // Safe here because args come from hardcoded npm scripts, not user input.
22+ const result = spawnSync (
23+ isWindows ? "mvnw.cmd" : "./mvnw" ,
24+ process . argv . slice ( 2 ) ,
25+ {
26+ stdio : "inherit" ,
27+ cwd : mvnwDir ,
28+ shell : isWindows ,
29+ } ,
30+ ) ;
31+
32+ if ( result . error ) {
33+ const errCode = ( result . error as NodeJS . ErrnoException ) . code ;
34+ if ( errCode === "ENOENT" ) {
35+ console . error (
36+ `Maven wrapper not found in ${ mvnwDir } . Is the Maven wrapper installed?` ,
37+ ) ;
38+ } else {
39+ console . error ( `Failed to run Maven wrapper: ${ result . error . message } ` ) ;
40+ }
41+ process . exitCode = 1 ;
42+ return ;
43+ }
44+
45+ if ( result . signal ) {
46+ process . kill ( process . pid , result . signal ) ;
47+ return ;
48+ }
49+
50+ process . exitCode = result . status ?? 1 ;
51+ }
52+
53+ main ( ) ;
You can’t perform that action at this time.
0 commit comments