How to install npm packages from Telerik private repository in VSTS build? - npm

I have a nice application where I'm using Telerik's Kendo UI for Angular 2. It is getting better and better. I would like to setup my builds in VSTS where installing packages, compiling TypeScript files are part of the build. Getting packages from Telerik repository requires authentication. I haven't found so far any usable description how to do it.
Telerik says that I should either directly authenticate or use .npmrc file and refers to an MS site.
The funny thing is that npm login (which is needed to connect Telerik's npm repo) does not accept username and password as parameter (doesn't matter how the community screams for it). I don't know why Telerik refers to this.
The .npmrc option is also funny, because it says that I should use vsts-npm-auth package to get credentials. I assume it means that I'll get the credentials of the build machine and it will be written in .npmr file. It is not a good solution for me. I got the build machines from a pool and the credentials rather a strongly limited credentials (enough fora build machine and nothing more) which does not equal my username and password at Telerik.
So, that's where my story ends and I need some help from you guys. How to do it? Did I misunderstand something? Is there anybody out there who did it?

First, vsts-npm-auth is used for VSTS.
Secondly, after logging in (npm login) the .npmrc will be populated with an authentication token that can be copied to build agents or store file per-project. So try to use this .npmrc file and check the result.

It figured out that vsts-npm-auth doesn't work together other private repositories than VSTS feeds. I let the team know and they, hopefully, will implement it.

Related

Is there a way to deploy 2 versions of the same package for 2 different use cases at once?

The answer seems like 'no' but I wanted to check with colleagues here.
We provide an npm package for our own sites as well as some 3rd party sites.
There's a fairly heavy and old homegrown npm package that we also have in our package.
We don't need that package any longer on our sites but the 3rd party sites do.
We also have no way of controlling the code on those 3rd party sites so we need to keep the deployed bundle name and location the same for them.
Is there a way to publish a version of our package first without the extra package for us and then a version with it for the third parties from the same repository?
ourpackage-new.js (without the dependency)
ourpackage.js (with the dependency)
I had some success with a new package json in a subdirectory. I would create a new package and the original package via a command in gitlab.yaml to cd into that directory and npm publish there after the first one. This requires copying some dependency files down there as well which would mean if one version was updated, we'd need to remember to update the copy. Not a situation we'd want.
Even if we created a 2nd repository for the change just for us, we'd still need to update 2 repositories every time we had a new change to deploy.
Checked into Aliasing as well, we wouldn't be planning to import a new version and an old version though, more like sister versions.
In any case, thanks for the input and thoughts. I realize Npm was prob not made for this type of situation. If I remember right, I could do this with Gulp years ago, but I haven't even thought about Gulp in so long :) And then, I'd have to deploy manually via an FTP program ... wow, those were days.
Thanks again!

Options for local hosted client side package management in VS2019?

A common issue I keep bumping into for web projects in net core, is the need for sharing javascript in easy to use modules from project to project. Often times large quantities of code written in VS project A could be very much used in project B, sometimes in the same solution.
Restrictions:
Must be self hosted, not publicly exposed, only within local network etc etc can access the libs/modules/packages/etc
Ideally can be performed via visual studio projects and make use of build tasks, powershell, msbuild, or other such automation tools to deploy and package, minify, bundle, etc etc the javascript libraries.
The absolute ideal is if this can all be hosted from just a network folder
NPM/Yarn
I'm not super familiar with either of these, but is there a way we can drag and drop javascript code we've built into some designated folder, perhaps modify some form of manifest, json or xml file or what have you, and then anyone can just npm install those packages? I guess what I'm wondering is, is there a way to tell npm "This folder now is a source of packages you can install from"?
Bonus points: If said "trust this folder" config can be set inside of the VS project, so if someone new grabs the git repo, it will just work "out of the box" and they dont need to go through steps configuring npm or yarn so it knows how to find those packages.
Libman
Same as above, but mostly I'm trying to figure out if there is any way at all to configure libman from VS. It's the default and what is currently in use, but it just has its four default CDNs it comes with that it trusts and I am not seeing any way at all to tell Libman "Here's a now resource for files to trust, add that to the selectable drop down"
But I am seeing basically zero configuration as an option for libman, which is quite disappointing.
Nuget
This is the other option that is already popular locally, but something about using nuget to deliver js files when NPM, Yarn, and Libman already exist sets my teeth on edge, but, we have I believe a locally hosted nuget server that could be used already, so the infrastructure I believe is already setup, if not, I know how to do it. I do like the fact that nuget 100% for sure could leverage actual projects and build steps and msbuild and etc for deploying.
Conclusion
What's the popular and easy way to do this nowadays? Best case scenario is if there's a way to go, "Put a manifest.json file in the folder root that points to all the modules inside, then add it as a trusted source to your package manager, and now you can install those packages"

