What is the preferred way of updating Yeoman generators? - yeoman

I've created a Yeoman generator and want my team to use it.
What happens if I update my generator on Github? They installed the generator locally in an older version. Do they always have to install again to get the latest version?
Team members don't know when updates happen and I don't want them to care too much about it. I just would like for them to use the latest version of the generator.
What is the suggested way of updating generators?
Thanks

Glad you asked!
Starting with Yeoman RC1, which will be announced later today, there's a brand new way to manage your generators: Just enter yo and enjoy the new wizard:
If you select "Update Generators" from the menu, yo yo will take care of bringing them all to the latest version.
If you are a generator author and want to go one step further to make sure your users are always up-to-date, you can use update-notifier from the Yeoman project to greet users with a notification if they run an obsolete version.

If you want to update a specific generator you can run
npm update generator-mygenerator -g
Nice if you have many generators installed.

In linux I had trouble of upgrading using the yoeman cli because of some permission issues
So instead I did the following
In my case it was
sudo npm install -g generator-your-generator-name
This automatically reinstalled the latests version
You could try
npm install -g generator-your-generator-name

Related

Install version cordova-ios 4.3.0 for visual studio and issue with cordova command not existing in CLI

Someone has asked the exact question I need on this page.
However, as I am new, my rep will not allow me to comment yet! So I have had to create a new question.
A guy in the question linked above suggests to "Type cordova platform add ios;". So there I suppose is where my question is different.
When I type Cordova in cmd prompt, I get a message saying "cordova is not recognized as an internal or external command, operable program or batch file."
Update: Please note, I have followed these steps: http://cordova.apache.org/docs/en/7.x/guide/cli/ And I am able to run the npm commands in CLI. I was hoping to simply update my ios version only.
I have also looked up PATH but I have no idea where to start, problem is, people suggest that I shouldn't need to adjust PATH as running the CLI commands to install the Cordova CLI should just allow me to use it?
So to summarize:
I downloaded the node.js and installed it
I typed this into cmd "npm install -g cordova" which installed
I type "cordova" and get my "cordova is not recognized as an internal or external command" message above
My aim is to upgrade my cordova-ios 4.2.0 to cordova-ios 4.3.0 to fix my main error of "remote build requires your projects to use cordova-ios 4.3.0 or greater with XCode 8.3"
Update 2 9th oct 2017:
I have given up for now with the above, to work around this i installed Node.js 8.6.0 then updated cordova using npm... im now facing some more issues that I am again stuck on and will create a new question.
Hopefully in the meantime, someone can answer this question and i can try again.
I suspect my issues could be relating to the fact i installed VS 2017 and used all the built in nuget packages (for cordova and node.js) and they are conflicting with the manual way in some way (i suspect that, as running the "cordova" command on my other PC worked fine!)

ASP.NET 5 and Yeoman genetaror issue

First of all I looked into [this][1] post for possible workaround but unfortunately there is none.
My issue is somewhat closer but steps I went through are different so I decided to put up my question in a new thread.
My requirements were:
Installing ASP.NET 5 but I did not want to install full VS 2015 rather I went for DNVM (Dot Net Version Manager) and DNX (NET Execution Environment). This post says we can install from Command Line tool so I used this.
Installing Code for Visual Studio which I did
Installing a aspnet-generator using yo which I did using the following command: npm install -g yo generator-aspnet but ended up with some error messages. Please see screenshot below:
Even I got above errors I went on and ran yo aspnet which was supposed to give me choice of what type of application I want to create etc. But here I ended up with errors again. Please see screenshot below:
I googled a lot but nothing looked suitable or closer to my issue. I don't want to play with Windows Registry.
I am completely screwed up with this problem :( Somebody please show me the right path and help me out of this stand-still situation.
Thank you
This is unfortunately a bug with npm. Here is the usual troubleshoot:
Make sure you're on the latest npm version
Delete the node_modules folders and retry installation
If this doesn't fix it, then you should open an issue on the npm bug tracker.

yo meanjs not recognizing generated project

I've created a new MeanJS project using Yeoman. It installs just fine. When I want to add a new module using yo meanjs:angular-module mymodule, it tries to create a new project ("Which mean.js version would you like to generate") instead of just adding the new module.
Where should I look for errors?
I'm using node v0.12.7 and npm v2.11.3.
Yeah, I know this could be confusing, at least when you starting with Meanjs. You probably used a version greater than 0.3.0 (stable) and sub-generators like yo meanjs:angular-module are only available (by that time of writing this) with version 0.3.0 (stable). Look at the red message top at this page: http://meanjs.org/generator.html What's confusing here is that they recommended on their page to install the application using the yeoman but after you did that you expect to be able to use sub-generators... If you want use subs, please use 0.3.0. and I suggest you to use supported Node.js and npm versions (http://meanjs.org/docs/0.3.x/#troubleshooting):
MongoDB
MongoDB version 2.4.x is supported.
Node.js
Node version 0.10.x is supported.
npm
npm version 1.3.x is supported.

Use older version of jHipster

I have different projects using jHipster (which is an absolutely awesome project!!!).
My problem is that I have already made important changes on some projects created with earlier version and I don't want to upgrade to the latest version.
Is there any way to set the version while using the generator ?
What I'm looking for is something like that :
yo jhispter:entity foo -v 1.2.0
when I want to use the version 1.2.0 to generate the entity.
Does something like that exist ? If no, how to manage different versions of the generator ?
After more research on the subject it looks like you need to install an older version to switch version.
npm install -g generator-jhipster#1.2.0

How to upgrade existing project scaffolded with Yeoman

I used generator-angular a few months ago to scaffold a project and the whole ecosystem (karma, Node versions, grunt packages) has moved on quite significantly. I keep running into problems running tests, building things, and so on.
I know I can use nvm to downgrade my Node version and install older packages, but that kind of sucks, especially when there are many developers on the team. I have used the generators for 10+ projects over the past few months so I'm very interested in a solution.
Is there a recommended upgrade path for when new versions of generators are released, apart from just regenerating the project and copying files across?
(Just to note: this isn't a problem with upgrading a Yeoman 0.9 project.)
First make sure you have committed everything or have a backup, then just scaffold out over the project again. yo will ask you for each file if you want to overwrite. For those files you haven't edited, just say yes. For the other ones, type d for diff and see what's changed. Then manually do the changes, and run npm install & bower install to get the latest dependencies.
EDIT
As mentionned in comments by Markus Gattol :
yo <generator-name> now already run bower install & npm install i.e. no need to run them explicitly again – Markus Gattol

Resources