How to create a yeoman generator without yo prefix? - node.js

I am creating a command line generator for improve productive with nodejs server development, The most widely used generator is yeoman, so I choice it for creating command line tool, But there is problem that how to use generator without yo prefix?
yo tuols
But I wanna use tuols command without yo prefix
tuols
How to do that?

This is explained in the Yeoman documentation http://yeoman.io/authoring/integrating-yeoman.html

Related

create nodejs cli select/options menu

How do you create an arrow-key menu list?
I'm looking for something like after entering in eslint init or create-react-app <project>? (see images below)
ESlint
yeoman
Searching around to find ways to create a CLI, I found NodeJS to be an option followed by a few tools: Commander.js, Vorpal, and/or create-new-cli.
If I am on the right track, how can I create a CLI arrow-key select menu?
I believe yeoman is using inquirer. Source: yo's dependencies.
I've also seen prompts which has a similar arrow selection feature and other cli ui/ux features. See the demos about halfway down the page.
Note: I've never actually used either, I'm just in the same research phase.
looks like 'inquirer' (npm i inquirer)
also for progress bars and such you should look at clui (npm i clui)
for parsing commands most use commander (npm commander) or the open cli framework (npm i oclif) - you can also look at yargs (very similar to commander, npm i yargs)
inquirer and clui work very well with both command parsers.
Have fun.

Register Yeoman Generator non-cli

I want to run a Yeoman generator without the cli (yo). I see the instructions in the Yeoman documentation about how to run a generator without the CLI environment.
If I run yo mygenerator:mysubgenerator it works (it's installed globally), but using env.run('mygenerator:mysubgenerator') from node does not work. It says that the generator is not installed.
I think this has to do with the //register/lookup generators step in the documentation above, but they don't include how to do this at all. How can I register my globally-installed generator?
There's a complete documentation here: http://yeoman.io/authoring/integrating-yeoman.html
The basic idea is you need to lookup installed generators before you can run them:
env.lookup(function () {
env.run('angular');
});
Why don't you try on this way:
env.register(require.resolve('generator-mygenerator'), 'mygenerator:mysubgenerator');

Yeoman hangs on line 72 of events.js, won't let me do anything

First of all, I'm running this on Windows 8.
So When I install yeoman with npm install -g yo, it seems to work fine.
Then, when I type in the command yo, I get the usual response of:
[?] What would you like to do? (Use arrow keys)
Run the Famous generator (0.2.10)
Update your generators
Install a generator
Find some help
Get me out of here!
But then when I click on, for example,
Update your Generators
I get the following:
Its the exact same error every time, and it's preventing me from using any yeoman generators, which is making it impossible then to use the new Famo.us engine.
So far, I've tried uninstalling and reinstalling Node, Yeoman, and everything in between. I've also tried it in various command prompts, including the standard Windows Command Prompt, Git Bash, NodeJS commandPrompt, and cygwin.
Does anyone know how I can fix this?
One avenue of action I've been thinking about is trying to find this events.js (or whatever other file this error is originating from) and trying to build from there.
Also, this person # Yeoman gifsicle error (and others) seems to be having similar issues, but the fixes mentioned in that question don't seem to be working for me.
Thanks!

No command line utility for express/node windows 7

I can't run the command express from the windows 7 command line. A tutorial I am following (here) suggests that I use the command line and call express to build a skeleton application.
I move into the directory of the express module in my node_modules area and attempt to locate a batch file or executable that is able to run from the command line.
I have found nothing, there are no files included in the module that can be run from the command line.
I am now very confused.
Does anyone understand where this elusive express command line utility exists?
I have found the batch file.
All command files for modules that are meant to be invoked via the command prompt are found in node_modules\.bin
So make sure that is in your path environment variable.
It looks like Jonathan Lonowski was right - the guide is a bit outdated. The latest command for using the express generator is:
npm install -g express-generator
This will still give the same directory structure suggested in the tutorial.
More info on Express's Github page
You need to install the Express application generator, as described in Express Getting started document. Install it with the following command:
$ npm install express-generator –g
After that, you can run the command express from any windows 7 command line.

What does npm mean for socket.io/installing stuff?

I'm a real noob at this. I've just began scratching the surface on node.js/socket.io/html5 and stuff. I finally figured out how to use my command prompt (using windows) to launch a "hello world" application with the command "node example.js." But what does npm mean? When I'm looking at socket.io it says to install, npm install socket.io Does that mean I need to extract all the files into my nodejs folder?
I'm confused.
npm is a generally awesome program for managing packages and dependencies (especially while you have a network connection). It does lots of fancy things and is most commonly used with node.js projects. That said, it's an unfortunately common misconception that the acronym stands for "node package manager".
In reality, npm doesn't actually stand for anything as it's not an acronym. With taglines like "no problem, meatbag" the npm organization playfully resists the trend of acronymization. It should always be referenced in lowercase to avoid confusion with the National Association of Pastoral Musicians.
npm is a command line interface program to manage node.js libraries (it stands for node package manager - at least it did initially, they since turned this into a bit of a running gag - thanks to #spex in the comments for that link). Check out the docs, it is awesome and amazing. As you mentioned, just type npm install in a command prompt, and voilà, you have the library in your local node modules.
npm is stands for Non-Parametric Mapping utility written by Chris Rorden...
But we can keep it as Node Package Manager and it is very helpful for Module Loader which uses CommmonJS module pattern, and I am not sure will Node will support the ES2015 Module Loading Syntax (Built in module Loading Syntax)?
for those who are wondering the same thing, you just type npm install socket.io in the command prompt where nodejs file is.
C:/Program Files/nodejs
That should be what your command prompt should say and then just type that in.

Resources