This post is an insight on npm
for those of you who have a maven
background.
In the Java/maven
world, you build a source code to a jar, then you push your jar to Nexus. All of this is done using maven
.
Eventually, your deployment tool retrieves your jar from where it was stored in Nexus, and delivers it to whatever environment it targeted.
Now I'm working on an Angular project and have a hard time, putting all the pieces together.
I understand I can publish my Angular project to an npm repository in Nexus. But what I will publish here will be an npm package, including a package.json
file.
I understand I can build my Angular project to a /dist
folder, and deliver this folder to an environment.
But now, I don't understand how it all make sense: with my maven
background, I'm expecting to use npm
to push the content of the /dist
to Nexus!
What am I missing here? What are the good practices in this domain?
After some research here is my understanding of the subject:
Once compiled using ng build
your Angular project is no longer an npm project but a static web site.
You may no longer manage (in this case: "deploy" to Nexus) your project using npm
like you would do with maven
.
As such (quoting jonrsharpe's comment) you may zip the content of the /dist
folder produced by ng build
to distribute it.
At this point, if you wish to push it to a Nexus repository, you may use maven deploy plugin. But then your web site would be pushed to a maven repository.
Bottom line: it all depends on what you need to do.
I hope this helps.