This page (revision-21) was last changed on 07-Feb-2024 18:37 by Dieter Käppel

This page was created on 22-Sep-2022 10:37 by Dieter Käppel

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
21 07-Feb-2024 18:37 8 KB Dieter Käppel to previous

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 1 changed 4 lines
!!!Java und NodeJS
Oft möchte man ein [NodeJS] Modul in ein Java-Projekt integrieren, beispielsweise mit dem Ziel einen Server für die Web-Applikation zur Verfügung zu stellen (Webpack serve etc. sind oft nicht die optimalen Produktivumgebungen).
!!Maven Build of NodeJS Module
!!!Maven Build of NodeJS Module
At line 74 removed 31 lines
!!Bestehendes NodeJS-Modul integrieren
Besser ist ein bestehendes NodeJS-Modul zu integrieren. NodeJS hat eine eigene Repository-Infrastruktur. Als Gateway gibt es das jnpm-maven-plugin:
{{{
<plugin>
<groupId>org.orienteer.jnpm</groupId>
<artifactId>jnpm-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<?m2e execute onConfiguration?>
<phase>generate-resources</phase>
<goals>
<goal>install</goal>
</goals>
<configuration>
<registryUrl>https://registry.npmjs.org/</registryUrl>
<strategy>ONE_DUMP</strategy>
<outputDirectory>${project.build.directory}/generated-resources/jnpm/</outputDirectory>
<pathPrefix>META-INF/resources</pathPrefix>
<serverId>npmjs</serverId>
<packages>
<package>hello-world-server</package>
</packages>
<useCache>false</useCache>
</configuration>
</execution>
</executions>
</plugin>
}}}
At line 110 changed one line
[NodeJS/jenkins verwalten.png]
[nodejs/jenkins verwalten.png]
At line 114 changed one line
[NodeJS/nodejs plugin.png]
[nodejs/nodejs plugin.png]
At line 118 changed one line
[NodeJS/nodejs installationen.png]
[nodejs/nodejs installationen.png]
At line 125 changed one line
[NodeJS/jenkins build standard.png]
[nodejs/jenkins build standard.png]
At line 130 changed one line
[NodeJS/jenkins build pipeline.png]
[nodejs/jenkins build pipeline.png]
At line 183 changed one line
[NodeJS/jenkins docker pipeline.png]
[Nodejs/jenkins docker pipeline.png]
At line 187 changed one line
[NodeJS/jenkins docker config.png]
[Nodejs/jenkins docker config.png]
At line 209 removed 50 lines
!!!Authentication
Generieren eines Passworts für die ~/.npmrc:
{{{
echo -n 'admin:admin123' | openssl base64
}}}
Die Zeile in .npmrc sieht dann so aus:
{{{
registry=[...]
_auth=YWRtaW46YWRtaW4xMjMNCg==
}}}
[https://help.sonatype.com/repomanager2/node-packaged-modules-and-npm-registries]
!!!Express
Alternativ zum Webpack Devserver gibt es noch den Express Server. Dieser kann auch verwendet werden, um eine Anwendung zu debuggen. Das erfolgt über die webpack-dev-middleware:
{{{
import express from "express";
import {createProxyMiddleware} from "http-proxy-middleware";
import webpack from "webpack";
import middleware from "webpack-dev-middleware";
import options from "./webpack.config";
const host = "localhost", port = 8090;
const server = express();
const compiler = webpack(options);
server.use("/", middleware(compiler));
server.use(createProxyMiddleware("/service/**", {
target: "http://localhost:8080"
}));
server.listen(port, () => {
console.log("Server listening at http://" + host + ":" + port + "/");
});
}}}
!!!Update Packages
Mit dem Tool npm-check-updates können NodeJS bzw. npm Packete upgedated werden:
{{{
npm install -g npm-check-updates
ncu --upgrade
npm install
}}}