Can't see or publish packages with Verdaccio

I’m fairly new to Verdaccio. Been familiar with the tool for quite some time, but this is my first time trying to use it. I’ve installed it locally for the purpose of trying to figure out the right syntax for handling versioning, tagging and publishing a shared component library for work, but I’m having trouble getting this package published to my locally running instance of Verdaccio, and I’m struggling to understand why the publish command is failing. Was hoping someone here might be able to help.
First off, I should say that I have it installed and running locally, I can browse to http://localhost:7890 and see the Verdaccio web UI, and it says that I have “No package published yet.” That makes sense, because I haven’t been able to successfully publish anything yet. I’ve created a user with the npm adduser —registry http://localhost:7890 command, and then after that I ran the following command to attempt to publish to it: npm publish —access public —registry http://localhost:7890. When I run this command, I get the following error: “EPUBLISHCONFLICT … Cannot publish over existing version.”
Now, I can in fact see, when I look in .local/share/verdaccio/storage that there is a folder for the scope that I published with, and in that folder, there is a folder for the package that I apparently published, and it only has a package.json file in it. I’ve attempted to wipe this all clean, reinstall Verdaccio, etc, etc, nothing seems to fix the issue. I can’t seem to make this package go away, OR to get it to display in the UI either. After publishing (unsuccessfully), and despite the face that it says this version of the package exists, I still see nothing in the UI. It still just says “No package published yet”, which I still don’t really understand.
Any ideas would be appreciated. This has me pretty stumped. Thanks.
Add your package.json name as npm registry (it needs the same one you published the last time).
I was getting this issue:
The following works for me:
npm publish --registry=http://yourhost:yourport

I am not able to connect github using bamboo

Installed latest version of bamboo. I am not able to pull the repository from the github. I am getting below error..
Bamboo Server Edition
Version : 6.9.0
I am getting below error
[Git credentials storage exception.])
Look at agent logs. It should contain more details. Usually it means Bamboo was not able to create or access credentials file.
Bamboo documentation advises against installing Bamboo main directory into C:/Program Files
and also you may want to avoid installing "bamboo-home" into users directory.
I faced the same exception. What worked for me was creating a new folder "X" on desktop and redirecting the Bamboo installation to folder "X."
Similarly, I did the same thing for "bamboo-home."
(Sorry, I don't have the link for bamboo documentation on this. You may want to find it yourself.)

npm/bower - Basic questions(Why it requires for just AngularJS then?)

I read about npm and bower, differences, usage, how it works, purpose as well. All explanation says that to work in NodeJs. But when I searched for AngularJS2, the tutorial says use npm. I have some basic questions based upon the understanding that npm basically for dependency management or packages to be installed.
How my Java/Eclipse workspace knows that npm installed the particular JS library/file, what path should be given in the html/web page for including those files/libraries?
If I move the web application to production, how will the server gets those dependent libraries? Even if server gets it, it might be installed in different folder. Basically how it can be managed with a web applications in different environments for just AngularJS app?
Can anyone please help me to have better understanding?
Finally found the answer. NPM is node package manager which helps basically to download the dependencies (almost like maven, gradle in java).
npm software needs to be installed in developer's machine.
Add the required dependencies in the package.json in the root folder of AngularJS application.
Open the DOS command line and navigate to project root folder(workspace/project in eclipse), then type npm install which will download all the dependencies mentioned in the package.json to a folder called npm_modules inside project folder.
The other and important advantage is npm can be used to install browser agent as well. So npm start command will open the browser and will load the application automatically in browser. Developer does not need to be aware about NodeJs. One more benefit of using this approach is the browser will get refreshed automatically when any update in the JS file gets saved.