Skip to content

Commit

Permalink
fix: make the npm script portable in Maven example
Browse files Browse the repository at this point in the history
npm guideline is to not prefix with relative path, as executables are added to the $PATH. Tested on Windows and macOS.

Also add missing "npm install" excution to Maven frontend plugin.
  • Loading branch information
rquinio1A committed Apr 25, 2024
1 parent 7e2b61d commit 483d047
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
10 changes: 10 additions & 0 deletions examples/integrate-with-maven/maven-project/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@
<nodeVersion>v18.15.0</nodeVersion>
</configuration>
</execution>
<execution>
<id>Dependencies</id>
<phase>generate-sources</phase>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>Generate sources</id>
<phase>generate-sources</phase>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { JAVA_JACKSON_PRESET, JavaFileGenerator } from '@asyncapi/modelina';
import path from 'path';

// Where should the models be placed relative to root maven project?
const PACKAGE_NAME = 'java/com/mycompany/app';
const MODEL_DIR = `src/main/${PACKAGE_NAME}`;
const PACKAGE_NAME = 'com/mycompany/app';
const MODEL_DIR = `src/main/java/${PACKAGE_NAME}`;

const FINAL_OUTPUT_PATH = path.resolve(__dirname, '../../', MODEL_DIR);
// Setup the generator and all it's configurations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"ts-node": "^10.3.0"
},
"scripts": {
"generate": "./node_modules/.bin/ts-node ./generate.ts",
"generate:windows": "..\\node_modules\\.bin\\ts-node .%\\generate.ts"
"generate": "ts-node ./generate.ts"
}
}

0 comments on commit 483d047

Please sign in to comment.