/npm-mvn-proxy

The Npm-mvn-proxy provides easy way to publish and download javaScript projects using Artifactory Maven repository. This is simple proxy between Npm console and Artifactory.

Primary LanguageJava

Build Status codecov

Npm-mvn-proxy

The Npm-mvn-proxy provides easy way to publish and download javaScript projects using Artifactory Maven repository. This is simple proxy between Npm console and Artifactory.

How It Works

Publishing from npm console to Artifactory

LinImage

Folder structure after publishing to Artifactory

LinImage

Download Npm dependencies form Artifactory

LinImage

Building project

Prerequisites

Git and JDK 8 update 20 or later

Be sure that your JAVA_HOME environment variable points to the jdk1.8.0 folder extracted from the JDK download.

Check out sources

git clone git@github.com:anicos/npm-mvn-proxy.git

Compile and test; build jar

./gradlew build

... and discover more commands with ./gradlew tasks. See also the Gradle build and release FAQ.

Running project

Running from terminal

The Npm-mvn-proxy based on Spring Boot. To start proxy you just add file properties. ./npm-mvn-proxy.jar --spring.config.location=application.properties

Minimal properties example

maven.repo.url=http://maven.com/artifactory - variable maven.repo.url is artifactory REST API address. For example for Artifactory Version 4.14.0 REST address is {domain}/artifactory

All application properties example

maven.repo.url - the above-described.

folder.for.npm.artifacts - folder where are saved npm artifacts in Artifactory during publish command. Default value is libs-release-local/npm.

npm.url - Npm registry address. Default value is http://registry.npmjs.org.

... and discover more properties in Spring boot documentation in section Appendix A. Common application properties.

Configuration npm console

To use npm-mvn-proxy follow these steps:

1 Add Artifactory user to npm console

npm adduser --registry={npm-nmv-proxy address} --always-auth

For example when you run application locally use npm adduser --registry=http://localhost:8080/ --always-auth. After this command enter login and password to Artifactory

2 Set address registry to npm-mvn-proxy

npm config set registry {npm-nmv-proxy address}

3 Set always-auth flag to true

npm config set always-auth true

Artifactory suported version

The npm-mvn-proxy should support all Artifactory version which support rest API. This version of npm-mvn-proxy was tested with Artifactory Version 4.14.0.

Contributing

Pull requests are welcome.

License

The Npm-mvn-proxy is released under version 2.0 of the Apache License.