Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

FrontEnd Pipelines: Using private NPM Repositories.

Avatar

Level 1

Adobe has documentation about how we would use Pipeline secrets and ENV variables to use a Private Maven Repository.

Is there something similar for the FrontEnd Sites projects and NPM??

e.g, if in my package.json I had this..

"dependencies": {
"my-private-repo": "git+https://${GITHUB_PAT_KEY}@github.com/My-Organization/Private-REPO.git"
}

I have been sandboxing this, and found that:

 

  • Simply having GITHUB_PAT_KEY as a Pipeline secret does not work, as NPM is not picking up on the ENV variable.
  • We cannot have exposed PAT keys in the codebase, and so the PAT must always be an ENV secret somewhere.
  • I have tried using a npm preinstall which would insert the PAT key from process.env, but the pipeline is not able to run npm preinstall.
  • Using git submodules or similar may have problems due to the predefined npm commands that the pipeline is using..

In short, how do we use a private repo as a dependancy for our Sites theme where it would build using the pipeline?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Check if this helps https://www.netcentric.biz/insights/2020/08/private-repository-cloud-manager It has a well explained section on how you can use pipeline variables for private NPM dependencies.
Hope this helps.

View solution in original post

3 Replies

Avatar

Community Advisor

Hi @david_dorr1 ,

Please make sure you have below configuration in pom file.
npm and node versions you can mention as per ypour project requirement.

ui-frontend module POM.xml
<plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>npm run prod</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>run prod</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
main pom.xml

<configuration>
<nodeVersion>v18.18.2</nodeVersion>
            <npmVersion>9.8.1</npmVersion>
</configuration>

 

 

-Tarun

 

Avatar

Correct answer by
Community Advisor

Check if this helps https://www.netcentric.biz/insights/2020/08/private-repository-cloud-manager It has a well explained section on how you can use pipeline variables for private NPM dependencies.
Hope this helps.