I began my first pure front end project. I want to deploy it the java/maven. So i set up a normal war project:
│ package.json
│ pom.xml
│ tsconfig.json
│ typings.json
│
│
├───src
│ └───main
│ ├───resources
│ └───webapp
│ │ index.html
│ │
│ ├───app
│ │ app.component.ts
│ │ main.ts
│ │
│ ├───css
│ │ styles.css
│ │
│ └───WEB-INF
│ web.xml
│
My problem is how to set the path to index.html/the source relative to package. json? Since this is an angular/typescript project there is also some typescript specific stuff. but my hope is to set the "source" path once and for all in package json?!
I am also not sure if i want to deploy the stuff in "webapp" directly since there are Compiling steps. So any advice how to structure a pur front end project for maven/war deployment are welcome.
In order to integrate NPM with Maven, you could make use of frontend-maven-plugin which I think will be a great tool for your compiling steps.
So, in order to configure everything together this how your pom.xml should look like:
As you can see, first we define the usage of frontend-maven-plugin:
following, it will be necessary to define the executions: the first two I believe that are quite straightforward; the last one simply assumes that, inside your package.json, there's a script target named build which will, for example, call the browserify command in order to build a bundle.js file:
In your case, instead of the app.js, the package.json would interact with your typescript files.
Finally, one has the definition of the Maven WAR plugin. The only configuration made was the mention to the location where the web.xml is.
Notice that, by definition, Maven will package everything that's inside src/main/webapp directory. So, if there are any files (or folders) that you'd like to exclude, you should make use of the configuration parameter <packagingExcludes>:
The configuration above would exclude the folder app.
Again, this is a starting point. From here, you could play with Maven in order to custom build your application.